/** * Filter skipped code blocks * * @param string $content * @param string|null $file * @return bool */ public function filter($content, $file = null) { /** * Set original content for finding right line numbers * * @todo Remove hack for saving original content */ LineFinder::setOriginContent($content); return $content; }
/** * {@inheritdoc} */ public function filter($content, $file = null) { try { if (!$this->isLicenseRequired($file)) { return $content; } $newContent = $this->generateLicense($content, $file); } catch (License\Exception $e) { throw new Exception($e->getMessage() . " ({$file})", 0, $e); } if (!$newContent) { return $content; } //update original content $newOriginalContent = $this->generateLicense(LineFinder::getOriginContent(), $file); LineFinder::setOriginContent($newOriginalContent); $this->writeContent($this->getFileAbsolutePath($file), $newOriginalContent); $this->addFileToVcs($file); return $newContent; }
/** * Find lines for a string * * @param string $find * @param string $content * @param bool $once * @return array|int */ protected function findLines($find, $content, $once = false) { return LineFinder::findLines($find, $content, $once); }