{@inheritdoc}

@throws LogicException
15594
public function transform($value)
    {
        // Not numeric and isn't blank (a value was actually provided)
        if ( ! is_numeric($value) && ! $this->isBlank($value)) {
            throw new LogicException("A valid integer is required.");
        }

        if ($value !== null) {
            return (int) $value;
        }

        return $value;
    }
57924
public function defineMethods()
    {
        if ($this->failover && !is_object($this->failover)) {
            throw new LogicException("ViewableData::\$failover set to a non-object");
        }
        if ($this->failover) {
            $this->addMethodsFrom('failover');

            if (isset($_REQUEST['debugfailover'])) {
                $class = static::class;
                $failoverClass = get_class($this->failover);
                Debug::message("$class created with a failover class of {$failoverClass}");
            }
        }
        $this->extensibleDefineMethods();
    }
1246765
public function insert($document)
    {
        $this->ensureAllowedMethodCall(__METHOD__);

        if (null !== $this->listener) {
            $this->listener->beforeInsert($document);
        }

        $id = $this->getWrappedBulk()->insert($document);
        if (null === $id) {
            if ($document instanceof DocumentInterface && !$document->getId()) {
                throw new LogicException(
                    '$document contains an id, but it\'s method getId() does not return it.'
                );
            }

            $id = $this->extractIdFromDocument($document);
        } elseif ($document instanceof DocumentInterface) {
            if ($document->getId()) {
                throw new LogicException(
                    '$document\'s method getId() returns not the same id document will be inserted with.'
                );
            }
            $document->setId($id);
        }

        $this->insertedIds[$this->currentPosition] = $id;
        $this->currentPosition += 1;

        return $id;
    }
944549
public function save()
    {
        if (!$this->path)
        {
            return;
        }
        while (count($this->actionQueue))
        {
            $action = array_shift($this->actionQueue);
            $methodName = 'action' . $action['action'];
            if (!method_exists($this, $methodName))
            {
                throw new LogicException('Unknown action: ' . $action['action']);
            }
            call_user_func_array(array($this, $methodName), $action['args']);
        }
        if ($this->phpThumb)
        {
            $this->phpThumb->save($this->path);
        }
    }
706469
public function toModel()
    {
        $nodeClass = $this->getElement()->NodeClass;
        if ($nodeClass === 'Node') {
            throw new LogicException('You must set a custom node in <node_class/> for element: ' . $this->getElement()->getSlug());
        } else {
            throw new LogicException('You must create a toModel method in: ' . $nodeClass);
        }
    }
1368722
public function set(/*# string */ $id, $value)/*# : bool */
    {
        if ($this->isWritable()) {
            $this->writable->set($id, $value);
            return $this->writable->has($id);
        } else {
            throw new LogicException(
                Message::get(Message::CONFIG_NOT_WRITABLE, $id),
                Message::CONFIG_NOT_WRITABLE
            );
        }
    }
90252
public function setOrder($order)
    {
        if (!in_array($order, [self::ORDER_ASC, self::ORDER_DESC])) {
            throw new LogicException('Invalid order argument.');
        }

        $this->order = $order;

        return $this;
    }
1018847
private function parseValue($value)
    {
        if (substr($value, 0, 1) === '"' && substr($value, -1, 1) === '"') {
            return substr($value, 1, -1);
        }

        if ($value === 'null') {
            return null;
        }

        throw new LogicException(sprintf('Can\'t parse the value: "%s"', $value));
    }
221593
public function unserialize($value) : void
    {
        if (isset($this->numerator)) {
            throw new \LogicException('unserialize() is an internal function, it must not be called directly.');
        }

        [$numerator, $denominator] = \explode('/', $value);

        $this->numerator   = BigInteger::of($numerator);
        $this->denominator = BigInteger::of($denominator);
    }
742796
public function select()
    {
        if( !$this->tableName ) {
            throw new LogicException('No table name specified');
        }
        $q = $this->database->select();
        $q->table($this->tableName);
        if( $this->resultClass ) {
            $q->setResultClass($this->resultClass);
            $q->setResultParams($this->resultParams);
        }
        return $q;
    }
4752
final public function delete($extraWhereClause = '')
    {
        if (self::RSMODE_CONNECTED_EDIT !== $this->mode) {
            throw new \LogicException('Recordset: The recordset is not on edit mode [current: ' . $this->mode . ']');
        }
        // check the entity is not empty
        if ('' === $this->entity) {
            throw new \LogicException('Recordset: The recordset does not have a valid unique entity');
        }
        $sql = $this->sqlDelete($extraWhereClause);
        $altered = $this->dbal->execute($sql);
        if (0 === $altered) {
            $this->logger->warning(print_r([
                'message' => "Recordset: The statement '$sql' return zero affected rows"
                    . ' but it should delete at least one record',
                'entity' => $this->entity,
                'extraWhereClause' => $extraWhereClause,
                'original' => $this->originalValues,
            ], true));
        }
        return $altered;
    }
84425
public function addOption(Option $option) {
        if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
            throw new \LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
        }

        if ($option->getShortcut()) {
            foreach (explode('|', $option->getShortcut()) as $shortcut) {
                if (isset($this->shortcuts[$shortcut])
                    && !$option->equals($this->options[$this->shortcuts[$shortcut]])
                ) {
                    throw new \LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
                }
            }
        }

        $this->options[$option->getName()] = $option;
        if ($option->getShortcut()) {
            foreach (explode('|', $option->getShortcut()) as $shortcut) {
                $this->shortcuts[$shortcut] = $option->getName();
            }
        }
    }
168501
public function boot()
    {
        if ($this->booted) {
            return;
        }

        if (!$this->name) {
            throw new \LogicException('Package: ' . get_class($this) . ' name property should not be empty.');
        }

        $this->getConfig();

        $this->registerProviders($this->getContainer());

        $this->registerListeners($this->getDispatcher());

        $this->registerMiddlewares();

        $this->booted = true;
    }
114888
protected function initialize()
    {
        if ('input' !== $this->node->nodeName && 'button' !== $this->node->nodeName) {
            throw new \LogicException(sprintf('An InputFormField can only be created from an input or button tag (%s given).', $this->node->nodeName));
        }

        if ('checkbox' === strtolower($this->node->getAttribute('type'))) {
            throw new \LogicException('Checkboxes should be instances of ChoiceFormField.');
        }

        if ('file' === strtolower($this->node->getAttribute('type'))) {
            throw new \LogicException('File inputs should be instances of FileFormField.');
        }

        $this->value = $this->node->getAttribute('value');
    }
1238381
public static function checkLogic( $logic ): void {
		$logicClass = new \ReflectionClass( Logic::class );
		// Check logic is valid
		if ( ! ( in_array( $logic, $logicClass->getConstants() ) ) ) {
			throw new BadLogicException( "Logic can only be : " . implode( ', ', $logicClass->getConstants() ) );
		}
	}
594620
private function prepareCondition($condition)
    {
        if (!is_array($condition)) {
            $condition = ['in' => [$condition]];
        }

        $conditionKeys = array_keys($condition);

        if (is_integer(current($conditionKeys))) {
            $condition = ['in' => $condition];
        }

        foreach ($condition as $key => $value) {
            if (!isset($this->mappedConditions[$key]) && !in_array($key, $this->rangeConditions)) {
                throw new \LogicException("Condition {$key} is not supported.");
            }

            if (isset($this->mappedConditions[$key])) {
                $condition[$this->mappedConditions[$key]] = $value;
                unset($condition[$key]);
            }

            if (in_array($key, $this->negativeConditions)) {
                $condition['negative'] = true;
            }
        }

        return $condition;
    }
385783
public function addAttribute($attribute, $value)
    {
        // Escape special characters
        $value = Filter::filterAttribute($value);

        if ($this->isProperty($attribute)) {
            $this->addPropertyOnDemand($attribute, $value);
        } else {
            if ($this->hasAttribute($attribute)) {
                throw new LogicException(sprintf('The element already has "%s" attribute', $attribute));
            }

            $this->append(sprintf(' %s="%s"', $attribute, $value));
            $this->attributes[$attribute] = $value;
        }

        return $this;
    }