protected function objectToArray($obj) : array
    {
        if ($obj instanceof \stdClass) {
            $obj = json_decode(json_encode($obj), true);
        }

        return (array)$obj;
    }
protected function objectToArray($obj) : array
    {
        if ($obj instanceof \stdClass) {
            $obj = json_decode(json_encode($obj), true);
        }

        return (array)$obj;
    }
protected function objectToArray ( $ obj ) : array { if ( $ obj instanceof \ stdClass ) { $ obj = json_decode ( json_encode ( $ obj ) , true ) ; } return ( array ) $ obj ; }
Helper method to convert a \stdClass into an array

@param $obj
@return array
Helper method to convert a \ stdClass into an array