path() публичный статический Метод

restores the path from the url
public static path ( string $url ) : string
$url string vfsStream url to translate into path
Результат string
Пример #1
0
 public function successCompress($file)
 {
     if (preg_match('#[^-]+-([^.]+)[.](png|jpe?g)$#', basename($file), $match)) {
         $key = $match[1];
     } else {
         $key = null;
     }
     $input = filesize($file);
     switch ($key) {
         case "thumbnail":
             $output = 81;
             break;
         case "medium":
             $output = 768;
             break;
         case "large":
             $output = 6789;
             break;
         case "post-thumbnail":
             $output = 1000;
             break;
         default:
             $output = 10000;
     }
     $this->vfs->getChild(vfsStream::path($file))->truncate($output);
     return array('input' => array('size' => $input), 'output' => array('size' => $output));
 }
Пример #2
0
 public function testPrepareJob()
 {
     $jobs = $this->strategy->getJobs(__DIR__ . DIRECTORY_SEPARATOR . "fixtures" . DIRECTORY_SEPARATOR . "jolici" . DIRECTORY_SEPARATOR . "project1");
     $job = $jobs[0];
     $this->strategy->prepareJob($job);
     $this->assertTrue($this->buildPath->hasChild(vfsStream::path(vfsStream::url('build-path') . DIRECTORY_SEPARATOR . $job->getDirectory())));
     $this->assertTrue($this->buildPath->hasChild(vfsStream::path(vfsStream::url('build-path') . DIRECTORY_SEPARATOR . $job->getDirectory()) . "/Dockerfile"));
     $this->assertTrue($this->buildPath->hasChild(vfsStream::path(vfsStream::url('build-path') . DIRECTORY_SEPARATOR . $job->getDirectory()) . "/foo"));
     $this->assertTrue($this->buildPath->hasChild(vfsStream::path(vfsStream::url('build-path') . DIRECTORY_SEPARATOR . $job->getDirectory()) . "/.jolici"));
     $this->assertTrue($this->buildPath->hasChild(vfsStream::path(vfsStream::url('build-path') . DIRECTORY_SEPARATOR . $job->getDirectory()) . "/.jolici/test"));
     $this->assertTrue($this->buildPath->hasChild(vfsStream::path(vfsStream::url('build-path') . DIRECTORY_SEPARATOR . $job->getDirectory()) . "/.jolici/test/Dockerfile"));
 }
 public function success_compress($file)
 {
     if (preg_match('#[^-]+-([^.]+)[.](png|jpe?g)$#', basename($file), $match)) {
         $key = $match[1];
     } else {
         $key = null;
     }
     $input = filesize($file);
     switch ($key) {
         case 'thumbnail':
             $output = 81;
             $width = '150';
             $height = '150';
             break;
         case 'medium':
             $output = 768;
             $width = '300';
             $height = '300';
             break;
         case 'large':
             $output = 6789;
             $width = '1024';
             $height = '1024';
             break;
         case 'post-thumbnail':
             $output = 1000;
             $width = '800';
             $height = '500';
             break;
         default:
             $output = 10000;
             $width = '4000';
             $height = '3000';
     }
     $this->vfs->getChild(vfsStream::path($file))->truncate($output);
     return array('input' => array('size' => $input), 'output' => array('size' => $output, 'width' => $width, 'height' => $height));
 }