/** * Sets validator options * * @param string|array|\Traversable $options */ public function __construct($options = null) { if ($options instanceof Traversable) { $options = ArrayUtils::iteratorToArray($options); } $case = null; if (1 < func_num_args()) { $case = func_get_arg(1); } if (is_array($options)) { if (isset($options['case'])) { $case = $options['case']; unset($options['case']); } if (!array_key_exists('extension', $options)) { $options = array('extension' => $options); } } else { $options = array('extension' => $options); } if ($case !== null) { $options['case'] = $case; } parent::__construct($options); }
public function __construct($options = null) { parent::__construct($options); if ($options && isset($options['dateFormat'])) { $this->setDateFormat($options['dateFormat']); } }
public function __construct($options = null) { if ($options instanceof JobRepository) { $options = array('repository' => $options); } parent::__construct($options); }
/** * Sets validator options * * @param array|Traversable $options * * @throws Exception\InvalidArgumentException */ public function __construct($options = null) { if ($options instanceof Traversable) { $options = ArrayUtils::iteratorToArray($options); } parent::__construct($options); }
/** * Creates an instance. * * @param UserInterface|array|null $options */ public function __construct($options = null) { if ($options instanceof UserInterface) { $options = array('user' => $options); } parent::__construct($options); }
/** * @param array $options * @param DataMapperManagerInterface $dataMapperManager */ public function __construct(array $options = null, DataMapperManagerInterface $dataMapperManager = null) { $this->dataMapperManager = $dataMapperManager; if (!isset($options['finder']) && !isset($options['entity_class'])) { throw new Exception\InvalidArgumentException('No finder nor entity class provided'); } if (isset($options['entity_class']) && $this->dataMapperManager) { $options['finder'] = $this->dataMapperManager->getDataMapperForEntity($options['entity_class']); } if (!is_object($options['finder']) && !is_callable($options['finder'])) { throw new Exception\InvalidArgumentException('Finder must be an object or a callable'); } if (!isset($options['find_method'])) { $options['find_method'] = is_callable($options['finder']) ? '__invoke' : 'findByUuid'; } if (!method_exists($options['finder'], $options['find_method'])) { throw new Exception\InvalidArgumentException(sprintf("'%s' method not found in '%s'", $options['find_method'], get_class($options['finder']))); } $this->setFindMethod($options['find_method']); $this->setFinder($options['finder']); if (isset($options['excluded'])) { $this->setExcluded($options['excluded']); } parent::__construct($options); }
/** * Sets validator options * * @param array|Traversable $options * * @throws InvalidArgumentException */ public function __construct($options = null) { if (is_null($options)) { $options = []; } if ($options instanceof Traversable) { $options = ArrayUtils::iteratorToArray($options); } if (!array_key_exists('apiKey', $options)) { throw new InvalidArgumentException("Missing Kickbox API key"); } if (!array_key_exists('strictMode', $options)) { $options['strictMode'] = false; } if (!array_key_exists('cacheAdapter', $options)) { $options['cacheAdapter'] = null; } if (!array_key_exists('logger', $options)) { $options['logger'] = null; } $this->setApiKey($options['apiKey']); $this->setStrictMode($options['strictMode']); $this->setCacheAdapter($options['cacheAdapter']); $this->setLogger($options['logger']); parent::__construct($options); }
/** * Sets validator options * * The array $files must be given in syntax of Zend_File_Transfer to be checked * If no files are given the $_FILES array will be used automatically. * NOTE: This validator will only work with HTTP POST uploads! * * @param array|\Traversable $options Array of files in syntax of \Zend\File\Transfer\Transfer */ public function __construct($options = array()) { if (is_array($options) && !array_key_exists('files', $options)) { $options = array('files' => $options); } parent::__construct($options); }
/** * Sets validator options * * @param null|string|Locale|array|Traversable $locale OPTIONAL * @return void */ public function __construct($locale = null) { $options = array(); if ($locale instanceof Traversable) { $locale = IteratorToArray::convert($locale); } if (is_array($locale)) { $options = $locale; if (array_key_exists('locale', $locale)) { $locale = $locale['locale']; unset($options['locale']); } else { $locale = null; } } if (empty($locale) && $locale !== false) { if (Registry::isRegistered('Zend_Locale')) { $locale = Registry::get('Zend_Locale'); } } if ($locale !== null) { $this->setLocale($locale); } parent::__construct($options); }
public function __construct($options = null) { parent::__construct($options); if (is_array($options)) { $this->setOptions($options); } }
public function __construct($options = null) { parent::__construct($options); if (is_array($options)) { if (array_key_exists("adapter", $options) && !empty($options['adapter'])) { $this->setAdapter($options['adapter']); } else { throw new Exception\InvalidArgumentException('Necessario informa Adapter.'); } if (array_key_exists("tabela", $options) && !empty($options['tabela'])) { $this->tabela = $options['tabela']; } else { throw new Exception\InvalidArgumentException('Necessario informa a tabela do BD.'); } if (array_key_exists("campo", $options) && !empty($options['campo'])) { $this->campo = $options['campo']; } else { throw new Exception\InvalidArgumentException('Necessario informa o campo a ser validado.'); } if (array_key_exists('negar', $options) && count($options['negar']) > 0) { $this->negar = $options['negar']; } if (array_key_exists("camposExtra", $options) && count($options['camposExtra']) > 0) { $this->camposExtra = $options['camposExtra']; } } }
public function __construct($options = array()) { parent::__construct($options); if (array_key_exists('valid_if_empty', $options)) { $this->validIfEmpty = $options['valid_if_empty']; } }
public function __construct($options = null) { parent::__construct($options); $options = $this->getOptions(); //set default options if non set if (!isset($options[self::OPTION_MIN_LENGTH])) { $options[self::OPTION_MIN_LENGTH] = 8; } if (!isset($options[self::OPTION_REQUIRE_UPPER])) { $options[self::OPTION_REQUIRE_UPPER] = true; } if (!isset($options[self::OPTION_REQUIRE_LOWER])) { $options[self::OPTION_REQUIRE_LOWER] = true; } if (!isset($options[self::OPTION_REQUIRE_DIGIT])) { $options[self::OPTION_REQUIRE_DIGIT] = true; } if (!isset($options[self::OPTION_REQUIRE_SPECIAL_CHARACTERS])) { $options[self::OPTION_REQUIRE_SPECIAL_CHARACTERS] = true; } if (!isset($options[self::OPTION_SPECIAL_CHARACTERS])) { $options[self::OPTION_SPECIAL_CHARACTERS] = self::DEFAULT_SPECIAL_CHARS; } $minLength = $this->getOption(self::OPTION_MIN_LENGTH); $this->messageTemplates = array(self::LENGTH => "Password must be at least {$minLength} characters in length", self::UPPER => "Password must contain at least one uppercase letter", self::LOWER => "Password must contain at least one lowercase letter", self::DIGIT => "Password must contain at least one digit character", self::SPECIAL => "Password must contain at least one special character"); }
/** * Sets default option values for this instance * * @param array|\Traversable $options */ public function __construct($options = array()) { if ($options instanceof Traversable) { $options = iterator_to_array($options); } elseif (!is_array($options)) { $options = func_get_args(); $temp['uriHandler'] = array_shift($options); if (!empty($options)) { $temp['allowRelative'] = array_shift($options); } if (!empty($options)) { $temp['allowAbsolute'] = array_shift($options); } $options = $temp; } if (isset($options['uriHandler'])) { $this->setUriHandler($options['uriHandler']); } if (isset($options['allowRelative'])) { $this->setAllowRelative($options['allowRelative']); } if (isset($options['allowAbsolute'])) { $this->setAllowAbsolute($options['allowAbsolute']); } parent::__construct($options); }
/** * Constructor * * @param array|Traversable|int $options OPTIONAL */ public function __construct($options = null) { if ($options instanceof Traversable) { $options = ArrayUtils::iteratorToArray($options); } if (!is_array($options)) { $options = func_get_args(); $temp = array(); if (!empty($options)) { $temp['type'] = array_shift($options); } $options = $temp; } if (is_array($options)) { if (!array_key_exists('type', $options)) { $detected = 0; $found = false; foreach ($options as $option) { if (in_array($option, $this->constants)) { $found = true; $detected += array_search($option, $this->constants); } } if ($found) { $options['type'] = $detected; } } } parent::__construct($options); }
/** * Sets default option values for this instance * * @param boolean|\Zend\Config\Config $allowWhiteSpace * @return void */ public function __construct($allowWhiteSpace = false) { parent::__construct(is_array($allowWhiteSpace) ? $allowWhiteSpace : null); if (is_scalar($allowWhiteSpace)) { $this->allowWhiteSpace = (bool) $allowWhiteSpace; } }
/** * Constructor * * @param array|Traversable $options */ public function __construct($options = array()) { parent::__construct(); if ($options instanceof Traversable) { $options = ArrayUtils::iteratorToArray($options); } if (!is_array($options)) { $options = (array) $options; } foreach ($options as $key => $value) { switch (strtolower($key)) { case 'name': $this->setName($value); break; case 'salt': $this->setSalt($value); break; case 'session': $this->setSession($value); break; case 'timeout': $this->setTimeout($value); break; default: // ignore unknown options break; } } }
/** * Constructor * * @param array $options * @return \Zend\Validator\Float */ public function __construct($options = null) { if (!is_array($options)) { $options = array('locale' => $options); } parent::__construct($options); }
/** * Constructor * * @param array|string $options */ public function __construct($options) { if (is_string($options)) { $this->setClass($options); $options = null; } parent::__construct($options); }
public function __construct(array $options = array()) { if (!isset($options['field'])) { //throw new Exception\InvalidArgumentException('Field to check missing'); } $this->field = $options['field']; parent::__construct($options); }
public function __construct($options = null) { parent::__construct($options); $this->libPhoneNumber = PhoneNumberUtil::getInstance(); if (array_key_exists('country', $options)) { $this->setCountry($options['country']); } }
/** * Required options are: * - key Field to use, 'emial' or 'username' */ public function __construct(array $options) { if (!array_key_exists('key', $options)) { throw new Exception\InvalidArgumentException('No key provided'); } $this->setKey($options['key']); parent::__construct($options); }
/** * Sets default option values for this instance * * @param bool $allowWhiteSpace */ public function __construct($allowWhiteSpace = false) { $options = is_array($allowWhiteSpace) ? $allowWhiteSpace : null; parent::__construct($options); if (is_scalar($allowWhiteSpace)) { $this->options['allowWhiteSpace'] = (bool) $allowWhiteSpace; } }
/** * @param array $options * @throws \Exception */ public function __construct(array $options) { if (!isset($options['interval'])) { throw new \Exception('Must provide the interval'); } $this->interval = $options['interval']; $this->intervalToString(); parent::__construct($options); }
/** * @param array $options * @throws \Exception */ public function __construct(array $options = null) { if (!isset($options['minDate'])) { $this->minDate = Carbon::now(); } elseif (isset($options['minDate']) && !$options['minDate'] instanceof DateTime) { throw new \InvalidArgumentException('Invalid datetime object'); } parent::__construct($options); }
public function __construct($options = array()) { if (!is_array($options)) { $options = func_get_args(); $temp['pattern'] = array_shift($options); $options = $temp; } parent::__construct($options); }
public function __construct($options = null) { parent::__construct($options); if ($options && is_array($options) && isset($options['citationStyles']) && $options['citationStyles'] instanceof Citationstyles) { $this->citationStyles = $options['citationStyles']; } else { throw new Exception('An instance of CitationstyleConversion\\Model\\Citationstyles needs to be provided'); } }
/** * Sets validator options * * @param string|array $options * @return void */ public function __construct($options = null) { if (is_scalar($options) || is_array($options) && !array_key_exists('hash', $options)) { $options = array('hash' => $options); } if (1 < func_num_args()) { $options['algorithm'] = func_get_arg(1); } parent::__construct($options); }
/** * Constructor for barcodes * * @param array|string $options Options to use */ public function __construct($options = null) { if (!is_array($options) && !$options instanceof Traversable) { $options = array('adapter' => $options); } if (array_key_exists('options', $options)) { $options['options'] = array('options' => $options['options']); } parent::__construct($options); }
/** * Sets validator options * * @param array|Traversable $options OPTIONAL */ public function __construct($options = array()) { if ($options instanceof Traversable) { $options = ArrayUtils::iteratorToArray($options); } if (array_key_exists('locale', $options)) { $this->setLocale($options['locale']); } parent::__construct($options); }