Transforms a value into a specification.

@param bool $boolean

@return \RulerZ\Spec\Specification|null
760589
public function reverseTransform($boolean)
    {
        if (!$boolean) {
            return null;
        }

        $rClass = new \ReflectionClass($this->specificationClass);

        if ($rClass->getConstructor() && $rClass->getConstructor()->getNumberOfParameters() > 0) {
            return $rClass->newInstanceArgs($this->constructorArgs);
        }

        return $rClass->newInstance();
    }
1107529
public function noReset($bool = false)
	{
		if (is_bool($bool)) {
			$this->noReset = $bool;
		} else {
			throw new RuntimeException('Invalid parameter type setted, expected boolean, got ' . gettype($bool));
		}
	}
238472
protected function toBoolean($value)
    {
        if ($value === 1 || $value === 'true') {
            return true;
        }
        if (is_null($value) || $value === 0 || $value === 'false') {
            return false;
        }
        if ($this->getTypeCheck()->isArray($value) && count($value) === 1) {
            return $this->toBoolean(reset($value));
        }

        return $value;
    }
1243495
public function having($column, $operator = null, $value = null, $boolean = 'and')
    {
        $type = 'basic';

        $this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean');

        if (! $value instanceof Expression) {
            $this->addBinding($value, 'having');
        }

        return $this;
    }
8108
public function multiple($bool = true)
    {
        if ($this->props['type'] == 'date')
            $this->props['multiple'] = (bool)$bool;
        else
            $this->props['multiple'] = false;

        return $this;
    }
870760
public static function bool($value=false, bool $flatten=false) {
		ref\cast::bool($value, $flatten);
		return $value;
	}
954494
static function toBoolean ($v)
  {
    return is_string ($v) ? get (self::$BOOLEAN_VALUES, $v, false) : boolval ($v);
  }
1080764
public function whereNull($column, $boolean = 'and')
    {
        if (is_null($this->where)) {
            $this->where = '(`' . $column . '` is null)';
        } else {
            $this->where .= ' ' . $boolean .' (`' . $column .'` is null)';
        }

        return $this;
    }
962231
protected function valueBool($value)
	{
		if ($value !== false && empty($value)) return Yii::$app->formatter->nullDisplay;
		return Yii::$app->formatter->asBoolean($value);
	}
672375
public function ifTrue($bool)
    {
        if (null !== $this->apply) {
            throw new \RuntimeException('Cannot nest ifTrue or ifFalse call');
        }

        $this->apply = (true === $bool);

        return $this;
    }
853725
public function throwValidationExceptionsOnDispatch($bool = null)
    {
        if ($bool === null) {
            return $this->throwValidationExceptionsOnDispatch;
        } else {
            $this->throwValidationExceptionsOnDispatch = $bool;
        }
    }
1096544
public function createForm (bool $edit = false)
    {
        $form = [
            'storageURL' => route ('admin.api.resources'),
            'buttons'    => [
                [
                    "class" => "col-centered",
                    "label" => trans ('HCTranslations::core.buttons.submit'),
                    "type"  => "submit",
                ],
            ],
            'structure'  => [[
                "type"            => "resource",
                "fieldID"         => "resource",
                "uploadURL"       => route("admin.api.resources"),
                "viewURL"         => route("resource.get", ['/']),
                "label"           => trans ("HCResources::resources.resource"),
                "required"        => 1,
                "requiredVisible" => 1,
            ]],
        ];

        if (!$edit)
            return $form;

        //Make changes to edit form if needed
        $form['structure'] = [[
            "type"            => "singleLine",
            "fieldID"         => "original_name",
            "label"           => trans ("HCResources::resources.original_name"),
            "readonly"        => 1,
        ], [
            "type"            => "singleLine",
            "fieldID"         => "id",
            "label"           => trans ("HCResources::resources.safe_name"),
            "readonly"        => 1,
        ], [
            "type"            => "singleLine",
            "fieldID"         => "size",
            "label"           => trans ("HCResources::resources.size"),
            "readonly"        => 1,
        ], [
            "type"            => "singleLine",
            "fieldID"         => "path",
            "label"           => trans ("HCResources::resources.path"),
            "readonly"        => 1,
        ]];

        return $form;
    }
920024
public function whereNull($column, $boolean = 'and', $not = false)
    {
        $type = $not ? 'NotNull' : 'Null';

        if ($column == 'id') $column = 'id('. $this->modelAsNode() .')';

        $binding = $this->prepareBindingColumn($column);

        $this->wheres[] = compact('type', 'column', 'boolean', 'binding');

        return $this;
    }
360406
public Boolean get(JcBoolean bool) {
		Object val = this.getFor(bool);
		if (val != null)
			return (Boolean)val;
		return null;
	}
546597
public static function toBoolean($input = false) {

        if ($input) {

            $boolean = (bool) $input;
            if (Validate::isBoolean($boolean)) {

                return $boolean;
            }
        }

        return false;
    }
43120
public function whereIn($column, $values, $boolean = 'and', $not = false)
    {
        $type = $not ? 'NotIn' : 'In';

        // If the value is a query builder instance we will assume the developer wants to
        // look for any values that exists within this given query. So we will add the
        // query accordingly so that this query is properly executed when it is run.
        if ($values instanceof self ||
            $values instanceof EloquentBuilder ||
            $values instanceof Closure) {
            [$query, $bindings] = $this->createSub($values);

            $values = [new Expression($query)];

            $this->addBinding($bindings, 'where');
        }

        // Next, if the value is Arrayable we need to cast it to its raw array form so we
        // have the underlying array value instead of an Arrayable object which is not
        // able to be added as a binding, etc. We will then add to the wheres array.
        if ($values instanceof Arrayable) {
            $values = $values->toArray();
        }

        $this->wheres[] = compact('type', 'column', 'values', 'boolean');

        // Finally we'll add a binding for each values unless that value is an expression
        // in which case we will just skip over it since it will be the query as a raw
        // string and not as a parameterized place-holder to be replaced by the PDO.
        $this->addBinding($this->cleanBindings($values), 'where');

        return $this;
    }
318947
public function usePHPSession($bool = true)
    {
        if (!isset($_SESSION)) {
            session_start();
        }
        $this->_phpsession = $bool;
        return $this;
    }