[Solar-svn] Revision 2846
pmjones at solarphp.com
pmjones at solarphp.com
Sun Oct 7 17:09:11 CDT 2007
updated comments
Modified: trunk/Solar/App/Bookmarks.php
===================================================================
--- trunk/Solar/App/Bookmarks.php 2007-10-07 15:49:44 UTC (rev 2845)
+++ trunk/Solar/App/Bookmarks.php 2007-10-07 22:09:11 UTC (rev 2846)
@@ -187,8 +187,22 @@
*/
public $user;
+ /**
+ *
+ * Bookmarks model.
+ *
+ * @var Solar_Model_Nodes_Bookmarks
+ *
+ */
protected $_bookmarks;
+ /**
+ *
+ * Tags model.
+ *
+ * @var Solar_Model_Tags
+ *
+ */
protected $_tags;
/**
@@ -545,7 +559,7 @@
*
* Shows a list of bookmarks filtered by tag, regardless of owner.
*
- * @param string|array $tags The tags to show; either a space- (or
+ * @param string|array $tag_list The tags to show; either a space- (or
* plus-) separated list of tags, or a sequential array of tags.
*
* @return void
Modified: trunk/Solar/Cli/Base.php
===================================================================
--- trunk/Solar/Cli/Base.php 2007-10-07 15:49:44 UTC (rev 2845)
+++ trunk/Solar/Cli/Base.php 2007-10-07 22:09:11 UTC (rev 2846)
@@ -1,10 +1,37 @@
<?php
-class Solar_Cli_Base extends Solar_Controller_Command {
+/**
+ *
+ * Base Solar command class.
+ *
+ * @category Solar
+ *
+ * @package Solar_Cli
+ *
+ * @author Paul M. Jones <pmjones at solarphp.com>
+ *
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ *
+ * @version $Id: Auth.php 2428 2007-04-02 00:44:19Z pmjones $
+ *
+ */
+
+/**
+ *
+ * Base Solar command class.
+ *
+ * @category Solar
+ *
+ * @package Solar_Cli
+ *
+ */
+abstract class Solar_Cli_Base extends Solar_Controller_Command {
/**
*
* Displays a "command not recognized" message.
*
+ * Extends this class and override _exec() to get real functionality.
+ *
* @param string $cmd The requested command.
*
* @return void
Modified: trunk/Solar/Cli/Help.php
===================================================================
--- trunk/Solar/Cli/Help.php 2007-10-07 15:49:44 UTC (rev 2845)
+++ trunk/Solar/Cli/Help.php 2007-10-07 22:09:11 UTC (rev 2846)
@@ -1,6 +1,41 @@
<?php
+/**
+ *
+ * Solar "help" command.
+ *
+ * @category Solar
+ *
+ * @package Solar_Cli
+ *
+ * @author Paul M. Jones <pmjones at solarphp.com>
+ *
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ *
+ * @version $Id: Auth.php 2428 2007-04-02 00:44:19Z pmjones $
+ *
+ */
+
+/**
+ *
+ * Solar "help" command.
+ *
+ * @category Solar
+ *
+ * @package Solar_Cli
+ *
+ */
class Solar_Cli_Help extends Solar_Cli_Base {
+ /**
+ *
+ * Displays a list of help options for a command, or the list of commands
+ * if no command was requested.
+ *
+ * @param string $cmd The requested command.
+ *
+ * @return void
+ *
+ */
protected function _exec($cmd = null)
{
if ($cmd) {
@@ -10,6 +45,16 @@
}
}
+ /**
+ *
+ * Displays a list of help options for a command, or the list of commands
+ * if no command was requested.
+ *
+ * @param string $cmd The requested command.
+ *
+ * @return void
+ *
+ */
protected function _displayCommandHelp($cmd = null)
{
$this->_println();
@@ -49,6 +94,15 @@
}
}
+ /**
+ *
+ * Displays a list of available commands.
+ *
+ * @param string $cmd The requested command.
+ *
+ * @return void
+ *
+ */
protected function _displayCommandList()
{
$this->_println($this->getInfoHelp());
Modified: trunk/Solar/Cli/MakeModel.php
===================================================================
--- trunk/Solar/Cli/MakeModel.php 2007-10-07 15:49:44 UTC (rev 2845)
+++ trunk/Solar/Cli/MakeModel.php 2007-10-07 22:09:11 UTC (rev 2846)
@@ -1,17 +1,64 @@
<?php
+/**
+ *
+ * Solar command to make a model class from an SQL table.
+ *
+ * @category Solar
+ *
+ * @package Solar_Cli
+ *
+ * @author Paul M. Jones <pmjones at solarphp.com>
+ *
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ *
+ * @version $Id: Auth.php 2428 2007-04-02 00:44:19Z pmjones $
+ *
+ */
+
+/**
+ *
+ * Solar command to make a model class from an SQL table.
+ *
+ * @category Solar
+ *
+ * @package Solar_Cli
+ *
+ */
class Solar_Cli_MakeModel extends Solar_Controller_Command {
+ /**
+ *
+ * The base directory where we will write the class file to, typically
+ * the local PEAR directory.
+ *
+ * @var string
+ *
+ */
protected $_target = null;
+ /**
+ *
+ * The table name we're making the model from.
+ *
+ * @var string
+ *
+ */
protected $_table = null;
+ /**
+ *
+ * Array of model-class templates (skeletons).
+ *
+ * @var array
+ *
+ */
protected $_tpl = array();
/**
*
- * Displays a "command not recognized" message.
+ * Write out a series of model, record, and collection classes for a model.
*
- * @param string $cmd The requested command.
+ * @param string $class The target class name for the model.
*
* @return void
*
@@ -33,7 +80,7 @@
// emit feedback
$this->_println("Using table '{$this->_table}'.");
- $this->_println("Writing to '$class' to '{$this->_target}'.");
+ $this->_println("Writing '$class' to '{$this->_target}'.");
// load the templates
$this->_loadTemplates();
@@ -119,6 +166,13 @@
$this->_println("Done.");
}
+ /**
+ *
+ * Loads the template array from skeleton files.
+ *
+ * @return void
+ *
+ */
protected function _loadTemplates()
{
$this->_tpl = array();
@@ -130,6 +184,13 @@
}
}
+ /**
+ *
+ * Sets the base directory target.
+ *
+ * @return void
+ *
+ */
protected function _setTarget()
{
$target = $this->_options['target'];
@@ -142,6 +203,16 @@
$this->_target = Solar::fixdir($target);
}
+ /**
+ *
+ * Sets the table name; determines from the class name if no table name is
+ * given.
+ *
+ * @param string $class The class name for the model.
+ *
+ * @return void
+ *
+ */
protected function _setTable($class)
{
$table = $this->_options['table'];
@@ -161,6 +232,14 @@
$this->_table = $table;
}
+ /**
+ *
+ * Gets the SQL connection parameters from the command line options.
+ *
+ * @return array An array of SQL connection parameters suitable for
+ * passing as a Solar_Sql_Adapter class config.
+ *
+ */
protected function _getSqlConfig()
{
$config = array();
Modified: trunk/Solar/Cli/MakeTests.php
===================================================================
--- trunk/Solar/Cli/MakeTests.php 2007-10-07 15:49:44 UTC (rev 2845)
+++ trunk/Solar/Cli/MakeTests.php 2007-10-07 22:09:11 UTC (rev 2846)
@@ -62,16 +62,61 @@
*/
class Solar_Cli_MakeTests extends Solar_Cli_Base {
- protected $_tpl; // templates for classes and methods
+ /**
+ *
+ * Skeleton templates for classes and methods.
+ *
+ * @var array
+ *
+ */
+ protected $_tpl;
- protected $_class; // the source class to work with
+ /**
+ *
+ * The source class to work with
+ *
+ * @var string
+ *
+ */
+ protected $_class;
- protected $_target; // the target directory for writing tests
+ /**
+ *
+ * The target directory for writing tests
+ *
+ * @var string
+ *
+ */
+ protected $_target;
- protected $_file; // name of the test file to work with
+ /**
+ *
+ * Name of the test file to work with.
+ *
+ * @var string
+ *
+ */
+ protected $_file;
- protected $_code; // the code in the test file
+ /**
+ *
+ * The code in the test file.
+ *
+ * @var string
+ *
+ */
+ protected $_code;
+ /**
+ *
+ * Builds one or more test files starting at the requested class, usually
+ * descending recursively into subdirectories of that class.
+ *
+ * @param string $class The class name to build tests for.
+ *
+ * @return void
+ *
+ */
protected function _exec($class = null)
{
$this->_println("Making tests.");
@@ -133,6 +178,13 @@
$this->_println('Done.');
}
+ /**
+ *
+ * Loads the template array from skeleton files.
+ *
+ * @return void
+ *
+ */
protected function _loadTemplates()
{
$this->_tpl = array();
@@ -144,6 +196,13 @@
}
}
+ /**
+ *
+ * Sets the base directory target.
+ *
+ * @return void
+ *
+ */
protected function _setTarget()
{
// look for a test directory, otherwise assume that the tests are
@@ -162,6 +221,22 @@
}
}
+ /**
+ *
+ * Sets the file name for the test file, creating it if needed.
+ *
+ * Uses a different class template for abstract, factory, and normal
+ * (concrete) classes. Also looks to see if this is an Adapter-based
+ * class and takes that into account.
+ *
+ * @param string $class The class name to work with.
+ *
+ * @param array $api The list of methods in the class API to write test
+ * stubs for.
+ *
+ * @return void
+ *
+ */
protected function _setFile($class, $api)
{
$this->_file = $this->_target
@@ -211,6 +286,17 @@
file_put_contents($this->_file, $code);
}
+
+ /**
+ *
+ * Adds test methods to the code for a test file.
+ *
+ * @param array $api The list of methods in the class API to write test
+ * stubs for.
+ *
+ * @return void
+ *
+ */
protected function _addTestMethods($api)
{
// prepare the testing code for appending new methods.
@@ -277,6 +363,6 @@
}
// append the last brace
- $this->_code .= "\n}\n";
+ $this->_code = trim($this->_code) . "\n}\n";
}
}
Modified: trunk/Solar/Cli/RunTests.php
===================================================================
--- trunk/Solar/Cli/RunTests.php 2007-10-07 15:49:44 UTC (rev 2845)
+++ trunk/Solar/Cli/RunTests.php 2007-10-07 22:09:11 UTC (rev 2846)
@@ -74,6 +74,16 @@
*/
class Solar_Cli_RunTests extends Solar_Cli_Base {
+ /**
+ *
+ * Runs the tests for a class, descending into subdirectories unless
+ * otherwise specified.
+ *
+ * @param string $class The class to run tests for.
+ *
+ * @return void
+ *
+ */
protected function _exec($class = null)
{
// look for a test directory, otherwise assume that the tests are
More information about the Solar-svn
mailing list