public function contains()
    {

        $output = true;
        $args = func_get_args();

        // support a arbritary number objects against which to test
        while( list(,$value) = each($args) and $output ) {

            // is entity
            if( $value instanceof Container ) {

                $numChecking = count( $value );
                $numContained = count( array_intersect_key( $value->collection, $this->collection ) );
                $testResult = $numChecking === $numContained;

            } elseif ( is_object($value) ) {

                $testResult = false !== array_search( $value, $this->collection, true );

            // is null or null like. See, http://en.wikipedia.org/wiki/Empty_set. All containers contain the empty container
            } elseif ( is_null( $value ) or $value === array() ){

                $testResult = true;

            // is a array or container
            } elseif ( is_array( $value ) ) {

                $testResult = true;
                while( list(,$entity) = each( $value ) and $testResult ) {
                    $testResult = ( $this->search( $entity ) !== false or !$entity );
                }

            // something else
            } else {
                throw new BadTypeException( $value, 'Container|array|obj' );
            }

            $output = ( $output and $testResult );

        }

        return $output;

    }
public function contains()
    {

        $output = true;
        $args = func_get_args();

        // support a arbritary number objects against which to test
        while( list(,$value) = each($args) and $output ) {

            // is entity
            if( $value instanceof Container ) {

                $numChecking = count( $value );
                $numContained = count( array_intersect_key( $value->collection, $this->collection ) );
                $testResult = $numChecking === $numContained;

            } elseif ( is_object($value) ) {

                $testResult = false !== array_search( $value, $this->collection, true );

            // is null or null like. See, http://en.wikipedia.org/wiki/Empty_set. All containers contain the empty container
            } elseif ( is_null( $value ) or $value === array() ){

                $testResult = true;

            // is a array or container
            } elseif ( is_array( $value ) ) {

                $testResult = true;
                while( list(,$entity) = each( $value ) and $testResult ) {
                    $testResult = ( $this->search( $entity ) !== false or !$entity );
                }

            // something else
            } else {
                throw new BadTypeException( $value, 'Container|array|obj' );
            }

            $output = ( $output and $testResult );

        }

        return $output;

    }
public function contains ( ) { $ output = true ; $ args = func_get_args ( ) ; // support a arbritary number objects against which to test while ( list ( , $ value ) = each ( $ args ) and $ output ) { // is entity if ( $ value instanceof Container ) { $ numChecking = count ( $ value ) ; $ numContained = count ( array_intersect_key ( $ value -> collection , $ this -> collection ) ) ; $ testResult = $ numChecking === $ numContained ; } elseif ( is_object ( $ value ) ) { $ testResult = false !== array_search ( $ value , $ this -> collection , true ) ; // is null or null like. See, http://en.wikipedia.org/wiki/Empty_set. All containers contain the empty container } elseif ( is_null ( $ value ) or $ value === array ( ) ) { $ testResult = true ; // is a array or container } elseif ( is_array ( $ value ) ) { $ testResult = true ; while ( list ( , $ entity ) = each ( $ value ) and $ testResult ) { $ testResult = ( $ this -> search ( $ entity ) !== false or ! $ entity ) ; } // something else } else { throw new BadTypeException ( $ value , 'Container|array|obj' ) ; } $ output = ( $ output and $ testResult ) ; } return $ output ; }
Does this container contain the following entities
@param ContainerableInterface|Container|ContainerableInterface[]
@return boolean
Does this container contain the following entities