set modal specs. Call setters based on array.

@param array $spec array specification

@return Modal

@access public
323377
public function setSpec(array $spec)
    {
        foreach ($spec as $key => $value) {
            $method = 'set' . ucfirst($key);
            if (method_exists($this, $method)) {
                $this->$method($value);
            }
        }
        return $this;
    }
52583
public function set(array $rules)
    {
        $this->items = array_merge(
            $this->items,
            $this->parseRules($rules)
        );

        return $this;
    }
981861
public function setPost($spec, $value = null)
    {
        if ((null === $value) && !is_array($spec)) {
            throw new \Exception('Invalid value passed to setPost(); must be either array of values or key/value pair');
        }

        if ((null === $value) && is_array($spec)) {
            foreach ($spec as $key => $value) {
                $this->setPost($key, $value);
            }
            return $this;
        }

        $_POST[(string) $spec] = $value;
        return $this;
    }
1122082
public function parse(Fixture $fixture, array $fixtures, $spec)
    {
        preg_match(self::REGEX, $spec, $matches);
        if (empty($matches)) {
            return $fixtures;
        }

        $list = $matches[0];
        $name = substr($spec, 0, strpos($spec, $list));

        preg_match_all('/[^,{}]+/', $list, $keys);
        if (empty($keys)) {
            return $fixtures;
        }

        $keys = array_map(function ($key) {
            return trim($key);
        }, $keys[0]);
        foreach ($keys as $item) {
            $newFixture = clone $fixture;
            $newFixture->setName($name . $item);
            $newFixture->setSpec($item);
            $fixtures[$name . $item] = $newFixture;
        }

        return $fixtures;
    }
1096538
public function setMode(string $mode): WebAclRule {
        self::checkMode($mode);
        $this->mode = (int) $mode;
        return $this;
    }
848934
public function create(array $spec = [])
    {
        $this->ensureRequiredAttributes($spec);

        $type = $spec['attributes']['type'];
        $name = $spec['attributes']['name'];

        $element = $this->buildElement($type, $name);

        if ($element instanceof ChoiceElementInterface) {
            $element = $this->configureChoiceElement($element, $spec);
        }

        if ($element instanceof LabelAwareInterface) {
            $element = $this->configureLabel($element, $spec);
        }

        if ($element instanceof ErrorAwareInterface) {
            $element = $this->configureErrors($element, $spec);
        }

        if ($element instanceof CollectionElementInterface) {
            $element = $this->configureEollection($element, $spec);
        }

        if ($element instanceof DescriptionAwareInterface) {
            $element = $this->configureDescription($element, $spec);
        }

        $element = $this->configureElement($element, $spec);

        return $element;
    }
602224
protected function getActions( array $spec )
    {
        $serviceLocator  = $this->getServiceLocator();
        $permissionModel = $this->getPermissionModel();

        foreach ( $spec as $index => $description )
        {
            if ( ! empty( $description['resource'] ) )
            {
                $allow = empty( $description['privilege'] )
                    ? $permissionModel->isAllowed( $description['resource'] )
                    : $permissionModel->isAllowed( $description['resource'],
                                                   $description['privilege'] );

                if ( ! $allow )
                {
                    unset( $spec[$index] );
                    continue;
                }
            }

            if ( ! empty( $description['dependencies'] ) )
            {
                foreach ( (array) $description['dependencies'] as $dependency )
                {
                    if ( empty( $dependency['service'] ) )
                    {
                        continue;
                    }

                    $service = $serviceLocator->get( $dependency['service'] );
                    $method  = empty( $dependency['method'] ) ? '__invoke' : (string) $dependency['method'];
                    $args    = empty( $dependency['arguments'] ) ? array() : (array) $dependency['arguments'];
                    $allow   = call_user_func_array( array( $service, $method ), $args );

                    if ( ! $allow )
                    {
                        unset( $spec[$index] );
                        continue 2;
                    }
                }
            }
        }

        uasort( $spec, function ( $a, $b ) {
            switch ( true )
            {
                case empty( $a['order'] ) && empty( $b['order'] ):
                    return 0;

                case empty( $a['order'] ) && ! empty( $b['order'] ):
                    return 1;

                case ! empty( $a['order'] ) && empty( $b['order'] ):
                    return -1;

                case $a['order'] == $b['order']:
                    return 0;

                default:
                    return $a['order'] > $b['order'] ? 1 : -1;
            }
        } );

        return $spec;
    }
1022280
public function group($spec)
    {
        if (!is_array($spec)) {
            $spec = array($spec);
        }

        foreach ($spec as $val) {
            if (preg_match('/\(.*\)/', (string) $val)) {
                $val = new Zend_Db_Expr($val);
            }
            $this->_parts[self::GROUP][] = $val;
        }

        return $this;
    }
918688
public function setSpecification($specification = null)
    {
        $this->checkSpecificationIsArray($specification);

        foreach ($specification as $item) {
            $this->items[] = $this->checkIfAnnotationAndReturnObject($item);
        }
    }
651884
public function setFilterRule($spec, $ruleSet)
    {
        $spec = $this->_normalizeSpec($spec);
        $this->rules[$spec] = [];
        return $this->addFilterRule($spec, $ruleSet);
    }
1054698
public function resolve(Specification $spec)
    {
        foreach ($this->converters as $converter) {
            if ($converter->accept($spec)) {
                return $converter;
            }
        }

        return null;
    }
709780
private function setProperties($specification)
    {
        if (!is_array($specification)) {
            throw new UnspecifiedValidatorException(
                'The validator Properties is being initialized with an invalid '
                . self::PROPERTIES_INDEX
                . ' parameter'
            );
        }
        foreach ($specification as $key => $item) {
            $this->properties[$key] = $this->checkIfAnnotationAndReturnObject($item);
        }
    }
731225
public function setOptions(array $options = [], $reset = false)
    {
        $element = current($options);
        //jeśli element jest ustawiony
        if ($element instanceof \Mmi\Form\Element\Checkbox) {
            $this->setElement($element);
        }
        return $this->setMessage(next($options));
    }
1225548
public function handle(Specification $spec)
    {
        $factory = $this->registry->getFactory($spec);

        return $factory->create($spec, $this->qb);
    }
862208
final public static function filter(array $spec, array $input, array $options = []) : array
    {
        BaseFilterer::setFilterAliases(self::$filterAliases + BaseFilterer::getFilterAliases());
        return BaseFilterer::filter($spec, $input, $options);
    }
1338973
public function init(array $spec)
    {
        $dl = QRspec::rsDataCodes1($spec);
        $el = QRspec::rsEccCodes1($spec);
        $rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);


        $blockNo = 0;
        $dataPos = 0;
        $eccPos = 0;
        for($i=0; $i<QRspec::rsBlockNum1($spec); $i++) {
            $ecc = array_slice($this->ecccode,$eccPos);
            $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el,  $ecc, $rs);
            $this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc);

            $dataPos += $dl;
            $eccPos += $el;
            $blockNo++;
        }

        if(QRspec::rsBlockNum2($spec) == 0)
            return 0;

        $dl = QRspec::rsDataCodes2($spec);
        $el = QRspec::rsEccCodes2($spec);
        $rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);

        if($rs == NULL) return -1;

        for($i=0; $i<QRspec::rsBlockNum2($spec); $i++) {
            $ecc = array_slice($this->ecccode,$eccPos);
            $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs);
            $this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc);

            $dataPos += $dl;
            $eccPos += $el;
            $blockNo++;
        }

        return 0;
    }
82511
public function setSpecification($specification = null)
    {
        if (empty($specification) || !is_numeric($specification) || $specification <= 0) {
            throw new UnspecifiedValidatorException(
                'The validator MultipleOf is being initialized without a valid number'
            );
        }
        $this->number = $specification;
    }