/**
  * License tag must be 'http://matrix.squiz.net/licence Squiz.Net Open Source Licence'.
  *
  * @param int $errorPos The line number where the error occurs.
  *
  * @return void
  */
 protected function processLicense($errorPos)
 {
     $license = $this->commentParser->getLicense();
     if ($license !== null) {
         $url = $license->getValue();
         $content = $license->getComment();
         if (empty($url) === true && empty($content) === true) {
             $error = 'Content missing for @license tag in file comment';
             $this->currentFile->addError($error, $errorPos, 'MissingLicense');
         } else {
             // Check for license URL.
             if (empty($url) === true) {
                 $error = 'License URL missing for @license tag in file comment';
                 $this->currentFile->addError($error, $errorPos, 'MissingLicenseURL');
             } else {
                 if ($url !== 'http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt') {
                     $error = 'Expected "http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt" for license URL';
                     $this->currentFile->addError($error, $errorPos, 'IncorrectLicenseURL');
                 }
             }
             // Check for license name.
             if (empty($content) === true) {
                 $error = 'License name missing for @license tag in file comment';
                 $this->currentFile->addError($error, $errorPos, 'MissingLicenseName');
             } else {
                 if ($content !== 'GPLv2') {
                     $error = 'Expected "GPLv2" for license name';
                     $this->currentFile->addError($error, $errorPos, 'IncorrectLicenseName');
                 }
             }
         }
         //end if
     }
     //end if
 }
Пример #2
0
 /**
  * License tag must be 'http://matrix.squiz.net/licence Squiz.Net Open Source Licence'.
  *
  * @param int $errorPos The line number where the error occurs.
  *
  * @return void
  */
 protected function processLicense($errorPos)
 {
     $license = $this->commentParser->getLicense();
     if ($license !== null) {
         $url = $license->getValue();
         $content = $license->getComment();
         if (empty($url) === true && empty($content) === true) {
             $error = 'Content missing for @license tag in file comment';
             $this->currentFile->addError($error, $errorPos);
         } else {
             // Check for license URL.
             if (empty($url) === true) {
                 $error = 'License URL missing for @license tag in file comment';
                 $this->currentFile->addError($error, $errorPos);
             } else {
                 if ($url !== 'http://matrix.squiz.net/licence') {
                     $error = 'Expected "http://matrix.squiz.net/licence" for license URL';
                     $this->currentFile->addError($error, $errorPos);
                 }
             }
             // Check for license name.
             if (empty($content) === true) {
                 $error = 'License name missing for @license tag in file comment';
                 $this->currentFile->addError($error, $errorPos);
             } else {
                 if ($content !== 'Squiz.Net Open Source Licence') {
                     $error = 'Expected "Squiz.Net Open Source Licence" for license name';
                     $this->currentFile->addError($error, $errorPos);
                 }
             }
         }
         //end if
     }
     //end if
 }
Пример #3
0
 /**
  * License tag must be 'http://matrix.squiz.net/licence Hotelsnl.Net Open Source Licence'.
  *
  * @param int $errorPos The line number where the error occurs.
  *
  * @return void
  */
 protected function processLicense($errorPos)
 {
     $license = $this->commentParser->getLicense();
     if ($license !== null) {
         $url = $license->getValue();
         $content = $license->getComment();
         if (empty($url) === true && empty($content) === true) {
             $error = 'Content missing for @license tag in file comment';
             $this->currentFile->addError($error, $errorPos, 'MissingLicense');
         } else {
             // Check for license URL.
             if (empty($url) === true) {
                 $error = 'License URL missing for @license tag in file comment';
                 $this->currentFile->addError($error, $errorPos, 'MissingLinceseURL');
             } else {
                 if ($url !== 'http://www.hotels.nl/') {
                     $error = 'Expected "http://www.hotels.nl/" for license URL';
                     $this->currentFile->addError($error, $errorPos, 'IncorrectLicenseURL');
                 }
             }
         }
         //end if
     }
     //end if
 }
Пример #4
0
 protected function processLicense($errorPos)
 {
     $license = $this->commentParser->getLicense();
     $error = null;
     if ($license !== null) {
         $value = $license->getValue();
         $comment = $license->getComment();
         $content = $value . ' ' . $comment;
         if (empty($content)) {
             $error = "Content missing for @license tag in " . $this->docBlock . " comment";
             $this->currentFile->addError($this->getReqPrefix($this->reqCodeEmpty) . ' ' . $error, $errorPos);
         } else {
             preg_match('/^.*\\/(CDev\\/[^\\/]+)\\/.*$/', $this->currentFile->getFilename(), $match);
             $module = isset($match[1]) ? $match[1] : null;
             if (in_array($module, $this->modulesLCL)) {
                 $error = $content != 'LiteCommerce Module License (Commercial EULA)' ? 'Content of the @license tag for module "' . $module . '" must be in the form "LiteCommerce Module License (Commercial EULA)"' : null;
             } elseif (in_array($module, $this->modulesGPL)) {
                 $error = $content != 'http://www.gnu.org/licenses/gpl-2.0.html GNU General Pubic License (GPL 2.0)' ? 'Content of the @license tag for module "' . $module . '" must be in the form "http://www.gnu.org/licenses/gpl-2.0.html GNU General Pubic License (GPL 2.0)"' : null;
             } elseif ($content != 'http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)') {
                 $error = 'Content of the @license tag must be in the form "http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)"';
             }
             if ($error) {
                 $this->currentFile->addError($this->getReqPrefix($this->getReqCode($this->reqCodesWrongFormat, 'license')) . $error, $errorPos);
             }
         }
     }
 }
Пример #5
0
 /**
  * Process the license tag.
  *
  * @param int $errorPos The line number where the error occurs.
  *
  * @return void
  */
 protected function processLicense($errorPos)
 {
     $license = $this->commentParser->getLicense();
     if ($license !== null) {
         $value = $license->getValue();
         $comment = $license->getComment();
         if ($value === '' || $comment === '') {
             $error = '@license tag must contain a URL and a license name';
             $this->currentFile->addError($error, $errorPos);
         }
     }
 }
Пример #6
0
 /**
  * Process the license tag
  *
  * @param  integer $errorPos The line number where the error occurs
  * @return void
  */
 protected function _processLicense($errorPos)
 {
     $license = $this->_commentParser->getLicense();
     if ($license !== null) {
         $value = $license->getValue();
         $comment = $license->getComment();
         if ($value !== 'http://framework.zend.com/license/new-bsd' and $comment !== 'New BSD License') {
             $error = "@license tag 'http://framework.zend.com/license/new-bsd     New BSD License' expected '{$comment}' found";
             $this->_currentFile->addError($error, $errorPos, 'LicenceTagFileComment');
         }
     }
 }
Пример #7
0
 /**
  * Process the license tag.
  *
  * @param int $errorpos The line number where the error occurs.
  *
  * @return void
  */
 protected function processlicense($errorpos)
 {
     $license = $this->commentparser->getLicense();
     if ($license !== null) {
         $value = $license->getValue();
         $comment = $license->getComment();
         if ($value === '' || $comment === '') {
             $error = '@license tag must contain a URL and a license name';
             $this->currentfile->adderror($error, $errorpos);
         }
         if ($comment != 'GNU GPL v3 or later') {
             $this->currentfile->adderror('License must be "GNU GPL v3 or later", found "' . $comment . '"', $errorpos);
         }
         if ($value != 'http://www.gnu.org/copyleft/gpl.html') {
             $this->currentfile->adderror('License must be "GNU GPL v3 or later"', $errorpos);
         }
     }
 }
Пример #8
0
 /**
  * Copyright tag must be in the form "2009-xxxx Vanilla Forums Inc.".
  *
  * @param int $errorPos The line number where the error occurs.
  *
  * @return void
  */
 protected function processCopyrights($errorPos)
 {
     $copyrights = $this->commentParser->getCopyrights();
     if (count($copyrights) > 1) {
         $vanillaFound = false;
         foreach ($copyrights as $copyright) {
             $content = $copyright->getContent();
             if (empty($content) === true) {
                 $error = 'Content missing for @copyright tag in file comment';
                 $this->currentFile->addError($error, $errorPos, 'MissingCopyright');
             }
             date_default_timezone_set('UTC');
             preg_match('/^2009\\-(\\d{4}) Vanilla Forums Inc./', $content, $matches);
             if (!empty($matches) && $matches[1] == date('Y', time())) {
                 $vanillaFound = true;
             }
         }
         if (!$vanillaFound) {
             $error = 'Expected "2009-' . date('Y') . ' Vanilla Forums Inc." for copyright declaration';
             $this->currentFile->addError($error, $errorPos, 'IncorrectCopyright');
         }
     } elseif ($copyrights[0] !== null) {
         $copyright = $copyrights[0];
         $license = $this->commentParser->getLicense();
         if ($license === null) {
             $error = 'Content missing for @license tag in file comment';
             $this->currentFile->addError($error, $errorPos, 'MissingLicense');
         }
         $content = $copyright->getContent();
         if (empty($content) === true) {
             $error = 'Content missing for @copyright tag in file comment';
             $this->currentFile->addError($error, $errorPos, 'MissingCopyright');
         }
         date_default_timezone_set('UTC');
         preg_match('/^2009\\-(\\d{4}) Vanilla Forums Inc.$/', $content, $matches);
         if (empty($matches) || $matches[1] != date('Y', time())) {
             $error = 'Expected "2009-' . date('Y') . ' Vanilla Forums Inc." for copyright declaration';
             $this->currentFile->addError($error, $errorPos, 'IncorrectCopyright');
         }
     }
 }