$directory) { // When adding new namespaces to the mappings, we will unset the previously // mapped value if it existed. This allows previously registered spaces to // be mapped to new directories on the fly. $namespace = trim($namespace, $append).$append; unset(static::$namespaces[$namespace]); $namespaces[$namespace] = head(static::format($directory)); } return $namespaces; } /** * Format an array of directories with the proper trailing slashes. * * @param array $directories * @return array */ protected static function format($directories) { return array_map(function($directory) { return rtrim($directory, DS).DS; }, (array) $directories); } }