Inheritance: extends JInput
コード例 #1
0
ファイル: InputTest.php プロジェクト: Joal01/fof
 /**
  * @covers       FOF30\Input\Input::getData
  */
 public function testGetData()
 {
     $input = new Input(InputProvider::getSampleInputData());
     $data = $input->getData();
     $this->assertInternalType('array', $data, 'getData must return an array');
     $this->assertEquals(InputProvider::getSampleInputData(), $data, 'getData must return the exact input data');
 }
コード例 #2
0
ファイル: Platform.php プロジェクト: Joal01/fof
 /**
  * This method will try retrieving a variable from the request (input) data.
  *
  * @param   string   $key          The user state key for the variable
  * @param   string   $request      The request variable name for the variable
  * @param   Input    $input        The Input object with the request (input) data
  * @param   mixed    $default      The default value. Default: null
  * @param   string   $type         The filter type for the variable data. Default: none (no filtering)
  * @param   boolean  $setUserState Should I set the user state with the fetched value?
  *
  * @see PlatformInterface::getUserStateFromRequest()
  *
  * @return  mixed  The value of the variable
  */
 public function getUserStateFromRequest($key, $request, $input, $default = null, $type = 'none', $setUserState = true)
 {
     list($isCLI, $isAdmin) = $this->isCliAdmin();
     unset($isAdmin);
     // Just to make phpStorm happy
     if ($isCLI) {
         return $input->get($request, $default, $type);
     }
     $app = \JFactory::getApplication();
     if (method_exists($app, 'getUserState')) {
         $old_state = $app->getUserState($key, $default);
     } else {
         $old_state = null;
     }
     $cur_state = !is_null($old_state) ? $old_state : $default;
     $new_state = $input->get($request, null, $type);
     // Save the new value only if it was set in this request
     if ($setUserState) {
         if ($new_state !== null) {
             $app->setUserState($key, $new_state);
         } else {
             $new_state = $cur_state;
         }
     } elseif (is_null($new_state)) {
         $new_state = $cur_state;
     }
     return $new_state;
 }
コード例 #3
0
ファイル: Platform.php プロジェクト: Joal01/fof
 /**
  * This method will try retrieving a variable from the request (input) data.
  *
  * @param   string    $key           The user state key for the variable
  * @param   string    $request       The request variable name for the variable
  * @param   Input     $input         The Input object with the request (input) data
  * @param   mixed     $default       The default value. Default: null
  * @param   string    $type          The filter type for the variable data. Default: none (no filtering)
  * @param   boolean   $setUserState  Should I set the user state with the fetched value?
  *
  * @see F0FPlatformInterface::getUserStateFromRequest()
  *
  * @return  mixed  The value of the variable
  */
 public function getUserStateFromRequest($key, $request, $input, $default = null, $type = 'none', $setUserState = true)
 {
     return $input->get($request, $default, $type);
 }