public static function loadPath($path, $type = null) { $model = new self(); $model->path = $path; $model->originalPath = $path; if ($type) { $model->type = $type; } $model->getType(); if ($model->isDirectory()) { return false; } if ($model->isPhp()) { $attributes = $model->attributes; $model = new PhpFile(); $model->attributes = $attributes; } if ($type === self::TYPE_HOSTS) { $attributes = $model->attributes; $model = new HostsFile(); $model->attributes = $attributes; } $model->getContents(); return $model; }