Asserts that the given array is empty.

@param array|\Countable $countableElement The array or the countable object to assert its emptiness.
@param Throwable $exception The exception to throw if the assertion fails.
@return bool
967707
public static function assertEmpty($countableElement, Throwable $exception): bool
    {
        static::makeAssertion(0 === \count($countableElement), $exception);
        return true;
    }
1105267
public function shouldExceptionCaptureBeSkipped(\Throwable $exception): bool
    {
        if (in_array(get_class($exception), $this->skipCapture, true)) {
            return true;
        }
        if ($this->skipHash && in_array($this->hashService->hash($exception), $this->skipHash, true)) {
            return true;
        }
        foreach ($this->skipInstanceof as $class) {
            if ($exception instanceof $class) {
                return true;
            }
        }

        if (function_exists('fnmatch')) {
            $message = $exception->getMessage();
            foreach ($this->skipWildcard as $wildcard) {
                if (fnmatch($wildcard, $message)) {
                    return true;
                }
            }
        }

        return false;
    }
711549
public function unignoreCountable($countable)
    {
        if ( ! is_array($countable)) $countable = [ $countable];

        $this->ignoreCountables = array_diff($this->ignoreCountables, $countable);

        return $this;
    }
221690
public static function assertIsFloat($variable, Throwable $exception): bool
    {
        static::makeAssertion(\is_float($variable), $exception);
        return true;
    }
1242461
public function add($exception) {
        if($this->checkException($exception) === FALSE) {
            trigger_error(
                'Only subclasses of \Exception and implementations of \Throwable can be aggregated!',
                E_USER_ERROR
            );
        }

        $this->collection[] = $exception;
    }
274097
private function assertElement($condition, $message, Element $element)
    {
        if ($condition) {
            return;
        }

        throw new ElementHtmlException($message, $this->session->getDriver(), $element);
    }
935972
public static function assertIsScalar($variable, Throwable $exception): bool
    {
        static::makeAssertion(\is_scalar($variable), $exception);
        return true;
    }
593428
public function exception($exception = null)
    {
        if (!func_num_args()) {
            return $this->_exception;
        }
        $this->_exception = $exception;
        return $this;
    }
1290047
public function setException(Exception $exception)
    {
        $this->exception = $exception;
        return $this->raiseStatus(self::Status_Exception);
    }
556661
public function exception(\Throwable $throwable)
    {
        try {
            if (@Application::getSettings()->logging->exceptions) {
                $this->error('[EXCEPTION] ' . $throwable . PHP_EOL . $throwable->getTraceAsString());
            }
        } catch (SettingsException $throwable) {
            // No setting present, throwable will not be logged.
        }
    }
1337002
public function isAllowed($exception)
    {
        if (empty($exception) || !$exception instanceof \Exception) {
            return true;
        }

        if (!empty($this->blacklist)) {
            foreach ($this->blacklist as $excType) {
                if (is_a($exception, $excType, true)) {
                    return false;
                }
            }
        }

        return true;
    }
1305163
protected function ensureIsNotEmpty($fieldName, $valueToTest, $exceptionCode = 0)
    {
        if ($valueToTest === 0 || $valueToTest === '0' || $valueToTest === false) {
            return;
        }

        if (empty($valueToTest)) {
            $message = sprintf('%s should not be empty', $fieldName);
            throw new InvalidValueException($message, $exceptionCode);
        }
    }
787309
public function contains($e) {
			if (!EnumUtil::isEnum($e, $this->class))
				throw new InvalidArgumentException(sprintf('Element must be an instance of %s.', $this->class));

			return ($this->entries & $this->universe[$e->ordinal()]) !== 0;
		}
600817
public static function wrapException(\Throwable $exception): \Throwable
    {
        if ($exception instanceof ExceptionInterface) {
            return $exception;
        }

        if ($exception instanceof ConnectionException) {
            if ($exception instanceof ConnectionPDOException) {
                return new DatabaseException($exception->getMessage(), $exception->getCode(), $exception);
            }
            if ($exception instanceof ConnectionInvalidArgumentException) {
                return new InvalidArgumentException($exception->getMessage(), $exception->getCode(), $exception);
            }
            if ($exception instanceof ConnectionFileException) {
                return new FileException($exception->getMessage(), $exception->getCode(), $exception);
            }
        }

        if ($exception instanceof QueryScribeException) {
            if ($exception instanceof QueryScribeInvalidArgumentException) {
                return new InvalidArgumentException($exception->getMessage(), $exception->getCode(), $exception);
            }
            if ($exception instanceof QueryScribeInvalidReturnValueException) {
                return new InvalidReturnValueException($exception->getMessage(), $exception->getCode(), $exception);
            }
            if ($exception instanceof QueryScribeInvalidQueryException) {
                return new IncorrectQueryException($exception->getMessage(), $exception->getCode(), $exception);
            }
        }

        return $exception;
    }
11696
public function lengthOf($countable, $length, $message = '')
    {
        $this->assertion->setActual($countable);

        return $this->assertion->to->have->length($length, $message);
    }
630230
public function create($element, $inputType = null, $position = null)
    {
        if (!(is_string($element) || $element instanceof FormElement)) {
            throw new Exception('$element must be string or FormElement instance.');
        }

        // Create new element from string declaration ("title").
        if (is_string($element)) {
            $element = (new FormElement($element));
        }

        // Create Form Input Element from string declaration ("textarea")
        if (is_string($inputType)) {
            $oldInput = $element->getInput();
            $newInput = InputFactory::make($element->id(), $inputType);

            $newInput->setRelation(
                $oldInput->getRelation()
            )->setTranslatable(
                $oldInput->getTranslatable()
            );

            $element->setInput(
                $newInput
            );
        }

        // Allow a callable input type.
        if (is_callable($inputType)) {
            call_user_func_array($inputType, [$element]);
        }

        if (is_numeric($position)) {
            return $this->insert($element, $position);
        }

        // Push element
        $this->push($element);

        if (null !== $position) {
            return $this->move($element->id(), $position);
        }

        return $this;
    }
330481
public function _handleException($exception)
    {
        $result = false;

        if($this->isEnabled(self::TYPE_EXCEPTION))
        {
            //Handle \Error Exceptions in PHP7
            if (class_exists('Error') && $exception instanceof \Error)
            {
                $message = $exception->getMessage();
                $file    = $exception->getFile();
                $line    = $exception->getLine();
                $type    = E_ERROR; //Set to E_ERROR by default

                if($exception instanceof \DivisionByZeroError) {
                    $type = E_WARNING;
                }

                if($exception instanceof \AssertionError) {
                    $type = E_WARNING;
                }

                if($exception instanceof \ParseError) {
                    $type = E_PARSE;
                }

                if($exception instanceof \TypeError) {
                    $type =  E_RECOVERABLE_ERROR;
                }

                $result = $this->_handleError($type, $message, $file, $line, null, $exception);
            }
            else $result = $this->handleException($exception);
        }

        //Let the normal error flow continue
        return $result;
    }