src/Axolotl/Type.php
public function validate_element( $element ) {
		$type = gettype( $element );
		$callable = $this->type === 'callable';
		$is_object = 'object' === $type;
		$loose_check = $this->type === 'object';

		// callable must be callable
		if ( $callable && ! is_callable( $element ) ) {
			throw new InvalidArgumentException( 'Item must be callable' );
		}

		// target isn't callable, object must be an instance of target
		if ( ! $loose_check && ! $callable && $is_object && ! is_a( $element, $this->type ) ) {
			throw new InvalidArgumentException( "Item is not type or subtype of $this->type" );
		}

		// a non callable, non object type should match the target string
		if ( ! $callable && ! $is_object && $type !== $this->type ) {
			throw new InvalidArgumentException( "Item is not of type: $this->type" );
		}
	}
public function validate_element( $element ) {
		$type = gettype( $element );
		$callable = $this->type === 'callable';
		$is_object = 'object' === $type;
		$loose_check = $this->type === 'object';

		// callable must be callable
		if ( $callable && ! is_callable( $element ) ) {
			throw new InvalidArgumentException( 'Item must be callable' );
		}

		// target isn't callable, object must be an instance of target
		if ( ! $loose_check && ! $callable && $is_object && ! is_a( $element, $this->type ) ) {
			throw new InvalidArgumentException( "Item is not type or subtype of $this->type" );
		}

		// a non callable, non object type should match the target string
		if ( ! $callable && ! $is_object && $type !== $this->type ) {
			throw new InvalidArgumentException( "Item is not of type: $this->type" );
		}
	}
public function validate_element ( $ element ) { $ type = gettype ( $ element ) ; $ callable = $ this -> type === 'callable' ; $ is_object = 'object' === $ type ; $ loose_check = $ this -> type === 'object' ; // callable must be callable if ( $ callable && ! is_callable ( $ element ) ) { throw new InvalidArgumentException ( 'Item must be callable' ) ; } // target isn't callable, object must be an instance of target if ( ! $ loose_check && ! $ callable && $ is_object && ! is_a ( $ element , $ this -> type ) ) { throw new InvalidArgumentException ( "Item is not type or subtype of $this->type" ) ; } // a non callable, non object type should match the target string if ( ! $ callable && ! $ is_object && $ type !== $ this -> type ) { throw new InvalidArgumentException ( "Item is not of type: $this->type" ) ; } }
Validate whether the

@param mixed $element Element to validate.

@throws InvalidArgumentException
Validate whether the