original_string: protected function addElementRules(ElementInterface $element, AttributeCollection $collection)
      {
          if ($element->hasOption('rules') && count($element->getOption('rules'))) {
              $rules = $this->formatter->formatRules($element->getOption('rules'));
              $collection->add(new Attribute('aoRules', $rules, Attribute::TYPE_ARRAY));
          }
      }
code: protected function addElementRules(ElementInterface $element, AttributeCollection $collection)
      {
          if ($element->hasOption('rules') && count($element->getOption('rules'))) {
              $rules = $this->formatter->formatRules($element->getOption('rules'));
              $collection->add(new Attribute('aoRules', $rules, Attribute::TYPE_ARRAY));
          }
      }
code_tokens: protected function addElementRules ( ElementInterface $ element , AttributeCollection $ collection ) { if ( $ element -> hasOption ( 'rules' ) && count ( $ element -> getOption ( 'rules' ) ) ) { $ rules = $ this -> formatter -> formatRules ( $ element -> getOption ( 'rules' ) ) ; $ collection -> add ( new Attribute ( 'aoRules' , $ rules , Attribute :: TYPE_ARRAY ) ) ; } }
docstring: Adds javascript rules to element
  
  @param ElementInterface    $element
  @param AttributeCollection $collection
docstring_tokens: Adds javascript rules to element