src/Expectation/Matcher/LengthMatcher.php
public function match($actual)
    {
        if (is_string($actual)) {
            $this->type = 'string';
            $this->actual = strlen($actual);
        } elseif (is_array($actual)) {
            $this->type = 'array';
            $this->actual = count($actual);
        } else {
            throw new \Exception('LengthMatcher::match() requires an array or string');
        }

        return ($this->actual === $this->expected);
    }
public function match($actual)
    {
        if (is_string($actual)) {
            $this->type = 'string';
            $this->actual = strlen($actual);
        } elseif (is_array($actual)) {
            $this->type = 'array';
            $this->actual = count($actual);
        } else {
            throw new \Exception('LengthMatcher::match() requires an array or string');
        }

        return ($this->actual === $this->expected);
    }
public function match ( $ actual ) { if ( is_string ( $ actual ) ) { $ this -> type = 'string' ; $ this -> actual = strlen ( $ actual ) ; } elseif ( is_array ( $ actual ) ) { $ this -> type = 'array' ; $ this -> actual = count ( $ actual ) ; } else { throw new \ Exception ( 'LengthMatcher::match() requires an array or string' ) ; } return ( $ this -> actual === $ this -> expected ) ; }
Compares the length of the given array or string to the expected value.
Returns true if the value is of the expected length, else false.

@param  mixed      $actual An array or string for which to test the length
@return boolean    Whether or not the value is of the expected length
@throws \Exception If $actual isn't of type array or string
Compares the length of the given array or string to the expected value . Returns true if the value is of the expected length else false .