public static function setter($request, $params)
    {
        if (is_array($params)) {
            foreach ($params as $property => $value) {
                $property = Utils::deleteUnderscore($property);
                $setter = 'set'.ucfirst($property);
                if (method_exists($request, $setter)) {
                    $request->$setter($value);
                } else {
                    throw new NavitiaCreationException(
                        sprintf(
                            'Neither property "%s" nor method "%s"'.
                            'nor method "%s" exist.',
                            $property,
                            'get'.ucfirst($property),
                            $setter
                        )
                    );
                }
            }
        } else {
            throw new NavitiaCreationException(
                sprintf(
                    'The parameter (type "%s") will be an Array',
                    gettype($params)
                )
            );
        }
        return $request;
    }
public static function setter($request, $params)
    {
        if (is_array($params)) {
            foreach ($params as $property => $value) {
                $property = Utils::deleteUnderscore($property);
                $setter = 'set'.ucfirst($property);
                if (method_exists($request, $setter)) {
                    $request->$setter($value);
                } else {
                    throw new NavitiaCreationException(
                        sprintf(
                            'Neither property "%s" nor method "%s"'.
                            'nor method "%s" exist.',
                            $property,
                            'get'.ucfirst($property),
                            $setter
                        )
                    );
                }
            }
        } else {
            throw new NavitiaCreationException(
                sprintf(
                    'The parameter (type "%s") will be an Array',
                    gettype($params)
                )
            );
        }
        return $request;
    }
public static function setter ( $ request , $ params ) { if ( is_array ( $ params ) ) { foreach ( $ params as $ property => $ value ) { $ property = Utils :: deleteUnderscore ( $ property ) ; $ setter = 'set' . ucfirst ( $ property ) ; if ( method_exists ( $ request , $ setter ) ) { $ request -> $ setter ( $ value ) ; } else { throw new NavitiaCreationException ( sprintf ( 'Neither property "%s" nor method "%s"' . 'nor method "%s" exist.' , $ property , 'get' . ucfirst ( $ property ) , $ setter ) ) ; } } } else { throw new NavitiaCreationException ( sprintf ( 'The parameter (type "%s") will be an Array' , gettype ( $ params ) ) ) ; } return $ request ; }
Fonction permettant de setter
@param object $request
@param array $params
@return object
@throws NavitiaCreationException
Fonction permettant de setter