original_string: protected function prepareProps($field, $rule)
      {
          $props = $messages = array();
  
          $props['plugins/app/js/validation'] = $this;
  
          // Prepare name for validator
          if (isset($this->names[$field])) {
              $props['name'] = $this->names[$field];
          }
  
          /**
           * Prepare messages for validator
           *
           * The messages array may look like below
           * array(
           *     // Case 1
           *     'field' => 'message',
           *     // Case 2
           *     'field2' => array(
           *         'rule' => 'message'
           *     ),
           *     // Case 2
           *     'field3' => array(
           *         'rule' => array(
           *            'option' => 'message',
           *            'option2' => 'message',
           *         )
           *     )
           * )
           *
           * In case 2, checking non-numeric offsets of strings would return true
           * in PHP 5.3, while return false in PHP 5.4, so we do NOT known
           * $messages is array or string
           * @link http://php.net/manual/en/function.isset.php
           *
           * In case 1, $messages is string
           */
          // Case 2
          if (isset($this->messages[$field][$rule]) && is_array($this->messages[$field])) {
              $messages = $this->messages[$field][$rule];
          // Case 1
          } elseif (isset($this->messages[$field]) && is_scalar($this->messages[$field])) {
              $messages = $this->messages[$field];
          }
  
          // Convert message to array for validator
          if (is_scalar($messages)) {
              $props['message'] =  $messages;
          } elseif (is_array($messages)) {
              foreach ($messages as $name => $message) {
                  $props[$name . 'Message'] = $message;
              }
          }
  
          return $props;
      }
code: protected function prepareProps($field, $rule)
      {
          $props = $messages = array();
  
          $props['plugins/app/js/validation'] = $this;
  
          // Prepare name for validator
          if (isset($this->names[$field])) {
              $props['name'] = $this->names[$field];
          }
  
          /**
           * Prepare messages for validator
           *
           * The messages array may look like below
           * array(
           *     // Case 1
           *     'field' => 'message',
           *     // Case 2
           *     'field2' => array(
           *         'rule' => 'message'
           *     ),
           *     // Case 2
           *     'field3' => array(
           *         'rule' => array(
           *            'option' => 'message',
           *            'option2' => 'message',
           *         )
           *     )
           * )
           *
           * In case 2, checking non-numeric offsets of strings would return true
           * in PHP 5.3, while return false in PHP 5.4, so we do NOT known
           * $messages is array or string
           * @link http://php.net/manual/en/function.isset.php
           *
           * In case 1, $messages is string
           */
          // Case 2
          if (isset($this->messages[$field][$rule]) && is_array($this->messages[$field])) {
              $messages = $this->messages[$field][$rule];
          // Case 1
          } elseif (isset($this->messages[$field]) && is_scalar($this->messages[$field])) {
              $messages = $this->messages[$field];
          }
  
          // Convert message to array for validator
          if (is_scalar($messages)) {
              $props['message'] =  $messages;
          } elseif (is_array($messages)) {
              foreach ($messages as $name => $message) {
                  $props[$name . 'Message'] = $message;
              }
          }
  
          return $props;
      }
code_tokens: protected function prepareProps ( $ field , $ rule ) { $ props = $ messages = array ( ) ; $ props [ 'plugins/app/js/validation' ] = $ this ; // Prepare name for validator if ( isset ( $ this -> names [ $ field ] ) ) { $ props [ 'name' ] = $ this -> names [ $ field ] ; } /**
           * Prepare messages for validator
           *
           * The messages array may look like below
           * array(
           *     // Case 1
           *     'field' => 'message',
           *     // Case 2
           *     'field2' => array(
           *         'rule' => 'message'
           *     ),
           *     // Case 2
           *     'field3' => array(
           *         'rule' => array(
           *            'option' => 'message',
           *            'option2' => 'message',
           *         )
           *     )
           * )
           *
           * In case 2, checking non-numeric offsets of strings would return true
           * in PHP 5.3, while return false in PHP 5.4, so we do NOT known
           * $messages is array or string
           * @link http://php.net/manual/en/function.isset.php
           *
           * In case 1, $messages is string
           */ // Case 2 if ( isset ( $ this -> messages [ $ field ] [ $ rule ] ) && is_array ( $ this -> messages [ $ field ] ) ) { $ messages = $ this -> messages [ $ field ] [ $ rule ] ; // Case 1 } elseif ( isset ( $ this -> messages [ $ field ] ) && is_scalar ( $ this -> messages [ $ field ] ) ) { $ messages = $ this -> messages [ $ field ] ; } // Convert message to array for validator if ( is_scalar ( $ messages ) ) { $ props [ 'message' ] = $ messages ; } elseif ( is_array ( $ messages ) ) { foreach ( $ messages as $ name => $ message ) { $ props [ $ name . 'Message' ] = $ message ; } } return $ props ; }
docstring: Prepare name and messages property option for rule validator
  
  @param string $field
  @param string $rule
  @return array
docstring_tokens: Prepare name and messages property option for rule validator