arrToLower() public static method

Change keys and values case to lower
public static arrToLower ( array $array ) : array
$array array
return array
Exemplo n.º 1
0
 /**
  * Delete fields from array
  * @param array $fields Indexed array
  */
 public function deleteFields(array $fields)
 {
     $fields = Helpers\Validate::arrToLower($fields);
     Helpers\Validate::table($this->name)->fields($fields);
     $config = $this->config();
     $config->schema = array_diff_key($this->schema(), array_flip($fields));
     $data = $this->getData();
     foreach ($data as $key => $object) {
         foreach ($fields as $name) {
             unset($data[$key]->{$name});
         }
     }
     Helpers\Data::table($this->name)->put($data);
     Helpers\Config::table($this->name)->put($config);
 }
Exemplo n.º 2
0
 /**
  * @covers Lazer\Classes\Helpers\Validate::arrToLower
  */
 public function testArrToLower()
 {
     $array = $this->object->arrToLower(['String1', 'StRIng2']);
     $this->assertSame(['string1', 'string2'], $array);
 }