mageekguy\atoum\scripts\tagger\engine::tagChangelog PHP 메소드

tagChangelog() 공개 메소드

public tagChangelog ( )
    public function tagChangelog()
    {
        $changelogPath = $this->srcDirectory . DIRECTORY_SEPARATOR . $this->changelogName;
        if ($this->adapter->file_exists($changelogPath) === true) {
            $changelogContents = @$this->adapter->file_get_contents($changelogPath);
            if ($changelogContents === false) {
                throw new exceptions\runtime('Unable to tag, path \'' . $changelogPath . '\' is not readable');
            }
            if (preg_match($this->versionPattern, $this->version, $matches)) {
                $changelogContents = preg_replace('/^' . preg_quote($this->changelogHeader, '/') . '$/m', '# ' . (isset($matches[1]) ? $matches[1] : $this->version) . ' - ' . $this->adapter->date('Y-m-d'), $changelogContents);
                if ($this->adapter->file_put_contents($changelogPath, $this->changelogHeader . PHP_EOL . PHP_EOL . $changelogContents, \LOCK_EX) === false) {
                    throw new exceptions\runtime('Unable to tag, path \'' . $changelogPath . '\' is not writable');
                }
            }
        }
        return $this;
    }