public static function fromPackageFile($composerJson)
    {
        if (file_exists($composerJson) === false) {
            throw new ComposerJsonNotFoundException("File {$composerJson} not found.");
        }

        $config = Config::load($composerJson);
        $autoload = $config->get('autoload.psr-4');

        $composerJsonDirectory = dirname($composerJson);

        $keys = array_keys($autoload);
        $namespace = array_shift($keys);

        $values = array_values($autoload);
        $namespaceDirectory = array_shift($values);
        $namespaceDirectory = realpath($composerJsonDirectory . '/' . $namespaceDirectory);

        return new self($namespace, $namespaceDirectory);
    }
public static function fromPackageFile($composerJson)
    {
        if (file_exists($composerJson) === false) {
            throw new ComposerJsonNotFoundException("File {$composerJson} not found.");
        }

        $config = Config::load($composerJson);
        $autoload = $config->get('autoload.psr-4');

        $composerJsonDirectory = dirname($composerJson);

        $keys = array_keys($autoload);
        $namespace = array_shift($keys);

        $values = array_values($autoload);
        $namespaceDirectory = array_shift($values);
        $namespaceDirectory = realpath($composerJsonDirectory . '/' . $namespaceDirectory);

        return new self($namespace, $namespaceDirectory);
    }
public static function fromPackageFile ( $ composerJson ) { if ( file_exists ( $ composerJson ) === false ) { throw new ComposerJsonNotFoundException ( "File {$composerJson} not found." ) ; } $ config = Config :: load ( $ composerJson ) ; $ autoload = $ config -> get ( 'autoload.psr-4' ) ; $ composerJsonDirectory = dirname ( $ composerJson ) ; $ keys = array_keys ( $ autoload ) ; $ namespace = array_shift ( $ keys ) ; $ values = array_values ( $ autoload ) ; $ namespaceDirectory = array_shift ( $ values ) ; $ namespaceDirectory = realpath ( $ composerJsonDirectory . '/' . $ namespaceDirectory ) ; return new self ( $ namespace , $ namespaceDirectory ) ; }
Create a new matcher package from composer.json

@param string $composerJson composer.json path

@throws \expect\package\ComposerJsonNotFoundException
Create a new matcher package from composer . json