private function assertValidMatrix(array $matrix)
    {
        $count = count($matrix);
        if ($count === 3) {
            for ($x = 0; $x < $count; $x++) {
                if (!is_array($matrix[$x])) {
                    throw new \RuntimeException(sprintf(
                            'Item "%d" In The Given Matrix Is Not An Array', $x
                    ));
                }

                $subcount = count($matrix[$x]);
                if ($subcount < 3 || $subcount > 3) {
                    throw new \RuntimeException(sprintf(
                            'Item "%d" In The Given Matrix Must Be An Array With (3) '
                            . 'Flotas But "%d" Float(s) Was Found'
                            , $x, $subcount
                    ));
                }
            }
        } else {
            throw new \RuntimeException(sprintf(
                    'Expect Matrix (3*3) But The Given Matrix Length is (%s)'
                    , $count
            ));
        }
    }
private function assertValidMatrix(array $matrix)
    {
        $count = count($matrix);
        if ($count === 3) {
            for ($x = 0; $x < $count; $x++) {
                if (!is_array($matrix[$x])) {
                    throw new \RuntimeException(sprintf(
                            'Item "%d" In The Given Matrix Is Not An Array', $x
                    ));
                }

                $subcount = count($matrix[$x]);
                if ($subcount < 3 || $subcount > 3) {
                    throw new \RuntimeException(sprintf(
                            'Item "%d" In The Given Matrix Must Be An Array With (3) '
                            . 'Flotas But "%d" Float(s) Was Found'
                            , $x, $subcount
                    ));
                }
            }
        } else {
            throw new \RuntimeException(sprintf(
                    'Expect Matrix (3*3) But The Given Matrix Length is (%s)'
                    , $count
            ));
        }
    }
private function assertValidMatrix ( array $ matrix ) { $ count = count ( $ matrix ) ; if ( $ count === 3 ) { for ( $ x = 0 ; $ x < $ count ; $ x ++ ) { if ( ! is_array ( $ matrix [ $ x ] ) ) { throw new \ RuntimeException ( sprintf ( 'Item "%d" In The Given Matrix Is Not An Array' , $ x ) ) ; } $ subcount = count ( $ matrix [ $ x ] ) ; if ( $ subcount < 3 || $ subcount > 3 ) { throw new \ RuntimeException ( sprintf ( 'Item "%d" In The Given Matrix Must Be An Array With (3) ' . 'Flotas But "%d" Float(s) Was Found' , $ x , $ subcount ) ) ; } } } else { throw new \ RuntimeException ( sprintf ( 'Expect Matrix (3*3) But The Given Matrix Length is (%s)' , $ count ) ) ; } }
Assert that the given matrix is valid convolution matrix

@param array $matrix

@throws \RuntimeException
Assert that the given matrix is valid convolution matrix