You are here

public function AbstractOptions::toArray in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-stdlib/src/AbstractOptions.php \Zend\Stdlib\AbstractOptions::toArray()

Cast to array

Return value

array

File

vendor/zendframework/zend-stdlib/src/AbstractOptions.php, line 73

Class

AbstractOptions

Namespace

Zend\Stdlib

Code

public function toArray() {
  $array = [];
  $transform = function ($letters) {
    $letter = array_shift($letters);
    return '_' . strtolower($letter);
  };
  foreach ($this as $key => $value) {
    if ($key === '__strictMode__') {
      continue;
    }
    $normalizedKey = preg_replace_callback('/([A-Z])/', $transform, $key);
    $array[$normalizedKey] = $value;
  }
  return $array;
}