chippyash/Matrix

View on GitHub
src/Chippyash/Matrix/Traits/AssertParameterIsArray.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php
/*
 * Matrix library
 *
 * @author Ashley Kitson <akitson@zf4.biz>
 * @copyright Ashley Kitson, UK, 2014
 * @licence GPL V3 or later : http://www.gnu.org/licenses/gpl.html
 */
namespace Chippyash\Matrix\Traits;

use Chippyash\Matrix\Exceptions\MatrixException;

/**
 * Assert parameter is an array
 */
Trait AssertParameterIsArray
{
    /**
     * Run test to ensure parameter is an array
     *
     * @param $param
     * @param string $msg Optional message
     * @return $this
     *
     * @throws MatrixException
     * @internal param mixed $value
     */
    protected function assertParameterIsArray($param, $msg = 'Parameter is not an array')
    {
        if (!is_array($param)) {
            throw new MatrixException($msg);
        }

        return $this;
    }
}