Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
Local.php
Go to the documentation of this file.
1 <?php
3 
5 
13 final class Local {
14 
22  public static function fromPath(/*string*/ $path) /*: Directory*/ {
23  return Fly::createLocal($path);
24  }
25 
35  public static function root() /*: Directory*/ {
36  static $dir;
37 
38  if (!isset($dir)) {
39  $dir = self::fromPath(realpath(__DIR__ . '/../../../../..'));
40  // Assumes composer vendor location hasn't been customized...
41  if (!$dir->isFile('vendor/autoload.php')) {
42  // Assume we're is installed at vendor/{vendor}/{package}
43  $dir = self::fromPath(realpath($dir->getPath() . '/../../..'));
44  }
45  }
46 
47  return $dir;
48  }
49 }
A simple directory abstraction.
Definition: Directory.php:13
$path
Definition: details.php:88
Namespace for generating local filesystems.
Definition: Local.php:13
static fromPath($path)
Shorthand for generating a new local filesystem.
Definition: Local.php:22
static root()
Returns a directory that points to the root composer install.
Definition: Local.php:35
static createLocal($path)
Shorthand for generating a new local filesystem.
Definition: Fly.php:156