src/Composer/Package/Locker.php
public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable, $preferLowest, array $platformOverrides)
    {
        $lock = array(
            '_readme' => array('This file locks the dependencies of your project to a known state',
                               'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file',
                               'This file is @gener'.'ated automatically'),
            'hash' => $this->hash,
            'packages' => null,
            'packages-dev' => null,
            'aliases' => array(),
            'minimum-stability' => $minimumStability,
            'stability-flags' => $stabilityFlags,
            'prefer-stable' => $preferStable,
            'prefer-lowest' => $preferLowest,
        );

        foreach ($aliases as $package => $versions) {
            foreach ($versions as $version => $alias) {
                $lock['aliases'][] = array(
                    'alias' => $alias['alias'],
                    'alias_normalized' => $alias['alias_normalized'],
                    'version' => $version,
                    'package' => $package,
                );
            }
        }

        $lock['packages'] = $this->lockPackages($packages);
        if (null !== $devPackages) {
            $lock['packages-dev'] = $this->lockPackages($devPackages);
        }

        $lock['platform'] = $platformReqs;
        $lock['platform-dev'] = $platformDevReqs;
        if ($platformOverrides) {
            $lock['platform-overrides'] = $platformOverrides;
        }

        if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) {
            if ($this->lockFile->exists()) {
                unlink($this->lockFile->getPath());
            }

            return false;
        }

        if (!$this->isLocked() || $lock !== $this->getLockData()) {
            $this->lockFile->write($lock);
            $this->lockDataCache = null;

            return true;
        }

        return false;
    }
public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable, $preferLowest, array $platformOverrides)
    {
        $lock = array(
            '_readme' => array('This file locks the dependencies of your project to a known state',
                               'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file',
                               'This file is @gener'.'ated automatically'),
            'hash' => $this->hash,
            'packages' => null,
            'packages-dev' => null,
            'aliases' => array(),
            'minimum-stability' => $minimumStability,
            'stability-flags' => $stabilityFlags,
            'prefer-stable' => $preferStable,
            'prefer-lowest' => $preferLowest,
        );

        foreach ($aliases as $package => $versions) {
            foreach ($versions as $version => $alias) {
                $lock['aliases'][] = array(
                    'alias' => $alias['alias'],
                    'alias_normalized' => $alias['alias_normalized'],
                    'version' => $version,
                    'package' => $package,
                );
            }
        }

        $lock['packages'] = $this->lockPackages($packages);
        if (null !== $devPackages) {
            $lock['packages-dev'] = $this->lockPackages($devPackages);
        }

        $lock['platform'] = $platformReqs;
        $lock['platform-dev'] = $platformDevReqs;
        if ($platformOverrides) {
            $lock['platform-overrides'] = $platformOverrides;
        }

        if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) {
            if ($this->lockFile->exists()) {
                unlink($this->lockFile->getPath());
            }

            return false;
        }

        if (!$this->isLocked() || $lock !== $this->getLockData()) {
            $this->lockFile->write($lock);
            $this->lockDataCache = null;

            return true;
        }

        return false;
    }
public function setLockData ( array $ packages , $ devPackages , array $ platformReqs , $ platformDevReqs , array $ aliases , $ minimumStability , array $ stabilityFlags , $ preferStable , $ preferLowest , array $ platformOverrides ) { $ lock = array ( '_readme' => array ( 'This file locks the dependencies of your project to a known state' , 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file' , 'This file is @gener' . 'ated automatically' ) , 'hash' => $ this -> hash , 'packages' => null , 'packages-dev' => null , 'aliases' => array ( ) , 'minimum-stability' => $ minimumStability , 'stability-flags' => $ stabilityFlags , 'prefer-stable' => $ preferStable , 'prefer-lowest' => $ preferLowest , ) ; foreach ( $ aliases as $ package => $ versions ) { foreach ( $ versions as $ version => $ alias ) { $ lock [ 'aliases' ] [ ] = array ( 'alias' => $ alias [ 'alias' ] , 'alias_normalized' => $ alias [ 'alias_normalized' ] , 'version' => $ version , 'package' => $ package , ) ; } } $ lock [ 'packages' ] = $ this -> lockPackages ( $ packages ) ; if ( null !== $ devPackages ) { $ lock [ 'packages-dev' ] = $ this -> lockPackages ( $ devPackages ) ; } $ lock [ 'platform' ] = $ platformReqs ; $ lock [ 'platform-dev' ] = $ platformDevReqs ; if ( $ platformOverrides ) { $ lock [ 'platform-overrides' ] = $ platformOverrides ; } if ( empty ( $ lock [ 'packages' ] ) && empty ( $ lock [ 'packages-dev' ] ) && empty ( $ lock [ 'platform' ] ) && empty ( $ lock [ 'platform-dev' ] ) ) { if ( $ this -> lockFile -> exists ( ) ) { unlink ( $ this -> lockFile -> getPath ( ) ) ; } return false ; } if ( ! $ this -> isLocked ( ) || $ lock !== $ this -> getLockData ( ) ) { $ this -> lockFile -> write ( $ lock ) ; $ this -> lockDataCache = null ; return true ; } return false ; }
Locks provided data into lockfile.

@param array  $packages          array of packages
@param mixed  $devPackages       array of dev packages or null if installed without --dev
@param array  $platformReqs      array of package name => constraint for required platform packages
@param mixed  $platformDevReqs   array of package name => constraint for dev-required platform packages
@param array  $aliases           array of aliases
@param string $minimumStability
@param array  $stabilityFlags
@param bool   $preferStable
@param bool   $preferLowest
@param array  $platformOverrides

@return bool
Locks provided data into lockfile .