コード例 #1
0
ファイル: OriginContent.php プロジェクト: andkirby/commithook
 /**
  * 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;
 }
コード例 #2
0
ファイル: License.php プロジェクト: andkirby/commithook
 /**
  * {@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;
 }
コード例 #3
0
ファイル: PhpDoc.php プロジェクト: andkirby/commithook
 /**
  * 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);
 }