/** * Sets the title of this content * @param string $title * @return null * @throws zibo\ZiboException when the title is empty */ private function setTitle($title) { if (String::isEmpty($title)) { throw new ZiboException('Provided title is empty'); } $this->title = $title; }
/** * Sets the format string * @param string $format * @return null * @throws zibo\ZiboException when the provided format is empty or not a string */ protected function setFormat($format) { if (String::isEmpty($format)) { throw new ZiboException('Provided format is empty'); } $this->format = $format; }
public function setTitle($title) { if (!$title instanceof Exception && String::isEmpty($title)) { throw new ZiboException('Empty title provided'); } $this->title = $title; }
/** * Sets the name of the queue * @param string $name The name of the queue * @return null */ protected function setName($name) { if (String::isEmpty($name)) { throw new ZiboException('Could not set the name of the queue worker: provided name is empty'); } $this->name = $name; }
/** * Set the name of the validator * @param string $name * @return null * @throws zibo\ZiboException when $name is not a string * @throws zibo\library\orm\exception\ModelException when $name is empty */ private function setName($name) { if (String::isEmpty($name)) { throw new OrmException('Name is empty'); } $this->name = $name; }
/** * Sets the order statement string for the relation * @param string $order * @return null */ public function setRelationOrder($order) { if ($order !== null && String::isEmpty($order)) { throw new OrmException('Provided order statement is empty'); } $this->relationOrder = $order; }
/** * Sets the name of the namespace * @param string $name * @return null * @throws zibo\ZiboException when the provided name is empty or invalid */ private function setName($name) { if (String::isEmpty($name)) { throw new ZiboException('Provided name is empty'); } $this->name = $name; }
/** * Register an ImageIO to this factory * @param string extension extension of the images the IO will handle * @param ImageIO ImageIO for this extension */ public function register($extension, ImageIO $io) { if (String::isEmpty($extension)) { throw new ImageException('extension is empty'); } $this->io[$extension] = $io; }
/** * Sets the label for this field * @param string $label Translation key for the name of this field * @return null */ public function setLabel($label) { if ($label !== null && String::isEmpty($label)) { throw new OrmException('Provided label is empty'); } $this->label = $label; }
/** * Sets the change key * @param string $changeKey * @return null * @throws InvalidArgumentException when the changeKey is empty */ public function setChangeKey($changeKey) { if ($changeKey !== null && String::isEmpty($changeKey)) { throw new InvalidArgumentException('Provided change key is empty'); } $this->ChangeKey = $changeKey; }
public function addAllowedName($name) { if (String::isEmpty($name)) { throw new ZiboException('Provided name is empty'); } $this->names[] = $name; }
/** * Sets the URL to the export * @param string $url * @return null * @throws zibo\ZiboException when the provided URL is empty or invalid */ public function setExportUrl($url) { if (String::isEmpty($url)) { throw new ZiboException('Provided export URL is empty or invalid'); } $this->exportUrl = $url; }
/** * Gets whether this register has a model by the provided name * @param string $modelName Name of the model * @return boolean True if the register has the provided model registered, false otherwise * @throws zibo\library\orm\exception\OrmException when the provided model name is empty */ public function hasModel($modelName) { if (String::isEmpty($modelName)) { throw new OrmException('Provided modelname is empty'); } return array_key_exists($modelName, $this->models); }
/** * Registers a service to this server instance * @param string $name The name of the service * @param string|array|zibo\library\Callback $callback The callback with the logic of the service * @param string $returnType The type of the resulting value * @param array $parameterTypes The types of parameters for this service * @param string $description A description of this service * @return null * @throws zibo\library\xmlrpc\exception\XmlRpcException when the name of the service is empty * @throws zibo\library\xmlrpc\exception\XmlRpcException when the name of the service is already used by another service * @throws zibo\library\xmlrpc\exception\XmlRpcException when a invalid return type or parameter type has been detected * @throws zibo\library\xmlrpc\exception\XmlRpcException when the description is not a valid string */ public function registerService($name, $callback, $returnType = 'string', $parameterTypes = null, $description = null) { if (String::isEmpty($name)) { throw new XmlRpcException('Name of the service is empty'); } if (isset($this->services[$name])) { throw new XmlRpcException($name . ' service already registered'); } $callback = new Callback($callback); if (!Value::isValidType($returnType)) { throw new XmlRpcException('Return type ' . $returnType . ' is not a valid type'); } if ($parameterTypes == null) { $parameterTypes = array(); } elseif (!is_array($parameterTypes)) { $parameterTypes = array($parameterTypes); } foreach ($parameterTypes as $type) { if (!Value::isValidType($type)) { throw new XmlRpcException('Parameter type ' . $type . ' is not a valid type'); } } if ($description != null && !is_string($description)) { throw new XmlRpcException('Provided description is not a string'); } $service = array(self::SERVICE_CALLBACK => $callback, self::SERVICE_RETURN_TYPE => $returnType, self::SERVICE_PARAMETERS_TYPES => $parameterTypes, self::SERVICE_DESCRIPTION => $description); $this->services[$name] = $service; }
/** * Set the name of this theme * @param string $name * @return null * @throws zibo\ZiboException when the provided name is invalid */ private function setName($name) { if (String::isEmpty($name)) { throw new ZiboException('Name of the region is empty'); } $this->name = $name; }
/** * Sets the host of this connection * @param string $host * @return null * @throws zibo\library\network\exception\ConnectionException when the host is invalid */ protected function setHost($host) { if (String::isEmpty($host)) { throw new ConnectionException('Could not set the host: invalid host provided'); } $this->host = $host; }
/** * Set the translation key of the label * @param string $labelTranslationKey * @return null * @throws zibo\ZiboException when invalid label provided */ private function setLabelTranslationKey($labelTranslationKey) { if (String::isEmpty($labelTranslationKey)) { throw new ZiboException('Provided label is empty'); } $this->labelTranslationKey = $labelTranslationKey; }
/** * Sets the expression string * @param string $expression * @return null * @throws zibo\ZiboException when the expression is empty or invalid */ private function setExpression($expression) { if (String::isEmpty($expression)) { throw new OrmException('Provided expression is empty'); } $this->expression = $expression; }
/** * Set the date format used to write the timestamp of the log item */ public function setDateFormat($dateFormat) { if (String::isEmpty($dateFormat)) { throw new ZiboException('Provided date format is empty'); } $this->dateFormat = $dateFormat; }
/** * Adds a regular expression to match URL's which should be ignored * @param string $ignoreRegex Regular expression * @return null */ public function addIgnoreRegex($ignoreRegex) { if (String::isEmpty($ignoreRegex)) { throw new ZiboException('Could not add an empty regular expression'); } $this->ignore[] = $ignoreRegex; }
private function setAction($action) { if (String::isEmpty($action)) { $action = Dispatcher::ACTION_ASTERIX; } $this->action = $action; }
/** * Register a new thumbnailer into this factory * @param string name name of the thumbnailer * @param Thumbnailer thumbnailer Thumbnailer instance */ public function register($name, Thumbnailer $thumbnailer) { if (String::isEmpty($name)) { throw new ThumbnailException('Name is empty'); } $this->thumbnailers[$name] = $thumbnailer; }
/** * Sets the method name for the request * @param string $methodName * @return null * @throws zibo\library\xmlrpc\exception\XmlRpcException when the provided method name is empty */ protected function setMethodName($methodName) { if (String::isEmpty($methodName)) { throw new XmlRpcException('Method name cannot be empty'); } $this->methodName = $methodName; }
/** * Checks if a manager exists * @param string $name name of the manager * @return boolean * @throws zibo\ZiboException when the name is empty or not a string */ public function hasManager($name) { if (String::isEmpty($name)) { throw new ZiboException('Name is empty'); } return array_key_exists($name, $this->managers); }
/** * Sets the field name for objects or arrays passed to this decorator * @param string $fieldName * @return null * @throws zibo\ZiboException when the field name is empty or an object */ protected function setFieldName($fieldName) { if ($fieldName != null && String::isEmpty($fieldName)) { throw new ZiboException('Provided field name is empty'); } $this->fieldName = $fieldName; }
/** * Constructs a new address * @param string $address The email address in one of the supported formats * @return null * @throws zibo\library\mail\exception\MailException when the provided address is empty or invalid */ public function __construct($address) { try { if (String::isEmpty($address)) { throw new MailException('address is empty'); } } catch (ZiboException $exception) { throw new MailException('Invalid address provided', 0, $exception); } $validator = ValidationFactory::getInstance()->createValidator('email'); $address = trim($address); $address = str_replace(array("\n", "\r"), '', $address); $matches = array(); if (preg_match(self::REGEX_ADDRESS, $address, $matches)) { $this->displayName = trim($matches[1]); $address = $matches[3]; } if ($validator->isValid($address)) { $this->emailAddress = $address; if (empty($this->displayName) && strpos($address, '@') !== false) { list($this->displayName, $null) = explode('@', $address); } return; } throw new MailException('Provided address ' . $address . ' is invalid'); }
/** * Adds a custom validator for a specified field * @param string $fieldName Name of the field * @param zibo\library\validation\validator\Validator $validator The validator for the field * @return null */ public function addValidator($fieldName, Validator $validator) { if (String::isEmpty($fieldName)) { throw new ZiboException('Cannot add the validator: provided fieldname is empty'); } $this->validators[$fieldName][] = $validator; }
/** * Sets the date format * @param string $format * @return null * @throws zibo\ZiboException when an invalid format is provided */ private function setFormat($format = null) { if ($format !== null && String::isEmpty($format)) { throw new ZiboException('Provided format is empty'); } $this->format = $format; }
/** * Sets the label of this anchor element * @param string $label * @return null * @throws zibo\ZiboException when the label is empty or not a string */ public function setLabel($label) { if (String::isEmpty($label)) { throw new ZiboException('Provided label is empty'); } $this->label = $label; }
/** * Parses the tag content to split the tag from the parameters * @param string $tagContent * @return null * @throws zibo\ZiboException when the provided tag content is empty or invalid */ private function parseTagContent($tagContent) { if (String::isEmpty($tagContent)) { throw new ZiboException('Provided tag content is empty'); } $tokens = $this->tokenize($tagContent); $tag = array_shift($tokens); $parameters = array(); if ($this->parseArgument($tag, $key, $value)) { $tag = $key; $parameters[] = $value; } foreach ($tokens as $token) { if (!$this->parseArgument($token, $key, $value)) { continue; } $parameters[strtolower($key)] = $value; } $this->isCloseTag = false; if (substr($tag, 0, 1) == Tag::CLOSE_PREFIX) { $tag = substr($tag, 1); $this->isCloseTag = true; } $this->tag = strtolower($tag); $this->parameters = $parameters; }