adds comments for phpDoc

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10739 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2012-05-25 10:14:48 +00:00
parent 94be154d88
commit c65e9d3071
29 changed files with 1701 additions and 583 deletions

View file

@ -1,9 +1,26 @@
<?php
/**
* @author NHN (developers@xpressengine.com)
* @package /classes/db/queryparts/condition
* @version 0.1
*/
class Condition {
/**
* column name
* @var string
*/
var $column_name;
var $argument;
/**
* operation can use 'equal', 'more', 'excess', 'less', 'below', 'like_tail', 'like_prefix', 'like', 'notlike_tail',
* 'notlike_prefix', 'notlike', 'in', 'notin', 'and', 'or', 'xor', 'not', 'notequal', 'between'
* @var string
*/
var $operation;
/**
* pipe can use 'and', 'or'...
* @var string
*/
var $pipe;
var $_value;
@ -11,6 +28,14 @@
var $_show;
var $_value_to_string;
/**
* constructor
* @param string $column_name
* @param mixed $argument
* @param string $operation
* @param string $pipe
* @return void
*/
function Condition($column_name, $argument, $operation, $pipe){
$this->column_name = $column_name;
$this->argument = $argument;
@ -23,6 +48,11 @@
return null;
}
/**
* value to string
* @param boolean $withValue
* @return string
*/
function toString($withValue = true){
if (!isset($this->_value_to_string)) {
if (!$this->show())
@ -41,10 +71,18 @@
return $this->_value_to_string;
}
/**
* change string without value
* @return string
*/
function toStringWithoutValue(){
return $this->pipe . ' ' . $this->getConditionPart($this->_value);
}
/**
* change string with value
* @return string
*/
function toStringWithValue(){
return $this->pipe . ' ' . $this->getConditionPart($this->_value);
}
@ -53,6 +91,9 @@
$this->pipe = $pipe;
}
/**
* @return boolean
*/
function show(){
if(!isset($this->_show)){
if(is_array($this->_value) && count($this->_value) === 1 && $this->_value[0] === '') {
@ -93,6 +134,11 @@
return $this->_show;
}
/**
* Return condition string
* @param int|string|array $value
* @return string
*/
function getConditionPart($value) {
$name = $this->column_name;
$operation = $this->operation;

View file

@ -1,12 +1,30 @@
<?php
/**
* @author NHN (developers@xpressengine.com)
* @package /classes/db/queryparts/condition
* @version 0.1
*/
class ConditionGroup {
/**
* condition list
* @var array
*/
var $conditions;
/**
* pipe can use 'and', 'or'...
* @var string
*/
var $pipe;
var $_group;
var $_show;
/**
* constructor
* @param array $conditions
* @param string $pipe
* @return void
*/
function ConditionGroup($conditions, $pipe = "") {
$this->conditions = array();
foreach($conditions as $condition){
@ -28,6 +46,11 @@
$this->pipe = $pipe;
}
/**
* value to string
* @param boolean $with_value
* @return string
*/
function toString($with_value = true){
if(!isset($this->_group)){
$cond_indx = 0;
@ -48,6 +71,10 @@
return $this->_group;
}
/**
* return argument list
* @return array
*/
function getArguments(){
$args = array();
foreach($this->conditions as $condition){
@ -57,4 +84,4 @@
return $args;
}
}
?>
?>

View file

@ -1,7 +1,19 @@
<?php
/**
* @author NHN (developers@xpressengine.com)
* @package /classes/db/queryparts/condition
* @version 0.1
*/
class ConditionSubquery extends Condition {
/**
* constructor
* @param string $column_name
* @param mixed $argument
* @param string $operation
* @param string $pipe
* @return void
*/
function ConditionSubquery($column_name, $argument, $operation, $pipe = ""){
parent::Condition($column_name, $argument, $operation, $pipe);
$this->_value = $this->argument->toString();

View file

@ -1,7 +1,19 @@
<?php
/**
* @author NHN (developers@xpressengine.com)
* @package /classes/db/queryparts/condition
* @version 0.1
*/
class ConditionWithArgument extends Condition {
/**
* constructor
* @param string $column_name
* @param mixed $argument
* @param string $operation
* @param string $pipe
* @return void
*/
function ConditionWithArgument($column_name, $argument, $operation, $pipe = ""){
if($argument === null) { $this->_show = false; return; }
parent::Condition($column_name, $argument, $operation, $pipe);
@ -13,6 +25,10 @@
return $this->argument;
}
/**
* change string without value
* @return string
*/
function toStringWithoutValue(){
$value = $this->argument->getUnescapedValue();
@ -37,6 +53,9 @@
return $this->pipe . ' ' . $this->getConditionPart($q);
}
/**
* @return boolean
*/
function show(){
if(!isset($this->_show)){
if(!$this->argument->isValid()) $this->_show = false;

View file

@ -1,6 +1,18 @@
<?php
/**
* @author NHN (developers@xpressengine.com)
* @package /classes/db/queryparts/condition
* @version 0.1
*/
class ConditionWithoutArgument extends Condition {
/**
* constructor
* @param string $column_name
* @param mixed $argument
* @param string $operation
* @param string $pipe
* @return void
*/
function ConditionWithoutArgument($column_name, $argument, $operation, $pipe = ""){
parent::Condition($column_name, $argument, $operation, $pipe);
if(in_array($operation, array('in', 'notin'))){