mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
more cleanup for API docs to be generated without errors
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@324 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
6ca443861d
commit
b2ad3739b5
2 changed files with 173 additions and 124 deletions
16
libs/log.php
16
libs/log.php
|
@ -30,9 +30,23 @@
|
|||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
uses('file');
|
||||
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.libs
|
||||
* @since CakePHP v 0.2.9
|
||||
*/
|
||||
class Log
|
||||
{
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param unknown_type $type
|
||||
* @param unknown_type $msg
|
||||
* @return unknown
|
||||
*/
|
||||
function write($type, $msg)
|
||||
{
|
||||
$filename = LOGS.$type.'.log';
|
||||
|
|
|
@ -1,4 +1,33 @@
|
|||
<?php
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// + $Id$
|
||||
// +------------------------------------------------------------------+ //
|
||||
// + Cake PHP : Rapid Development Framework <http://www.cakephp.org/> + //
|
||||
// + Copyright: (c) 2005, CakePHP Authors/Developers + //
|
||||
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
|
||||
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
|
||||
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
|
||||
// +------------------------------------------------------------------+ //
|
||||
// + Licensed under The MIT License + //
|
||||
// + Redistributions of files must retain the above copyright notice. + //
|
||||
// + See: http://www.opensource.org/licenses/mit-license.php + //
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @filesource
|
||||
* @author CakePHP Authors/Developers
|
||||
* @copyright Copyright (c) 2005, CakePHP Authors/Developers
|
||||
* @link https://trac.cakephp.org/wiki/Authors Authors/Developers
|
||||
* @package cake
|
||||
* @subpackage cake.libs
|
||||
* @since CakePHP v 0.2.9
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class used for internal manipulation of multiarrays (arrays of arrays).
|
||||
|
@ -8,34 +37,34 @@
|
|||
* @since CakePHP v 0.2.9
|
||||
*/
|
||||
class NeatArray {
|
||||
/**
|
||||
* Value of NeatArray.
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
/**
|
||||
* Value of NeatArray.
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $value;
|
||||
|
||||
/**
|
||||
* Constructor. Defaults to an empty array.
|
||||
*
|
||||
* @param array $value
|
||||
* @access public
|
||||
* @uses NeatArray::value
|
||||
*/
|
||||
/**
|
||||
* Constructor. Defaults to an empty array.
|
||||
*
|
||||
* @param array $value
|
||||
* @access public
|
||||
* @uses NeatArray::value
|
||||
*/
|
||||
function NeatArray ($value=array()) {
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds and returns records with $fieldName equal $value from this NeatArray.
|
||||
*
|
||||
* @param string $fieldName
|
||||
* @param string $value
|
||||
* @return mixed
|
||||
* @access public
|
||||
* @uses NeatArray::value
|
||||
*/
|
||||
/**
|
||||
* Finds and returns records with $fieldName equal $value from this NeatArray.
|
||||
*
|
||||
* @param string $fieldName
|
||||
* @param string $value
|
||||
* @return mixed
|
||||
* @access public
|
||||
* @uses NeatArray::value
|
||||
*/
|
||||
function findIn ($fieldName, $value)
|
||||
{
|
||||
if (!is_array($this->value))
|
||||
|
@ -55,12 +84,12 @@ class NeatArray {
|
|||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if $this->value is array, and removes all empty elements.
|
||||
*
|
||||
* @access public
|
||||
* @uses NeatArray::value
|
||||
*/
|
||||
/**
|
||||
* Checks if $this->value is array, and removes all empty elements.
|
||||
*
|
||||
* @access public
|
||||
* @uses NeatArray::value
|
||||
*/
|
||||
function cleanup () {
|
||||
$out = is_array($this->value)? array(): null;
|
||||
foreach ($this->value as $k=>$v) {
|
||||
|
@ -71,38 +100,38 @@ class NeatArray {
|
|||
$this->value = $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds elements from the supplied array to itself.
|
||||
*
|
||||
* @param string $value
|
||||
* @return bool
|
||||
* @access public
|
||||
* @uses NeatArray::value
|
||||
*/
|
||||
/**
|
||||
* Adds elements from the supplied array to itself.
|
||||
*
|
||||
* @param string $value
|
||||
* @return bool
|
||||
* @access public
|
||||
* @uses NeatArray::value
|
||||
*/
|
||||
function add ($value) {
|
||||
return ($this->value = $this->plus($value))? true: false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns itself merged with given array.
|
||||
*
|
||||
* @param array $value Array to add to NeatArray.
|
||||
* @return array
|
||||
* @access public
|
||||
* @uses NeatArray::value
|
||||
*/
|
||||
/**
|
||||
* Returns itself merged with given array.
|
||||
*
|
||||
* @param array $value Array to add to NeatArray.
|
||||
* @return array
|
||||
* @access public
|
||||
* @uses NeatArray::value
|
||||
*/
|
||||
function plus ($value) {
|
||||
return array_merge($this->value, (is_array($value)? $value: array($value)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Counts repeating strings and returns an array of totals.
|
||||
*
|
||||
* @param int $sortedBy A value of 1 sorts by values, a value of 2 sorts by keys. Defaults to null (no sorting).
|
||||
* @return array
|
||||
* @access public
|
||||
* @uses NeatArray::value
|
||||
*/
|
||||
/**
|
||||
* Counts repeating strings and returns an array of totals.
|
||||
*
|
||||
* @param int $sortedBy A value of 1 sorts by values, a value of 2 sorts by keys. Defaults to null (no sorting).
|
||||
* @return array
|
||||
* @access public
|
||||
* @uses NeatArray::value
|
||||
*/
|
||||
function totals ($sortedBy=1,$reverse=true) {
|
||||
$out = array();
|
||||
foreach ($this->value as $val)
|
||||
|
@ -119,28 +148,34 @@ class NeatArray {
|
|||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an array_filter() on the contents.
|
||||
*
|
||||
* @param unknown_type $with
|
||||
* @return unknown
|
||||
*/
|
||||
/**
|
||||
* Performs an array_filter() on the contents.
|
||||
*
|
||||
* @param unknown_type $with
|
||||
* @return unknown
|
||||
*/
|
||||
function filter ($with) {
|
||||
return $this->value = array_filter($this->value, $with);
|
||||
}
|
||||
|
||||
/**
|
||||
* Passes each of its values through a specified function or method. Think of PHP's array_walk.
|
||||
*
|
||||
* @return array
|
||||
* @access public
|
||||
* @uses NeatArray::value
|
||||
*/
|
||||
/**
|
||||
* Passes each of its values through a specified function or method. Think of PHP's array_walk.
|
||||
*
|
||||
* @return array
|
||||
* @access public
|
||||
* @uses NeatArray::value
|
||||
*/
|
||||
function walk ($with) {
|
||||
array_walk($this->value, $with);
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param unknown_type $template
|
||||
* @return unknown
|
||||
*/
|
||||
function sprintf($template)
|
||||
{
|
||||
for ($ii=0; $ii<count($this->value); $ii++)
|
||||
|
@ -151,13 +186,13 @@ class NeatArray {
|
|||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts a value from all array items.
|
||||
*
|
||||
* @return array
|
||||
* @access public
|
||||
* @uses NeatArray::value
|
||||
*/
|
||||
/**
|
||||
* Extracts a value from all array items.
|
||||
*
|
||||
* @return array
|
||||
* @access public
|
||||
* @uses NeatArray::value
|
||||
*/
|
||||
function extract ($name) {
|
||||
$out = array();
|
||||
foreach ($this->value as $val) {
|
||||
|
@ -167,56 +202,56 @@ class NeatArray {
|
|||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of unique elements.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
/**
|
||||
* Returns a list of unique elements.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function unique () {
|
||||
return array_unique($this->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes duplicate elements from the value and returns it.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
/**
|
||||
* Removes duplicate elements from the value and returns it.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function makeUnique () {
|
||||
return $this->value = array_unique($this->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Joins an array with myself using a key (like a join between database tables).
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* $alice = array('id'=>'1', 'name'=>'Alice');
|
||||
* $bob = array('id'=>'2', 'name'=>'Bob');
|
||||
*
|
||||
* $users = new NeatArray(array($alice, $bob));
|
||||
*
|
||||
* $born = array
|
||||
* (
|
||||
* array('user_id'=>'1', 'born'=>'1980'),
|
||||
* array('user_id'=>'2', 'born'=>'1976')
|
||||
* );
|
||||
*
|
||||
* $users->joinWith($born, 'id', 'user_id');
|
||||
*
|
||||
* Result:
|
||||
*
|
||||
* $users->value == array
|
||||
* (
|
||||
* array('id'=>'1', 'name'=>'Alice', 'born'=>'1980'),
|
||||
* array('id'=>'2', 'name'=>'Bob', 'born'=>'1976')
|
||||
* );
|
||||
*
|
||||
*
|
||||
* @param array $his The array to join with myself.
|
||||
* @param string $onMine Key to use on myself.
|
||||
* @param string $onHis Key to use on him.
|
||||
* @return array
|
||||
*/
|
||||
/**
|
||||
* Joins an array with myself using a key (like a join between database tables).
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* $alice = array('id'=>'1', 'name'=>'Alice');
|
||||
* $bob = array('id'=>'2', 'name'=>'Bob');
|
||||
*
|
||||
* $users = new NeatArray(array($alice, $bob));
|
||||
*
|
||||
* $born = array
|
||||
* (
|
||||
* array('user_id'=>'1', 'born'=>'1980'),
|
||||
* array('user_id'=>'2', 'born'=>'1976')
|
||||
* );
|
||||
*
|
||||
* $users->joinWith($born, 'id', 'user_id');
|
||||
*
|
||||
* Result:
|
||||
*
|
||||
* $users->value == array
|
||||
* (
|
||||
* array('id'=>'1', 'name'=>'Alice', 'born'=>'1980'),
|
||||
* array('id'=>'2', 'name'=>'Bob', 'born'=>'1976')
|
||||
* );
|
||||
*
|
||||
*
|
||||
* @param array $his The array to join with myself.
|
||||
* @param string $onMine Key to use on myself.
|
||||
* @param string $onHis Key to use on him.
|
||||
* @return array
|
||||
*/
|
||||
|
||||
function joinWith ($his, $onMine, $onHis=null) {
|
||||
if (empty($onHis)) $onHis = $onMine;
|
||||
|
@ -237,15 +272,15 @@ class NeatArray {
|
|||
return $this->value = $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param unknown_type $root
|
||||
* @param unknown_type $idKey
|
||||
* @param unknown_type $parentIdKey
|
||||
* @param unknown_type $childrenKey
|
||||
* @return unknown
|
||||
*/
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param unknown_type $root
|
||||
* @param unknown_type $idKey
|
||||
* @param unknown_type $parentIdKey
|
||||
* @param unknown_type $childrenKey
|
||||
* @return unknown
|
||||
*/
|
||||
function threaded ($root=null, $idKey='id', $parentIdKey='parent_id', $childrenKey='children') {
|
||||
$out = array();
|
||||
|
||||
|
|
Loading…
Reference in a new issue