Пример #1
0
 protected function _GetInput(array $keys)
 {
     $input = new \phalanx\base\Dictionary();
     foreach ($keys as $key) {
         if ($this->cli_input->HasKey($key)) {
             $input->Set($key, $this->cli_input->Get($key));
         }
     }
     return $input;
 }
Пример #2
0
 public function GetTaskData(Task $task)
 {
     $data = new \phalanx\base\Dictionary();
     $output_list = $task::OutputList();
     $output_list[] = 'input';
     foreach ($output_list as $key) {
         $class = new \ReflectionClass(get_class($task));
         if ($class->HasProperty($key) && $class->GetProperty($key)->IsPublic()) {
             $data->Set($key, $task->{$key});
         } else {
             if ($class->HasMethod($key) && $class->GetMethod($key)->IsPublic()) {
                 $data->Set($key, $task->{$key}());
             }
         }
     }
     return $data;
 }
Пример #3
0
 protected function _GetInput(array $keys)
 {
     $input = new \phalanx\base\Dictionary();
     $input->_method = $this->request_method;
     if ($this->request_method == 'GET') {
         foreach ($keys as $key) {
             if ($this->url_input->HasKey($key)) {
                 $input->Set($key, $this->url_input->Get($key));
             }
         }
         return $input;
     } else {
         if ($this->request_method == 'POST') {
             foreach ($keys as $key) {
                 if (isset($_POST[$key])) {
                     $input->Set($key, $_POST[$key]);
                 }
             }
             return $input;
         } else {
             throw new HTTPDispatcherException('Unknown request method "' . $this->request_method . '"');
         }
     }
     return $input;
 }
Пример #4
0
 protected function _GetInput(array $input_list)
 {
     $input = new \phalanx\base\Dictionary();
     foreach ($input_list as $key) {
         $input->Set($key, 'test:' . $key);
     }
     return $input;
 }