@@ -108,6 +108,13 @@ class Endpoint implements RepositoryInterface, EventListenerInterface, EventDisp
108108     */ 
109109    protected  $ _alias ;
110110
111+     /** 
112+      * The inflect method to use for endpoint routes 
113+      * 
114+      * @var string 
115+      */ 
116+     protected  $ _inflectionMethod  = 'underscore ' ;
117+ 
111118    /** 
112119     * Initializes a new instance 
113120     * 
@@ -153,6 +160,9 @@ public function __construct(array $config = [])
153160        if  (!empty ($ config ['resourceClass ' ])) {
154161            $ this  ->resourceClass ($ config ['resourceClass ' ]);
155162        }
163+         if  (!empty ($ config ['inflect ' ])) {
164+             $ this  ->inflectionMethod ($ config ['inflect ' ]);
165+         }
156166
157167        $ this  ->_eventManager  = $ eventManager  ?: new  EventManager ();
158168
@@ -217,7 +227,8 @@ public function endpoint($endpoint = null)
217227            if  (empty ($ endpoint )) {
218228                $ endpoint  = $ this  ->alias ();
219229            }
220-             $ this  ->_endpoint  = Inflector::underscore ($ endpoint );
230+             $ inflectMethod  = $ this  ->inflectionMethod ();
231+             $ this  ->_endpoint  = Inflector::$ inflectMethod ($ endpoint );
221232        }
222233
223234        return  $ this  ->_endpoint ;
@@ -452,6 +463,22 @@ public function resourceClass($name = null)
452463        return  $ this  ->_resourceClass ;
453464    }
454465
466+     /** 
467+      * Returns the inflect method or sets a new one 
468+      * 
469+      * @param null|string $method The inflection method to use 
470+      * 
471+      * @return null|string 
472+      */ 
473+     public  function  inflectionMethod ($ method  = null )
474+     {
475+         if  ($ method  === null ) {
476+             return  $ this  ->_inflectionMethod ;
477+         }
478+ 
479+         return  $ this  ->_inflectionMethod  = $ method ;
480+     }
481+ 
455482    /** 
456483     * Returns an instance of the Webservice used 
457484     * 
@@ -808,9 +835,9 @@ public function exists($conditions)
808835    public  function  save (EntityInterface   $ resource , $ options  = [])
809836    {
810837        $ options  = new  ArrayObject ($ options  + [
811-             'checkRules '  => true ,
812-             'checkExisting '  => false ,
813-         ]);
838+                  'checkRules '  => true ,
839+                  'checkExisting '  => false ,
840+              ]);
814841
815842        if  ($ resource ->errors ()) {
816843            return  false ;
0 commit comments