Page::from()

Object instantiator.

Table of Contents
  1. Description
  2. Example

Description

Page::from(...$lot): self;

It is just a shortcut for the Page::__construct() way.

Example

$page = Page::from('.\lot\page\article.page');

The example above is the same as the instantiation below:

$page = new Page('.\lot\page\article.page');

Its purpose is to help you avoid using parentheses when you want to call a method directly from the class instance to minimize variable usage:

// Syntax error, unexpected token “->”, expecting “)”
$title = new Page('.\lot\page\article.page')->title();

// :(
$page = new Page('.\lot\page\article.page');
$title = $page->title();

$title = (new Page('.\lot\page\article.page'))->title(); // :\
$title = Page::from('.\lot\page\article.page')->title(); // :)

Page::from()

Object instantiator.

Page::size()

Gets the file sizes in human readable string format.