src/PatchCollector.php
protected function extractPatchData(PackageInterface $package, $patchData)
    {
        $levels = null;
        if (is_string($patchData)) {
            $path = $patchData;
        } else {
            if (!is_array($patchData) || !isset($patchData['path']) || is_string($patchData['path'])) {
                throw new Exception\InvalidPackageConfigurationValue($package, 'extra.patches.[...]', $package, "The value of a patch must be a string or an array with a 'path' node value.");
            }
            $path = $patchData['path'];
            if (isset($patchData['levels'])) {
                $levels = $patchData['levels'];
                if (!is_array($levels) || empty($levels)) {
                    throw new Exception\InvalidPackageConfigurationValue($package, 'extra.patches.[...].levels', $package, 'The patch levels must be an array of strings.');
                }
            }
        }
        if ($levels === null) {
            $levels = $this->getDefaultPatchLevels();
        }

        return array($path, $levels);
    }
protected function extractPatchData(PackageInterface $package, $patchData)
    {
        $levels = null;
        if (is_string($patchData)) {
            $path = $patchData;
        } else {
            if (!is_array($patchData) || !isset($patchData['path']) || is_string($patchData['path'])) {
                throw new Exception\InvalidPackageConfigurationValue($package, 'extra.patches.[...]', $package, "The value of a patch must be a string or an array with a 'path' node value.");
            }
            $path = $patchData['path'];
            if (isset($patchData['levels'])) {
                $levels = $patchData['levels'];
                if (!is_array($levels) || empty($levels)) {
                    throw new Exception\InvalidPackageConfigurationValue($package, 'extra.patches.[...].levels', $package, 'The patch levels must be an array of strings.');
                }
            }
        }
        if ($levels === null) {
            $levels = $this->getDefaultPatchLevels();
        }

        return array($path, $levels);
    }
protected function extractPatchData ( PackageInterface $ package , $ patchData ) { $ levels = null ; if ( is_string ( $ patchData ) ) { $ path = $ patchData ; } else { if ( ! is_array ( $ patchData ) || ! isset ( $ patchData [ 'path' ] ) || is_string ( $ patchData [ 'path' ] ) ) { throw new Exception \ InvalidPackageConfigurationValue ( $ package , 'extra.patches.[...]' , $ package , "The value of a patch must be a string or an array with a 'path' node value." ) ; } $ path = $ patchData [ 'path' ] ; if ( isset ( $ patchData [ 'levels' ] ) ) { $ levels = $ patchData [ 'levels' ] ; if ( ! is_array ( $ levels ) || empty ( $ levels ) ) { throw new Exception \ InvalidPackageConfigurationValue ( $ package , 'extra.patches.[...].levels' , $ package , 'The patch levels must be an array of strings.' ) ; } } } if ( $ levels === null ) { $ levels = $ this -> getDefaultPatchLevels ( ) ; } return array ( $ path , $ levels ) ; }
Extract the data of a single patch.

@param \Composer\Package\PackageInterface $package the package being inspected
@param array|string|mixed $patchData The single patch data

@throws \Exception in case of errors

@return array
Extract the data of a single patch .