public function testConvertPathToClassNameWhenProvidingNestedNamespaces() { $file = "./test/ODM/Document/Stub/City.php"; $namespace = "test\ODM"; $className = String::convertPathToClassName($file, $namespace); $this->assertEquals('\test\ODM\Document\Stub\City', $className); }
public static function format(array $values) { if (count($values)) { return String::filterNonSQLChars(array_shift($values)) . "."; } return null; }
public static function format(array $values) { $string = ""; foreach ($values as $key => $update) { $key = String::filterNonSQLChars($key); if ($key) { $string .= ' ' . $key . ' = "' . addslashes($update) . '",'; } } return substr($string, 0, strlen($string) - 1); }
public static function format(array $values) { $rids = array(); foreach ($values as $key => $value) { $key = String::filterNonSQLChars($key); $validator = new RidValidator; $rid = $validator->check($value, true); if ($key && $rid) { $rids[$key] = "$key = " . $rid; } } return count($rids) ? self::implode($rids) : null; }
public static function format(array $values) { $updates = array(); $validator = new RidValidator; foreach ($values as $map => $update) { $map = String::filterNonSQLChars($map); if ($map && is_array($update)) { foreach ($update as $key => $rid) { $rid = $validator->check($rid, true); $key = String::filterNonSQLChars($key); } $updates[$map] = "$map = '$key', $rid"; } } return count($updates) ? self::implode($updates) : null; }
/** * Filters the array values leaving intact regular characters a-z and * integers. * * @param array $values * @return array */ protected static function filterRegularChars(array $values, $nonFilter = null) { return array_map(function ($arr) use ($nonFilter) { return String::filterNonSQLChars($arr, $nonFilter); }, $values); }