Exemplo n.º 1
0
 /**
  * Process data
  *
  * @param array $data Data
  *
  * @return int
  * @throws \InvalidArgumentException
  */
 protected function processData(array &$data)
 {
     $max = null;
     foreach ($data as $value) {
         $depth = Arr::depth($value) + 1;
         if ($max === null) {
             $max = $depth;
         } elseif ($depth !== $max) {
             throw new \InvalidArgumentException('Rendering INI format requires array in which all elements have with same complexity.');
         }
     }
     $max = (int) $max;
     if ($max > 2) {
         throw new \InvalidArgumentException('Rendering INI format expects only 1 or 2 dimensional array.');
     }
     return $max;
 }