Exemplo n.º 1
0
 public function requestCacheStore($module, $componentName)
 {
     if (!strlen($componentName) || !IoUtils::hasStrictSpecialChars($componentName)) {
         throw new \InvalidArgumentException('Component name is empty or contains strict special chars: ' . $componentName);
     }
     return new FileCacheStore($this->varStore->requestDirFsPath(VarStore::CATEGORY_TMP, $module, $componentName), $this->dirPerm, $this->filePerm);
 }
Exemplo n.º 2
0
 public function getNoIoStrictSpecialCharsString(string $attributeName, bool $mandatory, $defaultValue = null)
 {
     $def = $this->findAttributesDef($attributeName, $mandatory);
     if ($def === null) {
         return $defaultValue;
     }
     $str = null;
     try {
         $str = $def->getAttributes()->getString($attributeName);
     } catch (AttributesException $e) {
         throw $this->createInvalidAttributeException($attributeName, $def, $e);
     }
     if (IoUtils::hasStrictSpecialChars($str)) {
         throw $this->createInvalidAttributeException($attributeName, $def, new InvalidAttributeException('String must not contain any special chars.'));
     }
     return $defaultValue;
 }