public static function toArray($value)
    {
        # If it's already an array then just pass it back
        if (is_array($value)) {
            return $value;
        }

        if ($value instanceof SerialObject) {
            return $value->asArray();
        }

        if ($value instanceof \ArrayObject) {
            return $value->getArrayCopy();
        }

        # If it's not an array then create a new array to be returned
        $array = [];

        # If a value was passed as a string/int then include it in the new array
        if ($value) {
            $array[] = $value;
        }

        return $array;
    }
public static function toArray($value)
    {
        # If it's already an array then just pass it back
        if (is_array($value)) {
            return $value;
        }

        if ($value instanceof SerialObject) {
            return $value->asArray();
        }

        if ($value instanceof \ArrayObject) {
            return $value->getArrayCopy();
        }

        # If it's not an array then create a new array to be returned
        $array = [];

        # If a value was passed as a string/int then include it in the new array
        if ($value) {
            $array[] = $value;
        }

        return $array;
    }
public static function toArray ( $ value ) { # If it's already an array then just pass it back if ( is_array ( $ value ) ) { return $ value ; } if ( $ value instanceof SerialObject ) { return $ value -> asArray ( ) ; } if ( $ value instanceof \ ArrayObject ) { return $ value -> getArrayCopy ( ) ; } # If it's not an array then create a new array to be returned $ array = [ ] ; # If a value was passed as a string/int then include it in the new array if ( $ value ) { $ array [ ] = $ value ; } return $ array ; }
Ensure that the passed parameter is an array.
If it is a truthy value then make it the sole element of an array.

@param mixed $value The value to convert to an array

@return array
Ensure that the passed parameter is an array . If it is a truthy value then make it the sole element of an array .