private function DoIncludeInResult($valueToCheck, $algorithmFilter)
 {
     foreach ($algorithmFilter as $filter) {
         if (strcmp($valueToCheck, $filter) === 0) {
             return false;
         }
         if (\Puzzlout\Framework\Helpers\RegexHelper::Init($valueToCheck)->IsMatch('`' . $filter . '`')) {
             return false;
         }
     }
     return true;
 }
 /**
  * Write the constants of the class to the output file.
  * 
  * @param string $valueToTrim the string value to remove from each value in
  * $this->data array.
  */
 public function WriteConstants($valueToTrim = ".php")
 {
     $extractor = \Puzzlout\Framework\Helpers\ArrayExtractionHelper::Init()->ExtractDistinctValues($this->data);
     $output = "";
     foreach ($extractor->List as $constant) {
         if (\Puzzlout\Framework\Helpers\RegexHelper::Init($constant)->IsAPhpFilename()) {
             $output .= $this->WriteConstant($this->BuildConstantKeyValue($constant, $valueToTrim));
         } else {
             $output .= $this->WriteConstant($this->BuildConstantForFolderValue($constant));
         }
     }
     $output .= PhpCodeSnippets::LF;
     fwrite($this->writer, $output);
 }
Пример #3
0
 public function Simple($linkUrl, $linkText)
 {
     if (is_null($linkUrl) || empty($linkUrl)) {
         throw new \InvalidArgumentException('$linkUrl must be provided.', 0, null);
     }
     if (is_null($linkText) || empty($linkText)) {
         throw new \InvalidArgumentException('$linkText must be provided.', 0, null);
     }
     if (!\Puzzlout\Framework\Helpers\RegexHelper::Init($linkUrl)->IsMatch("`\\b(?:(?:https?|ftp):\\/\\/|www\\.)[-a-z0-9\\/%?=~_|!:,.;]*[-a-z0-9+&@#\\/%=~_|]`")) {
         throw new \InvalidArgumentException('$linkUrl ' . $linkUrl . ' is not valid.', 0, null);
     }
     array_push($this->Attributes, HtmlAttribute::Instanciate(HtmlAttributeConstants::Href, $linkUrl));
     array_push($this->Attributes, HtmlAttribute::Instanciate(LinkAttributeConstants::Target, "_BLANK"));
     $this->HtmlOutput = '<a {0} {1}>' . $linkText . '</a>';
     HtmlControlBuildHelper::Init()->GenerateAttributes($this);
     return $this->HtmlOutput;
 }
 public function RecursiveScanOf($directory, $algorithmFilter)
 {
     $scanResult = scandir($directory);
     foreach ($scanResult as $key => $value) {
         $includeKeyInResult = \Puzzlout\Framework\Helpers\RegexHelper::Init($key)->IsMatch($algorithmFilter);
         $includeValueInResult = \Puzzlout\Framework\Helpers\RegexHelper::Init($value)->IsMatch($algorithmFilter);
         $isValueADirectory = is_dir($directory . \Puzzlout\Framework\Core\DirectoryManager::DIRECTORY_SEPARATOR . $value);
         if (!$includeKeyInResult && !$includeValueInResult) {
             continue;
         }
         if ($isValueADirectory) {
             array_push($this->DirectoryList, $directory . $value . \Puzzlout\Framework\Core\DirectoryManager::DIRECTORY_SEPARATOR);
             $this->RecursiveScanOf($directory . $value . \Puzzlout\Framework\Core\DirectoryManager::DIRECTORY_SEPARATOR, $algorithmFilter);
         }
     }
     return $this->DirectoryList;
 }
Пример #5
0
 public static function Init($valueToTest)
 {
     $regex = new RegexHelper();
     $regex->setValueToTest($valueToTest);
     return $regex;
 }
 private function testIfTestClassIsLocked($testClassContents)
 {
     $result = is_string($testClassContents) && RegexHelper::Init($testClassContents)->IsMatch(CommonRegexes::CONTAINS_LOCKED_FLAG);
     return $result;
 }
 /**
  * Write the constants of the class to the output file.
  * 
  * @param string $valueToTrim the string value to remove from each value in
  * $this->data array.
  */
 public function WriteConstants($valueToTrim = ".php")
 {
     $extrator = \Puzzlout\Framework\Helpers\ArrayExtractionHelper::Init()->ExtractDistinctValues($this->data);
     $output = "";
     foreach ($extrator->List as $constant) {
         if (\Puzzlout\Framework\Helpers\RegexHelper::Init($constant)->IsResoureKeyValid()) {
             $output .= $this->WriteConstant($constant);
         }
     }
     $output .= PhpCodeSnippets::LF;
     fwrite($this->writer, $output);
 }
 /**
  * Test to the path against the filter.
  * 
  * @param string $path The folder path
  * @param string $regexFilter The regex to test the path 
  */
 public function IsFolderMatchingFilter($path, $regexFilter)
 {
     return \Puzzlout\Framework\Helpers\RegexHelper::Init($path)->IsMatch($regexFilter);
 }