dev/src/ComponentVersionTrait.php
private function updateComponentVersionConstant($version, $componentPath, $componentEntry)
    {
        if (is_null($componentEntry)) {
            return false;
        }

        $path = $this->rootPath() .'/'. $componentPath .'/'. $componentEntry;
        if (!file_exists($path)) {
            throw new \RuntimeException(sprintf(
                'Component entry file %s does not exist',
                $path
            ));
        }

        $entry = file_get_contents($path);

        $replacement = sprintf("const VERSION = '%s';", $version);

        $entry = preg_replace("/const VERSION = [\'\\\"]([0-9.]{0,}|master)[\'\\\"]\;/", $replacement, $entry);

        $result = file_put_contents($path, $entry);

        if (!$result) {
            throw new \RuntimeException('File write failed');
        }

        return true;
    }
private function updateComponentVersionConstant($version, $componentPath, $componentEntry)
    {
        if (is_null($componentEntry)) {
            return false;
        }

        $path = $this->rootPath() .'/'. $componentPath .'/'. $componentEntry;
        if (!file_exists($path)) {
            throw new \RuntimeException(sprintf(
                'Component entry file %s does not exist',
                $path
            ));
        }

        $entry = file_get_contents($path);

        $replacement = sprintf("const VERSION = '%s';", $version);

        $entry = preg_replace("/const VERSION = [\'\\\"]([0-9.]{0,}|master)[\'\\\"]\;/", $replacement, $entry);

        $result = file_put_contents($path, $entry);

        if (!$result) {
            throw new \RuntimeException('File write failed');
        }

        return true;
    }
private function updateComponentVersionConstant ( $ version , $ componentPath , $ componentEntry ) { if ( is_null ( $ componentEntry ) ) { return false ; } $ path = $ this -> rootPath ( ) . '/' . $ componentPath . '/' . $ componentEntry ; if ( ! file_exists ( $ path ) ) { throw new \ RuntimeException ( sprintf ( 'Component entry file %s does not exist' , $ path ) ) ; } $ entry = file_get_contents ( $ path ) ; $ replacement = sprintf ( "const VERSION = '%s';" , $ version ) ; $ entry = preg_replace ( "/const VERSION = [\'\\\"]([0-9.]{0,}|master)[\'\\\"]\;/" , $ replacement , $ entry ) ; $ result = file_put_contents ( $ path , $ entry ) ; if ( ! $ result ) { throw new \ RuntimeException ( 'File write failed' ) ; } return true ; }
Update the VERSION constant in a veneer entry file.

@param string $version The new version. (do not prefix with `v`).
@param string $componentPath The path to the component, relative to the root of the project.
@param string $componentEntry The name of the entry file to modify (i.e. FooClient.php).
@return bool
Update the VERSION constant in a veneer entry file .