예제 #1
0
 /**
  * Get XPath
  *
  * @param string $name
  * @return string
  */
 protected function getXpath($name)
 {
     $helper = new License();
     if ($this->shouldWriteValue()) {
         return $helper->getPathsXpath($this->getKey()) . '/' . $this->getHelperSet()->get('commithook_config_file')->path2XmlNode($this->getValue());
     }
     return $helper->getPathsXpath($this->getKey());
 }
예제 #2
0
 /**
  * Validate content
  *
  * @param string $content
  * @param string $file
  * @return bool
  */
 public function validate($content, $file)
 {
     $helper = new LicenseHelper();
     if (!$helper->isLicenseRequired($file)) {
         return true;
     }
     if (!$helper->contentHasLicense($content)) {
         $this->addError($file, self::CODE_MISSED_LICENSE);
     }
     return !$this->errorCollector->hasErrors();
 }