Documentation is available at CommandFactory.php
- <?php
- /**
- * MVCnPHP - CommandFactory.class.php
- *
- * This source file is subject to version 2.02 of the PHP license,
- * that is bundled with this package in the file LICENSE, and is
- * available at through the world-wide-web at
- * http://www.php.net/license/2_02.txt.
- * If you did not receive a copy of the PHP license and are unable to
- * obtain it through the world-wide-web, please send a note to
- * license@php.net so we can mail you a copy immediately.
- *
- * @author Tony Bibbs <tony@geeklog.net>
- * @copyright Tony Bibbs 2003
- * @package net.geeklog.mvc
- * @version $Id: CommandFactory.class.php,v 1.3 2003/12/09 04:14:08 tony Exp $
- *
- */
- /**
- * This implements the factory design pattern and is
- * responsible for building command objects
- *
- * @author Tony Bibbs <tony@geeklog.net>
- * @package net.geeklog.mvc
- *
- */
- class MVCnPHP_CommandFactory {
- /**
- * Builds the requested command object
- *
- * @author Tony Bibbs <tony@geeklog.net>
- * @access public
- * @param string $path Path to directory holding commands
- * @param string $name Name of command to create
- * @return object Command object
- *
- */
- public function &getCommand($path, $name)
- {
- if (!isset($name)) {
- throw new Exception('No command name given to CommandFactory::getCommand');
- }
- $filename = $path . $name . '.php';
- if (file_exists($filename)) {
- require_once $filename;
- $name = $name;
- return new $name();
- } else {
- throw new Exception('Bad set of parameters to CommandFactory::getCommand');
- }
- }
- }
- ?>
Documentation generated on Mon, 7 Mar 2005 22:36:20 -0600 by phpDocumentor 1.3.0RC3