You are here

public function Form::getPhpFiles in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dom-crawler/Form.php \Symfony\Component\DomCrawler\Form::getPhpFiles()

Gets the file field values as PHP.

This method converts fields with the array notation (like foo[bar] to arrays) like PHP does.

Return value

array An array of field values.

File

vendor/symfony/dom-crawler/Form.php, line 163

Class

Form
Form represents an HTML form.

Namespace

Symfony\Component\DomCrawler

Code

public function getPhpFiles() {
  $values = array();
  foreach ($this
    ->getFiles() as $name => $value) {
    $qs = http_build_query(array(
      $name => $value,
    ), '', '&');
    if (!empty($qs)) {
      parse_str($qs, $expandedValue);
      $varName = substr($name, 0, strlen(key($expandedValue)));
      $values = array_replace_recursive($values, array(
        $varName => current($expandedValue),
      ));
    }
  }
  return $values;
}