예제 #1
0
 public function testGetPositionsOfParameterWithTypeHint()
 {
     $test_class = new TestClass();
     $result = Utilities::getPositionsOfParameterWithTypeHint($test_class, 'method', 'stdClass');
     $this->assertInternalType('array', $result);
     $this->assertArrayHasKey('param2', $result);
     $this->assertEquals(1, $result['param2']);
 }
예제 #2
0
 /**
  * @param $obj
  * @param $method
  * @param $params
  * @return mixed
  */
 protected function injectLanguageIntoMethodParameters(Language $language, $obj, $method, $params)
 {
     $position_of_language_parameter = Utilities::getPositionsOfParameterWithTypeHint($obj, $method, 'JK\\RestServer\\Language');
     if (count($position_of_language_parameter) > 0) {
         foreach ($position_of_language_parameter as $var_name => $position) {
             $params[$var_name] = $language;
             if (isset($params[$position])) {
                 unset($params[$position]);
             }
         }
         return $params;
     }
     return $params;
 }