Call to start asynchronous process.

Make call to MediaInfo::getInfoWaitAsync() afterwards to received MediaInfoContainer object.

@param $filePath
552159
public function getInfoStartAsync($filePath)
    {
        $mediaInfoCommandBuilder = new MediaInfoCommandBuilder();
        $this->mediaInfoCommandRunnerAsync = $mediaInfoCommandBuilder->buildMediaInfoCommandRunner(
            $filePath,
            $this->configuration
        );
        $this->mediaInfoCommandRunnerAsync->start();
    }
708746
public function setFilepath(Path $filepath)
    {
        if ($this->filepath === null) {
            $this->filepath = $filepath;
        } else {
            $this->filepath->append($filepath);
        }
    }
483286
public function optimizeImage($filepath)
    {
        $fileExtension = $this->extensions[mime_content_type($filepath)];

        $transformHandler = config('imageoptimizer.transform_handler');

        if (!isset($transformHandler[$fileExtension])) {
            throw new \Exception('TransformHandler for file extension: "' . $fileExtension . '" was not found');
        }

        $this->get($transformHandler[$fileExtension])->optimize($filepath);
    }
1115557
public static function createFromFilePath ($filePath)
    {
        if (!is_file($filePath))
        {
            throw new \InvalidArgumentException("File does not exist");
        }
        else if (!is_readable($filePath))
        {
            throw new \InvalidArgumentException("File to download is not readable.");
        }

        return new FileDownload(fopen($filePath, "rb"));
    }
1283556
protected function createHandle($filePath)
    {
        try {
            return $this->flysystem->readStream($filePath);
        } catch (FileNotFoundException $e) {
            throw new ResourceNotFoundException($e->getMessage(), 0, $e);
        }
    }
1100047
public static function firstLine($filepath)
    {
        if (file_exists($filepath)) {
            $cacheRes = fopen($filepath, 'rb');
            $firstLine = fgets($cacheRes);
            fclose($cacheRes);

            return $firstLine;
        }

        return null;
    }
829539
public function syncWithTemplate($filePath, $overwrite = FALSE) {
    $sourcePath = $this->getBltRoot() . '/template/' . $filePath;
    $targetPath = $this->getRepoRoot() . '/' . $filePath;

    if ($this->getFileSystem()->exists($sourcePath)) {
      try {
        $this->getFileSystem()->copy($sourcePath, $targetPath, $overwrite);
      }
      catch (IOException $e) {
        throw $e;
      }
    }

  }
137410
public function compressFile (string $filePath) : bool
    {
        $compressor = $this->getCompressor();

        if (null === $compressor)
        {
            return false;
        }

        $process = new Process(\array_merge($compressor, [$filePath]));
        $process->run();
        return $process->isSuccessful();
    }
507868
public function passthrough( $filePath, $startOffset = 0, $length = false )
    {
        return $this->getHandler( $filePath )->passthrough( $filePath, $startOffset, $length );
    }
699583
protected function createHandle($filePath)
    {
        if (!$handle = $this->openHandle($filePath)) {
            throw new ResourceNotFoundException("Path '$filePath' cannot be opened");
        }

        $this->applySettings($handle);

        return $handle;
    }
343519
public static function loadFromFile($filepath)
  {
    $info = Yaml::parseFile($filepath);
    $name = str_replace('.profile.yml', '', pathinfo($filepath, PATHINFO_BASENAME));

    $profile = new static();
    $profile->setTitle($info['title'])
            ->setName($name)
            ->setFilepath($filepath);

    if (isset($info['description'])) {
      $profile->setDescription($info['description']);
    }

    if (isset($info['policies'])) {
      $v21_keys = ['parameters', 'severity'];
      foreach ($info['policies'] as $name => $metadata) {
        // Check for v2.0.x style profiles.
        if (!empty($metadata) && !count(array_intersect($v21_keys, array_keys($metadata)))) {
          throw new \Exception("{$info['title']} is a v2.0.x profile. Please upgrade $filepath to v2.2.x schema.");
        }
        $weight = array_search($name, array_keys($info['policies']));
        $profile->addPolicyDefinition(PolicyDefinition::createFromProfile($name, $weight, $metadata));
      }
    }

    if (isset($info['excluded_policies']) && is_array($info['excluded_policies'])) {
      $profile->addExcludedPolicies($info['excluded_policies']);
    }

    if (isset($info['include'])) {
      foreach ($info['include'] as $name) {
        $include = ProfileSource::loadProfileByName($name);
        $profile->addInclude($include);
      }
    }

    if (isset($info['format'])) {
      foreach ($info['format'] as $format => $options) {
        $profile->addFormatOptions(Format::create($format, $options));
      }
    }

    return $profile;
  }
567923
public function loadHtmlFile($filePath)
    {
        if (!is_string($filePath)) {
            throw new InvalidArgumentException(__METHOD__ . ' expects parameter 1 to be string.');
        }

        if (!preg_match("/^https?:\/\//i", $filePath) && !file_exists($filePath)) {
            throw new RuntimeException("File $filePath not found");
        }

        try {
            $html = file_get_contents($filePath);
        } catch (\Exception $e) {
            throw new RuntimeException("Could not load file $filePath");
        }

        if ($html === false) {
            throw new RuntimeException("Could not load file $filePath");
        }

        $this->loadHtml($html);

        return $this;
    }
242997
public static function unlockFile($filePath)
    {
        global $globals;
        
        if (isset($globals['file_locks'][$filePath]))
        {
            # This creates the file if it doesnt exist.
            fclose($globals['file_locks'][$filePath]);
            unset($globals['file_locks'][$filePath]);
        }
    }
1134373
function(filePath, targetPath, callback) {
            client
                .moveFile(filePath, targetPath)
                .then(function() {
                    __executeCallbackAsync(callback, [null]);
                })
                .catch(callback);
        }
875912
final public function createFile($filePath = null)
    {
        if (isset($filePath)) {
            $this->filePath = $filePath;
        }

        if (pathinfo($this->filePath, PATHINFO_EXTENSION) === '') {
            $this->filePath .= $this->fileExtension;
        }

        return $this;
    }
472544
public function createFileOnDFS( $filePath, $contents )
    {
        $this->accumulatorStart();

        $filePath = $this->makeDFSPath( $filePath );
        $ret = $this->createFile( $filePath, $contents, false );

        $this->accumulatorStop();

        return $ret;
    }
81192
private function _processFile(
        $filePath)
    {
        $hasProblems = false;
        $hasVisibilityProblems = false;
        $fileName = basename($filePath);
        $inputLines = @file($filePath);
        $outputLines = [];

        if ($inputLines === false) {
            // We were unable to read the input file. Ignore if broken symlink.
            if (is_link($filePath)) {
                return false; // File is okay, since the symlink is invalid.
            } else {
                echo "- {$filePath}: UNABLE TO READ FILE!".PHP_EOL;

                return true; // File has problems...
            }
        }

        foreach ($inputLines as $line) {
            // Function arguments on separate lines.
            if (preg_match('/^(.*?(?:(?:final|static)\s+)*(?:public|private|protected)(?:\s+(?:final|static))*\s+function\s+.+?)\((.+)\)(.*)$/', $line, $matches)) {
                $hasProblems = true;

                $funcstart = $matches[1];
                $params = $matches[2];
                $trail = $matches[3];
                $params = explode(', ', $params);

                $outputLines[] = $funcstart.'('.PHP_EOL;
                for ($i = 0, $len = count($params); $i < $len; ++$i) {
                    $newline = '        '.$params[$i];
                    if ($i == ($len - 1)) {
                        $newline .= ')'.PHP_EOL;
                    } else {
                        $newline .= ','.PHP_EOL;
                    }
                    $outputLines[] = $newline;
                }
                // } else {
                //     $outputLines[] = $line;
            }

            // Appropriate public, private and protected member prefixes.
            if (preg_match('/^\s*(?:(?:final|static)\s+)*(public|private|protected)(?:\s+(?:final|static))*\s+(function|\$)\s*&?([^;\(\s]+)/', $line, $matches)) {
                $visibility = &$matches[1]; // public, private, protected
                $type = &$matches[2]; // $, function
                $name = &$matches[3]; // Member name

                if ($visibility == 'public') {
                    if ($name[0] == '_' && (
                        $name != '__construct'
                        && $name != '__destruct'
                        && $name != '__call'
                        && $name != '__get'
                        && $name != '__set'
                        && $name != '__isset'
                        && $name != '__unset'
                        && $name != '__invoke'
                        && $name != '__toString'
                    )) {
                        $hasProblems = true;
                        $hasVisibilityProblems = true;
                        echo "- {$filePath}: BAD PUBLIC NAME:".trim($matches[0]).PHP_EOL;
                    }
                } else { // private, protected
                    if ($name[0] != '_') {
                        $hasProblems = true;
                        $hasVisibilityProblems = true;
                        echo "- {$filePath}: BAD PRIVATE/PROTECTED NAME:".trim($matches[0]).PHP_EOL;
                    }
                }
            }
        }

        $newFile = implode('', $outputLines);
        if (!$hasProblems) {
            if (!$this->_onlyShowInvalidFiles) {
                echo "  {$filePath}: Already formatted correctly.\n";
            }
        } elseif (!$hasVisibilityProblems) {
            // Has problems, but no visibility problems. Output fixed file.
            echo "- {$filePath}: Has function parameter problems:\n";
            echo $newFile;
        } else {
            echo "- {$filePath}: Had member visibility problems.\n";
        }

        return $hasProblems;
    }