protected function loadControlsFrom($frags) { if (!is_string($frags) or $frags == '') { throw new BadMethodCallException("Provide path components in a space separated list", 1); } $frags = explode(' ', trim($frags)); $pathfrags = array($this->_includesPath); foreach ($frags as $frag) { array_push($pathfrags, $frag); } $controlsFolder = implode(DIRECTORY_SEPARATOR, $pathfrags); // fetch all *Control.php in the controls folder foreach (glob($controlsFolder . '/*CustomControl.php') as $fileName) { // MultiImageControl.php will have a slug of 'multi-image' $slug = tad_Str::hyphen(preg_replace('/CustomControl/', '', basename($fileName, '.php'))); // store the controls that come with the library // again presumin PSR-o compliancy the class name will be the same // as the filename $this->customControls[$slug] = implode('\\', $frags) . '\\' . basename($fileName, '.php'); } }