src/ScContent/Service/Dir.php
public function setModule($namespace)
    {
        $nsParts = explode('\\', $namespace);
        $moduleClass = $nsParts[0] . '\Module';

        if (! class_exists($moduleClass, true)) {
            throw new InvalidArgumentException(sprintf(
                "The Module class was not found in the '%s' namespace.",
                $namespace
            ));
        }

        $module = new $moduleClass();

        /* Recommended.
         * If you Module class extends 'ZfcBase\Module\AbstractModule'.
         */
        if ($module instanceof AbstractModule) {
            $this->moduleDir = realpath($module->getDir());
            return $this;
        }

        /* Otherwise - get a path using of Reflection.
         */
        $reflection = new ReflectionClass($module);

        $this->moduleDir = realpath(dirname($reflection->getFileName()));
        return $this;
    }
public function setModule($namespace)
    {
        $nsParts = explode('\\', $namespace);
        $moduleClass = $nsParts[0] . '\Module';

        if (! class_exists($moduleClass, true)) {
            throw new InvalidArgumentException(sprintf(
                "The Module class was not found in the '%s' namespace.",
                $namespace
            ));
        }

        $module = new $moduleClass();

        /* Recommended.
         * If you Module class extends 'ZfcBase\Module\AbstractModule'.
         */
        if ($module instanceof AbstractModule) {
            $this->moduleDir = realpath($module->getDir());
            return $this;
        }

        /* Otherwise - get a path using of Reflection.
         */
        $reflection = new ReflectionClass($module);

        $this->moduleDir = realpath(dirname($reflection->getFileName()));
        return $this;
    }
public function setModule ( $ namespace ) { $ nsParts = explode ( '\\' , $ namespace ) ; $ moduleClass = $ nsParts [ 0 ] . '\Module' ; if ( ! class_exists ( $ moduleClass , true ) ) { throw new InvalidArgumentException ( sprintf ( "The Module class was not found in the '%s' namespace." , $ namespace ) ) ; } $ module = new $ moduleClass ( ) ; /* Recommended.
         * If you Module class extends 'ZfcBase\Module\AbstractModule'.
         */ if ( $ module instanceof AbstractModule ) { $ this -> moduleDir = realpath ( $ module -> getDir ( ) ) ; return $ this ; } /* Otherwise - get a path using of Reflection.
         */ $ reflection = new ReflectionClass ( $ module ) ; $ this -> moduleDir = realpath ( dirname ( $ reflection -> getFileName ( ) ) ) ; return $ this ; }
Allows you to change the module.
The root directory of the module is calculated as the directory,
that contains the file of the Module class.

Usage:
<code>
$scDir = $serviceLocator->get('ScService.Dir');
$dir = clone($scDir);
$dir->setModule('MyModuleNamespace');
$myModuleConfigFile = $dir->module('/config/module.config.php');
$myModuleDataDir = $dir->module('/data');
</code>

@api

@param  string $namespace
@throws \ScContent\Exception\InvalidArgumentException
@return \ScContent\Service\Dir
Allows you to change the module . The root directory of the module is calculated as the directory that contains the file of the Module class .