src/RecipeCommandBehaviour.php
protected function findInstalledVersion($recipe)
    {
        // Check locker
        $installed = $this->getComposer()->getLocker()->getLockedRepository()->findPackage($recipe, '*');
        if ($installed) {
            return $installed->getPrettyVersion();
        }

        // Check provides
        $provides = $this->getComposer()->getPackage()->getProvides();
        if (isset($provides[$recipe])) {
            return $provides[$recipe]->getPrettyConstraint();
        }

        // Check requires
        $requires = $this->getComposer()->getPackage()->getRequires();
        if (isset($requires[$recipe])) {
            return $requires[$recipe]->getPrettyConstraint();
        }

        // No existing version
        return null;
    }
protected function findInstalledVersion($recipe)
    {
        // Check locker
        $installed = $this->getComposer()->getLocker()->getLockedRepository()->findPackage($recipe, '*');
        if ($installed) {
            return $installed->getPrettyVersion();
        }

        // Check provides
        $provides = $this->getComposer()->getPackage()->getProvides();
        if (isset($provides[$recipe])) {
            return $provides[$recipe]->getPrettyConstraint();
        }

        // Check requires
        $requires = $this->getComposer()->getPackage()->getRequires();
        if (isset($requires[$recipe])) {
            return $requires[$recipe]->getPrettyConstraint();
        }

        // No existing version
        return null;
    }
protected function findInstalledVersion ( $ recipe ) { // Check locker $ installed = $ this -> getComposer ( ) -> getLocker ( ) -> getLockedRepository ( ) -> findPackage ( $ recipe , '*' ) ; if ( $ installed ) { return $ installed -> getPrettyVersion ( ) ; } // Check provides $ provides = $ this -> getComposer ( ) -> getPackage ( ) -> getProvides ( ) ; if ( isset ( $ provides [ $ recipe ] ) ) { return $ provides [ $ recipe ] -> getPrettyConstraint ( ) ; } // Check requires $ requires = $ this -> getComposer ( ) -> getPackage ( ) -> getRequires ( ) ; if ( isset ( $ requires [ $ recipe ] ) ) { return $ requires [ $ recipe ] -> getPrettyConstraint ( ) ; } // No existing version return null ; }
Find installed version or constraint

@param string $recipe
@return string
Find installed version or constraint