public static function to_modifications(array $modified) { foreach ($modified as $key => &$value) { $value = Inflector::humanize($key) . (is_array($value) ? ': ' . Tart_Request::to_modifications($value) : ($value ? ' set to "' . $value . '"' : ' cleared')); } return Tart::to_sentence(array_values($modified)); }
public function test_to_modifications() { $data = array('name' => 'Parent', 'test' => NULL, 'folder' => array('name' => 'Best', 'subtitle' => NULL)); $expected = 'name set to "Parent", test cleared and folder: name set to "Best" and subtitle cleared'; $this->assertEquals($expected, Tart_Request::to_modifications($data)); }