Phrozn\Path\Project::get PHP Méthode

get() public méthode

Get calculated path
public get ( ) : string
Résultat string
    public function get()
    {
        if (null === $this->path) {
            throw new \RuntimeException('Path not set.');
        }
        $path = $this->path;
        for ($i = 0, $mx = substr_count($path, DIRECTORY_SEPARATOR); $i <= $mx; $i++) {
            if (is_dir($path . DIRECTORY_SEPARATOR . '.phrozn')) {
                return realpath($path . DIRECTORY_SEPARATOR . '.phrozn');
            }
            $path = dirname($path);
        }
        return '';
    }

Usage Example

Exemple #1
0
 /**
  * Clobber bundle
  *
  * @return void
  */
 private function execClobber()
 {
     $pathArg = $this->getPathArgument('path', false, $this->getCommand());
     $path = new ProjectPath($pathArg);
     $bundle = $this->getBundleParam();
     $files = $this->service->getBundleFiles($bundle);
     $this->out("Located project folder: {$path->get()}\n");
     if (is_dir($path->get()) === false) {
         throw new \Exception("No project found at {$pathArg}");
     }
     $this->out('Bundle content:');
     foreach ($files as $file) {
         // Archive_Tar defines dir as typeflag 5
         if (in_array($file['typeflag'], array(5)) === false) {
             $this->out('    ' . $file['filename']);
         }
     }
     $this->out("\nBundle files are to be removed.\n" . "This operation %rCAN NOT%n be undone.\n");
     if ($this->readLine() === 'yes') {
         $this->service->setProjectPath($path)->clobberBundle($bundle);
         $this->out(self::STATUS_OK . " Done..");
     } else {
         $this->out(self::STATUS_FAIL . " Aborted..");
     }
 }
All Usage Examples Of Phrozn\Path\Project::get
Project