From fc64ee77dd5a4873871670d2c7a25653138fbee7 Mon Sep 17 00:00:00 2001 From: Gabor de Mooij Date: Tue, 11 Dec 2012 21:57:20 +0100 Subject: [PATCH] Removed some whitespace. --- RedBean/Adapter/DBAdapter.php | 2 +- RedBean/BeanHelper/Facade.php | 2 +- RedBean/Observer.php | 1 - RedBean/QueryWriter.php | 48 +++++------------------------------ RedBean/SQLHelper.php | 17 ------------- RedBean/Setup.php | 14 ---------- RedBean/SimpleModel.php | 8 +----- RedBean/TagManager.php | 16 +----------- RedBean/ToolBox.php | 7 ----- 9 files changed, 10 insertions(+), 105 deletions(-) diff --git a/RedBean/Adapter/DBAdapter.php b/RedBean/Adapter/DBAdapter.php index 34235793d..985f5a224 100755 --- a/RedBean/Adapter/DBAdapter.php +++ b/RedBean/Adapter/DBAdapter.php @@ -195,7 +195,7 @@ public function getAssoc( $sql, $aValues = array() ) { * * @return array $result scalar result set */ - public function getCell( $sql, $aValues = array(), $noSignal = null ) { + public function getCell($sql, $aValues = array(), $noSignal = null) { $this->sql = $sql; if (!$noSignal) $this->signal('sql_exec', $this); $arr = $this->db->getCol( $sql, $aValues ); diff --git a/RedBean/BeanHelper/Facade.php b/RedBean/BeanHelper/Facade.php index 75779b507..b2461ef13 100755 --- a/RedBean/BeanHelper/Facade.php +++ b/RedBean/BeanHelper/Facade.php @@ -40,4 +40,4 @@ public function getModelForBean(RedBean_OODBBean $bean) { $obj->loadBean($bean); return $obj; } -} +} \ No newline at end of file diff --git a/RedBean/Observer.php b/RedBean/Observer.php index afca138c3..397195067 100755 --- a/RedBean/Observer.php +++ b/RedBean/Observer.php @@ -12,7 +12,6 @@ * with this source code in the file license.txt. */ interface RedBean_Observer { - /** * Part of the RedBean Observer Infrastructure. * The on-event method is called by an observable once the diff --git a/RedBean/QueryWriter.php b/RedBean/QueryWriter.php index bdc6a6a46..be021ffe2 100755 --- a/RedBean/QueryWriter.php +++ b/RedBean/QueryWriter.php @@ -17,41 +17,28 @@ * - This is the interface for FLUID database drivers. Drivers intended to support * just FROZEN mode should implement the IceWriter instead. * - * * copyright (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community. * This source file is subject to the BSD/GPLv2 License that is bundled * with this source code in the file license.txt. */ interface RedBean_QueryWriter { - /** - * QueryWriter Constant Identifier. - * Identifies a situation in which a table has not been found in - * the database. + * Query Writer constants. + * These constants are used to identify common SQL problems. + * These are used for FLUID-mode to determine whether we should throw + * an exception or not. In FLUID-mode some errors are allowed; for instance, + * if a column does not exist: C_SQLSTATE_NO_SUCH_COLUMN this is no reason + * to throw an error because in FLUID mode we build the schema on the fly.. */ const C_SQLSTATE_NO_SUCH_TABLE = 1; - - /** - * QueryWriter Constant Identifier. - * Identifies a situation in which a perticular column has not - * been found in the database. - */ const C_SQLSTATE_NO_SUCH_COLUMN = 2; - - /** - * QueryWriter Constant Identifier. - * Identifies a situation in which a perticular column has not - * been found in the database. - */ const C_SQLSTATE_INTEGRITY_CONSTRAINT_VIOLATION = 3; - /** * Returns the tables that are in the database. * * @return array $arrayOfTables list of tables */ public function getTables(); - /** * This method should create a table for the bean. * This methods accepts a type and infers the corresponding table name. @@ -61,7 +48,6 @@ public function getTables(); * @return void */ public function createTable($type); - /** * Returns an array containing all the columns of the specified type. * The format of the return array looks like this: @@ -75,8 +61,6 @@ public function createTable($type); * @return array $listOfColumns list of columns ($field=>$type) */ public function getColumns($type); - - /** * Returns the Column Type Code (integer) that corresponds * to the given value type. This method is used to determine the minimum @@ -87,7 +71,6 @@ public function getColumns($type); * @return integer $type type */ public function scanType($value, $alsoScanSpecialForTypes=false); - /** * This method should add a column to a table. * This methods accepts a type and infers the corresponding table name. @@ -100,7 +83,6 @@ public function scanType($value, $alsoScanSpecialForTypes=false); * */ public function addColumn($type, $column, $field); - /** * This method should return a data type constant based on the * SQL type definition. This function is meant to compare column data @@ -112,7 +94,6 @@ public function addColumn($type, $column, $field); * @return integer $type */ public function code($typedescription); - /** * This method should widen the column to the specified data type. * This methods accepts a type and infers the corresponding table name. @@ -124,7 +105,6 @@ public function code($typedescription); * @return void */ public function widenColumn($type, $column, $datatype); - /** * This method should update (or insert a record), it takes * a table name, a list of update values ( $field => $value ) and an @@ -140,8 +120,6 @@ public function widenColumn($type, $column, $datatype); * @return integer $id the primary key ID value of the new record */ public function updateRecord($type, $updatevalues, $id=null); - - /** * This method should select a record. You should be able to provide a * collection of conditions using the following format: @@ -161,8 +139,6 @@ public function updateRecord($type, $updatevalues, $id=null); * @return array $records selected records */ public function selectRecord($type, $conditions, $addSql = null, $delete = false, $inverse = false); - - /** * This method should add a UNIQUE constraint index to a table on columns $columns. * This methods accepts a type and infers the corresponding table name. @@ -173,8 +149,6 @@ public function selectRecord($type, $conditions, $addSql = null, $delete = false * @return void */ public function addUniqueIndex($type,$columns); - - /** * This method should check whether the SQL state is in the list of specified states * and returns true if it does appear in this list or false if it @@ -188,7 +162,6 @@ public function addUniqueIndex($type,$columns); * @return boolean $isInList */ public function sqlStateIn( $state, $list ); - /** * This method should remove all beans of a certain type. * This methods accepts a type and infers the corresponding table name. @@ -198,7 +171,6 @@ public function sqlStateIn( $state, $list ); * @return void */ public function wipe($type); - /** * This method should count the number of beans of the given type. * This methods accepts a type and infers the corresponding table name. @@ -208,7 +180,6 @@ public function wipe($type); * @return integer $numOfBeans number of beans found */ public function count($type); - /** * This method should filter a column name so that it can * be used safely in a query for a specific database. @@ -219,7 +190,6 @@ public function count($type); * @return string $clean the clean version of the column name */ public function safeColumn($name, $noQuotes = false); - /** * This method should filter a type name so that it can * be used safely in a query for a specific database. It actually @@ -231,7 +201,6 @@ public function safeColumn($name, $noQuotes = false); * @return string $tablename clean table name for use in query */ public function safeTable($name, $noQuotes = false); - /** * This method should add a constraint. If one of the beans gets trashed * the other, related bean should be removed as well. @@ -242,7 +211,6 @@ public function safeTable($name, $noQuotes = false); * @return void */ public function addConstraint( RedBean_OODBBean $bean1, RedBean_OODBBean $bean2 ); - /** * This method should add a foreign key from type and field to * target type and target field. @@ -261,8 +229,6 @@ public function addConstraint( RedBean_OODBBean $bean1, RedBean_OODBBean $bean2 * @return void */ public function addFK( $type, $targetType, $field, $targetField); - - /** * This method should add an index to a type and field with name * $name. @@ -275,7 +241,6 @@ public function addFK( $type, $targetType, $field, $targetField); * @return void */ public function addIndex($type, $name, $column); - /** * Returns a modified value from ScanType. * Used for special types. @@ -283,5 +248,4 @@ public function addIndex($type, $name, $column); * @return mixed $value changed value */ public function getValue(); - } \ No newline at end of file diff --git a/RedBean/SQLHelper.php b/RedBean/SQLHelper.php index 558b53204..549423616 100644 --- a/RedBean/SQLHelper.php +++ b/RedBean/SQLHelper.php @@ -28,31 +28,26 @@ * with this source code in the file license.txt. */ class RedBean_SQLHelper { - /** * Holds the database adapter for executing SQL queries. * @var RedBean_Adapter */ protected $adapter; - /** * Holds current mode * @var boolean */ protected $capture = false; - /** * Holds SQL until now * @var string */ protected $sql = ''; - /** * Holds list of parameters for SQL Query * @var array */ protected $params = array(); - /** * Constructor * @@ -61,7 +56,6 @@ class RedBean_SQLHelper { public function __construct(RedBean_Adapter $adapter) { $this->adapter = $adapter; } - /** * Magic method to construct SQL query * @@ -80,7 +74,6 @@ public function __call($funcName,$args=array()) { return $this->adapter->getCell('SELECT '.$funcName.'('.implode(',',$args).')'); } } - /** * Begins SQL query * @@ -90,7 +83,6 @@ public function begin() { $this->capture = true; return $this; } - /** * Adds a value to the parameter list * @@ -102,7 +94,6 @@ public function put($param) { $this->params[] = $param; return $this; } - /** * Executes query and returns result * @@ -114,7 +105,6 @@ public function get($what='') { $this->clear(); return $rs; } - /** * Clears the parameter list as well as the SQL query string. * @@ -126,7 +116,6 @@ public function clear() { $this->capture = false; //turn off capture mode (issue #142) return $this; } - /** * To explicitly add a piece of SQL. * @@ -140,8 +129,6 @@ public function addSQL($sql) { return $this; } } - - /** * Returns query parts. * @@ -152,7 +139,6 @@ public function getQuery() { $this->clear(); return $list; } - /** * Writes a '(' to the sql query. */ @@ -162,7 +148,6 @@ public function open() { return $this; } } - /** * Writes a ')' to the sql query. */ @@ -172,7 +157,6 @@ public function close() { return $this; } } - /** * Generates question mark slots for an array of values. * @@ -188,5 +172,4 @@ public function genSlots($array) { return ''; } } - } \ No newline at end of file diff --git a/RedBean/Setup.php b/RedBean/Setup.php index f5d9e95e5..daa240cad 100755 --- a/RedBean/Setup.php +++ b/RedBean/Setup.php @@ -13,7 +13,6 @@ * with this source code in the file license.txt. */ class RedBean_Setup { - /** * This method checks the DSN string. If the DSN string contains a * database name that is not supported by RedBean yet then it will @@ -39,23 +38,10 @@ private static function checkDSN($dsn) { return true; } } - - /** * Generic Kickstart method. * This is the generic kickstarter. It will prepare a database connection * using the $dsn, the $username and the $password you provide. - * If $frozen is boolean TRUE it will start RedBean in frozen mode, meaning - * that the database cannot be altered. If RedBean is started in fluid mode - * it will adjust the schema of the database if it detects an - * incompatible bean. - * This method returns a RedBean_Toolbox $toolbox filled with a - * RedBean_Adapter, a RedBean_QueryWriter and most importantly a - * RedBean_OODB; the object database. To start storing beans in the database - * simply say: $redbean = $toolbox->getRedBean(); Now you have a reference - * to the RedBean object. - * Optionally instead of using $dsn you may use an existing PDO connection. - * Example: RedBean_Setup::kickstart($existingConnection, true); * * @param string|PDO $dsn Database Connection String (or PDO instance) * @param string $username Username for database diff --git a/RedBean/SimpleModel.php b/RedBean/SimpleModel.php index ac820fcc6..eb1cf3a68 100755 --- a/RedBean/SimpleModel.php +++ b/RedBean/SimpleModel.php @@ -1,6 +1,7 @@ bean = $bean; } - /** * Magic Getter to make the bean properties available from * the $this-scope. @@ -40,7 +39,6 @@ public function loadBean( RedBean_OODBBean $bean ) { public function __get( $prop ) { return $this->bean->$prop; } - /** * Magic Setter * @@ -50,7 +48,6 @@ public function __get( $prop ) { public function __set( $prop, $value ) { $this->bean->$prop = $value; } - /** * Isset implementation * @@ -61,7 +58,6 @@ public function __set( $prop, $value ) { public function __isset($key) { return (isset($this->bean->$key)); } - /** * Box the bean using the current model. * @@ -70,7 +66,6 @@ public function __isset($key) { public function box() { return $this; } - /** * Unbox the bean from the model. * @@ -79,5 +74,4 @@ public function box() { public function unbox(){ return $this->bean; } - } \ No newline at end of file diff --git a/RedBean/TagManager.php b/RedBean/TagManager.php index f0d71f86c..3ece63bf8 100644 --- a/RedBean/TagManager.php +++ b/RedBean/TagManager.php @@ -15,28 +15,25 @@ * with this source code in the file license.txt. */ class RedBean_TagManager { - /** * The Tag Manager requires a toolbox * @var RedBean_Toolbox */ protected $toolbox; - /** * Association Manager to manage tag-bean relations * @var RedBean_AssociationManager */ protected $associationManager; - /** * RedBeanPHP OODB instance * @var RedBean_OODBBean */ protected $redbean; - /** * Constructor, * creates a new instance of TagManager. + * * @param RedBean_Toolbox $toolbox */ public function __construct( RedBean_Toolbox $toolbox ) { @@ -44,7 +41,6 @@ public function __construct( RedBean_Toolbox $toolbox ) { $this->redbean = $toolbox->getRedBean(); $this->associationManager = $this->redbean->getAssociationManager(); } - /** * Finds a tag bean by it's title. * @@ -60,7 +56,6 @@ public function findTagByTitle($title) { } return null; } - /** * Part of RedBeanPHP Tagging API. * Tests whether a bean has been associated with one ore more @@ -88,7 +83,6 @@ public function hasTag($bean, $tags, $all=false) { } /** - * Part of RedBeanPHP Tagging API. * Removes all sepcified tags from the bean. The tags specified in * the second parameter will no longer be associated with the bean. * @@ -105,9 +99,7 @@ public function untag($bean,$tagList) { } } } - /** - * Part of RedBeanPHP Tagging API. * Tags a bean or returns tags associated with a bean. * If $tagList is null or omitted this method will return a * comma separated list of tags associated with the bean provided. @@ -136,9 +128,7 @@ public function tag( RedBean_OODBBean $bean, $tagList = null ) { $this->associationManager->clearRelations( $bean, 'tag' ); $this->addTags( $bean, $tagList ); } - /** - * Part of RedBeanPHP Tagging API. * Adds tags to a bean. * If $tagList is a comma separated list of tags all tags will * be associated with the bean. @@ -161,9 +151,7 @@ public function addTags( RedBean_OODBBean $bean, $tagList ) { $this->associationManager->associate( $bean, $t ); } } - /** - * Part of RedBeanPHP Tagging API. * Returns all beans that have been tagged with one of the tags given. * * @param $beanType type of bean you are looking for @@ -183,7 +171,6 @@ public function tagged( $beanType, $tagList ) { } return $collection; } - /** * Part of RedBeanPHP Tagging API. * Returns all beans that have been tagged with ALL of the tags given. @@ -203,5 +190,4 @@ public function taggedAll( $beanType, $tagList ) { } return $beans; } - } \ No newline at end of file diff --git a/RedBean/ToolBox.php b/RedBean/ToolBox.php index 7f6cccfa1..3e800126e 100755 --- a/RedBean/ToolBox.php +++ b/RedBean/ToolBox.php @@ -19,25 +19,21 @@ * with this source code in the file license.txt. */ class RedBean_ToolBox { - /** * Reference to the RedBeanPHP OODB Object Database instance * @var RedBean_OODB */ protected $oodb; - /** * Reference to the Query Writer * @var RedBean_QueryWriter */ protected $writer; - /** * Reference to the database adapter * @var RedBean_Adapter_DBAdapter */ protected $adapter; - /** * Constructor. * The Constructor of the ToolBox takes three arguments: a RedBean_OODB $redbean @@ -58,7 +54,6 @@ public function __construct(RedBean_OODB $oodb,RedBean_Adapter $adapter,RedBean_ $this->writer = $writer; return $this; } - /** * The Toolbox acts as a kind of micro service locator, providing just the * most important objects that make up RedBean. You can pass the toolkit to @@ -72,7 +67,6 @@ public function __construct(RedBean_OODB $oodb,RedBean_Adapter $adapter,RedBean_ public function getWriter() { return $this->writer; } - /** * The Toolbox acts as a kind of micro service locator, providing just the * most important objects that make up RedBean. You can pass the toolkit to @@ -86,7 +80,6 @@ public function getWriter() { public function getRedBean() { return $this->oodb; } - /** * The Toolbox acts as a kind of micro service locator, providing just the * most important objects that make up RedBean. You can pass the toolkit to