예제 #1
0
 /**
  * @param ElementInterface $element
  * @param string[] $fields
  *
  * @return ElementInterface|null
  */
 private function getFormWithFields(ElementInterface $element, array $fields)
 {
     /** @var NodeElement[] $forms */
     $forms = $element->findAll('css', 'form');
     foreach ($forms as $form) {
         $found = true;
         foreach ($fields as $field) {
             if (null === $form->findField($field)) {
                 $found = false;
             }
         }
         if ($found) {
             return $form;
         }
     }
     return null;
 }