Skip to content
This repository
Browse code

Fixing up some formatting issues with the new coding standard.

  • Loading branch information...
commit 8371313985c9574b6045f5babc4fb067f13733a1 1 parent 13f23a8
Louis Landry LouisLandry authored
2  build.xml
@@ -81,7 +81,7 @@
81 81 <exec executable="phpcs">
82 82 <arg value="--report=checkstyle" />
83 83 <arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
84   - <arg value="--standard=${basedir}/build/phpcs/Joomla" />
  84 + <arg value="--standard=Joomla" />
85 85 <arg path="${source}/joomla" />
86 86 </exec>
87 87 </target>
2  build/phpcs/Joomla/ruleset.xml
@@ -13,7 +13,7 @@
13 13 <!-- Lines can be 85 chars long, but never show errors -->
14 14 <rule ref="Joomla.Files.LineLength">
15 15 <properties>
16   - <property name="lineLimit" value="130"/>
  16 + <property name="lineLimit" value="150"/>
17 17 <property name="absoluteLineLimit" value="0"/>
18 18 </properties>
19 19 </rule>
4 libraries/joomla/application/cli.php
@@ -87,6 +87,8 @@ protected function __construct()
87 87 *
88 88 * This method must be invoked as: $cli = JCli::getInstance();
89 89 *
  90 + * @param string $name The name of the JCli class to instantiate.
  91 + *
90 92 * @return JCli A JCli object
91 93 *
92 94 * @since 11.1
@@ -259,7 +261,7 @@ protected function fetchConfigurationData()
259 261 if (!is_file($file)) {
260 262 return false;
261 263 }
262   - require_once $file;
  264 + include_once $file;
263 265
264 266 // Instantiate the configuration object.
265 267 if (!class_exists('JConfig')) {
11 libraries/joomla/application/cli/daemon.php
@@ -18,17 +18,16 @@
18 18 *
19 19 * @package Joomla.Platform
20 20 * @subpackage Application
21   - * @since 11.1
22   - *
23 21 * @see http://www.php.net/manual/en/book.pcntl.php
24 22 * @see http://php.net/manual/en/features.commandline.php
  23 + * @since 11.1
25 24 */
26 25 class JDaemon extends JCli
27 26 {
28 27 /**
29 28 * @var array The available POSIX signals to be caught by default.
30   - * @since 11.1
31 29 * @see http://php.net/manual/pcntl.constants.php
  30 + * @since 11.1
32 31 */
33 32 protected static $signals = array(
34 33 SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGTRAP, SIGABRT, SIGIOT, SIGBUS, SIGFPE, SIGUSR1,
@@ -430,10 +429,12 @@ protected function daemonize()
430 429 $this->running = false;
431 430
432 431 // Fork process!
433   - try {
  432 + try
  433 + {
434 434 $this->fork();
435 435 }
436   - catch (ApplicationException $e) {
  436 + catch (ApplicationException $e)
  437 + {
437 438 JLog::add('Unable to fork.', JLog::EMERGENCY);
438 439 return false;
439 440 }
9 libraries/joomla/application/input.php
@@ -87,7 +87,7 @@ public function __construct($source = null, $options = array())
87 87 /**
88 88 * Magic method to get an input object
89 89 *
90   - * @param mixed $name Name of the input object to retrieve.
  90 + * @param mixed $name Name of the input object to retrieve.
91 91 *
92 92 * @return JInput The request input object
93 93 *
@@ -185,8 +185,8 @@ public function set($name, $value)
185 185 /**
186 186 * Magic method to get filtered input data.
187 187 *
188   - * @param mixed $name Name of the value to get.
189   - * @param string $default Default value to return if variable does not exist.
  188 + * @param mixed $name Name of the value to get.
  189 + * @param string $arguments Default value to return if variable does not exist.
190 190 *
191 191 * @return boolean The filtered boolean input value.
192 192 *
@@ -210,6 +210,9 @@ public function __call($name, $arguments)
210 210 /**
211 211 * Gets the request method.
212 212 *
  213 + * @param mixed $name Name of the value to get.
  214 + * @param string $arguments Default value to return if variable does not exist.
  215 + *
213 216 * @return string The request method.
214 217 *
215 218 * @since 11.1
14 libraries/joomla/application/input/files.php
@@ -21,7 +21,7 @@
21 21 class JInputFiles extends JInput
22 22 {
23 23
24   - protected $_decodedData = array();
  24 + protected $decodedData = array();
25 25
26 26 /**
27 27 * Gets a value from the input data.
@@ -53,12 +53,22 @@ public function get($name, $default = null, $filter = 'cmd')
53 53
54 54 }
55 55
  56 + /**
  57 + * Method to decode a data array.
  58 + *
  59 + * @param array $data The data array to decode.
  60 + *
  61 + * @return array
  62 + *
  63 + * @since 11.1
  64 + */
56 65 protected function decodeData($data)
57 66 {
58 67 $result = array();
59 68
60 69 if (is_array($data[0])) {
61   - foreach ($data[0] AS $k => $v) {
  70 + foreach ($data[0] AS $k => $v)
  71 + {
62 72 $result[$k] = $this->decodeData(array($data[0][$k], $data[1][$k], $data[2][$k], $data[3][$k], $data[4][$k]));
63 73 }
64 74 return $result;
8 libraries/joomla/log/logentry.php
@@ -49,7 +49,7 @@ class JLogEntry
49 49 * The priority of the message to be logged.
50 50 * @var string
51 51 * @since 11.1
52   - * @see $_priorities
  52 + * @see $priorities
53 53 */
54 54 public $priority = JLog::INFO;
55 55
@@ -58,7 +58,7 @@ class JLogEntry
58 58 * @var array
59 59 * @since 11.1
60 60 */
61   - protected $_priorities = array(
  61 + protected $priorities = array(
62 62 JLog::EMERGENCY,
63 63 JLog::ALERT,
64 64 JLog::CRITICAL,
@@ -73,7 +73,7 @@ class JLogEntry
73 73 * Constructor
74 74 *
75 75 * @param string $message The message to log.
76   - * @param string $priority Message priority based on {$this->_priorities}.
  76 + * @param string $priority Message priority based on {$this->priorities}.
77 77 * @param string $category Type of entry
78 78 * @param string $date Date of entry (defaults to now if not specified or blank)
79 79 *
@@ -86,7 +86,7 @@ public function __construct($message, $priority = JLog::INFO, $category = '', $d
86 86 $this->message = (string) $message;
87 87
88 88 // Sanitize the priority.
89   - if (!in_array($priority, $this->_priorities, true)) {
  89 + if (!in_array($priority, $this->priorities, true)) {
90 90 $priority = JLog::INFO;
91 91 }
92 92 $this->priority = $priority;
6 libraries/joomla/log/logger.php
@@ -33,13 +33,13 @@
33 33 /**
34 34 * Constructor.
35 35 *
36   - * @param array $options Log object options.
  36 + * @param array &$options Log object options.
37 37 *
38 38 * @return void
39 39 *
40 40 * @since 11.1
41 41 */
42   - public function __construct(array & $options)
  42 + public function __construct(array &$options)
43 43 {
44 44 // Set the options for the class.
45 45 $this->options = & $options;
@@ -48,7 +48,7 @@ public function __construct(array & $options)
48 48 /**
49 49 * Method to add an entry to the log.
50 50 *
51   - * @param JLogEntry The log entry object to add to the log.
  51 + * @param JLogEntry $entry The log entry object to add to the log.
52 52 *
53 53 * @return void
54 54 *
12 libraries/joomla/log/loggers/database.php
@@ -71,14 +71,14 @@ class JLoggerDatabase extends JLogger
71 71 /**
72 72 * Constructor.
73 73 *
74   - * @param array $options Log object options.
  74 + * @param array &$options Log object options.
75 75 *
76 76 * @return void
77 77 *
78 78 * @since 11.1
79 79 * @throws LogException
80 80 */
81   - public function __construct(array & $options)
  81 + public function __construct(array &$options)
82 82 {
83 83 // Call the parent constructor.
84 84 parent::__construct($options);
@@ -110,7 +110,7 @@ public function __construct(array & $options)
110 110 /**
111 111 * Method to add an entry to the log.
112 112 *
113   - * @param JLogEntry The log entry object to add to the log.
  113 + * @param JLogEntry $entry The log entry object to add to the log.
114 114 *
115 115 * @return void
116 116 *
@@ -149,7 +149,8 @@ protected function connect()
149 149 'prefix' => $this->prefix
150 150 );
151 151
152   - try {
  152 + try
  153 + {
153 154 $db = JDatabase::getInstance($options);
154 155
155 156 if (JError::isError($db)) {
@@ -163,7 +164,8 @@ protected function connect()
163 164 // Assign the database connector to the class.
164 165 $this->dbo = $db;
165 166 }
166   - catch (DatabaseException $e) {
  167 + catch (DatabaseException $e)
  168 + {
167 169 throw new LogException($e->getMessage());
168 170 }
169 171 }
2  libraries/joomla/log/loggers/echo.php
@@ -39,7 +39,7 @@ class JLoggerEcho extends JLogger
39 39 /**
40 40 * Method to add an entry to the log.
41 41 *
42   - * @param JLogEntry The log entry object to add to the log.
  42 + * @param JLogEntry $entry The log entry object to add to the log.
43 43 *
44 44 * @return void
45 45 *
6 libraries/joomla/log/loggers/formattedtext.php
@@ -68,13 +68,13 @@ class JLoggerFormattedText extends JLogger
68 68 /**
69 69 * Constructor.
70 70 *
71   - * @param array $options Log object options.
  71 + * @param array &$options Log object options.
72 72 *
73 73 * @return void
74 74 *
75 75 * @since 11.1
76 76 */
77   - public function __construct(array & $options)
  77 + public function __construct(array &$options)
78 78 {
79 79 // Call the parent constructor.
80 80 parent::__construct($options);
@@ -123,7 +123,7 @@ public function __destruct()
123 123 /**
124 124 * Method to add an entry to the log.
125 125 *
126   - * @param JLogEntry The log entry object to add to the log.
  126 + * @param JLogEntry $entry The log entry object to add to the log.
127 127 *
128 128 * @return boolean True on success.
129 129 *
2  libraries/joomla/log/loggers/messagequeue.php
@@ -28,7 +28,7 @@ class JLoggerMessageQueue extends JLogger
28 28 /**
29 29 * Method to add an entry to the log.
30 30 *
31   - * @param JLogEntry The log entry object to add to the log.
  31 + * @param JLogEntry $entry The log entry object to add to the log.
32 32 *
33 33 * @return void
34 34 *
6 libraries/joomla/log/loggers/syslog.php
@@ -44,13 +44,13 @@ class JLoggerSysLog extends JLogger
44 44 /**
45 45 * Constructor.
46 46 *
47   - * @param array $options Log object options.
  47 + * @param array &$options Log object options.
48 48 *
49 49 * @return void
50 50 *
51 51 * @since 11.1
52 52 */
53   - public function __construct(array & $options)
  53 + public function __construct(array &$options)
54 54 {
55 55 // Call the parent constructor.
56 56 parent::__construct($options);
@@ -104,7 +104,7 @@ public function __destruct()
104 104 /**
105 105 * Method to add an entry to the log.
106 106 *
107   - * @param JLogEntry The log entry object to add to the log.
  107 + * @param JLogEntry $entry The log entry object to add to the log.
108 108 *
109 109 * @return void
110 110 *
4 libraries/joomla/log/loggers/w3c.php
@@ -37,13 +37,13 @@ class JLoggerW3C extends JLoggerFormattedText
37 37 /**
38 38 * Constructor.
39 39 *
40   - * @param array $options Log object options.
  40 + * @param array &$options Log object options.
41 41 *
42 42 * @return void
43 43 *
44 44 * @since 11.1
45 45 */
46   - public function __construct(array & $options)
  46 + public function __construct(array &$options)
47 47 {
48 48 // The name of the text file defaults to 'error.w3c.php' if not explicitly given.
49 49 if (empty($options['text_file'])) {
2  libraries/joomla/registry/format.php
@@ -47,7 +47,7 @@ public static function getInstance($type)
47 47 if (!class_exists($class)) {
48 48 $path = dirname(__FILE__).'/format/'.$type.'.php';
49 49 if (is_file($path)) {
50   - require_once $path;
  50 + include_once $path;
51 51 } else {
52 52 throw new JException(JText::_('JLIB_REGISTRY_EXCEPTION_LOAD_FORMAT_CLASS'), 500, E_ERROR);
53 53 }
35 libraries/joomla/registry/format/ini.php
@@ -26,9 +26,11 @@ class JRegistryFormatINI extends JRegistryFormat
26 26 * levels deep. Therefore we will only go through the first two levels of
27 27 * the object.
28 28 *
29   - * @param object Data source object.
30   - * @param array Options used by the formatter.
31   - * @return string INI formatted string.
  29 + * @param object $object Data source object.
  30 + * @param array $options Options used by the formatter.
  31 + *
  32 + * @return string INI formatted string.
  33 + *
32 34 * @since 11.1
33 35 */
34 36 public function objectToString($object, $options = array())
@@ -38,7 +40,8 @@ public function objectToString($object, $options = array())
38 40 $global = array();
39 41
40 42 // Iterate over the object to set the properties.
41   - foreach (get_object_vars($object) as $key => $value) {
  43 + foreach (get_object_vars($object) as $key => $value)
  44 + {
42 45 // If the value is an object then we need to put it in a local section.
43 46 if (is_object($value)) {
44 47 // Add the section line.
@@ -46,12 +49,13 @@ public function objectToString($object, $options = array())
46 49 $local[] = '['.$key.']';
47 50
48 51 // Add the properties for this section.
49   - foreach (get_object_vars($value) as $k => $v) {
50   - $local[] = $k.'='.$this->_getValueAsINI($v);
  52 + foreach (get_object_vars($value) as $k => $v)
  53 + {
  54 + $local[] = $k.'='.$this->getValueAsINI($v);
51 55 }
52 56 } else {
53 57 // Not in a section so add the property to the global array.
54   - $global[] = $key.'='.$this->_getValueAsINI($value);
  58 + $global[] = $key.'='.$this->getValueAsINI($value);
55 59 }
56 60 }
57 61
@@ -61,12 +65,12 @@ public function objectToString($object, $options = array())
61 65 /**
62 66 * Parse an INI formatted string and convert it into an object.
63 67 *
64   - * @param string INI formatted string to convert.
65   - * @param mixed An array of options used by the formatter, or a boolean setting to process sections.
  68 + * @param string $data INI formatted string to convert.
  69 + * @param mixed $options An array of options used by the formatter, or a boolean setting to process sections.
66 70 *
67 71 * @return object Data object.
68   - * @since 11.1
69 72 *
  73 + * @since 11.1
70 74 */
71 75 public function stringToObject($data, $options = array())
72 76 {
@@ -96,7 +100,8 @@ public function stringToObject($data, $options = array())
96 100 $lines = explode("\n", $data);
97 101
98 102 // Process the lines.
99   - foreach ($lines as $line) {
  103 + foreach ($lines as $line)
  104 + {
100 105 // Trim any unnecessary whitespace.
101 106 $line = trim($line);
102 107
@@ -179,11 +184,13 @@ public function stringToObject($data, $options = array())
179 184 /**
180 185 * Method to get a value in an INI format.
181 186 *
182   - * @param mixed The value to convert to INI format.
183   - * @return string The value in INI format.
  187 + * @param mixed $value The value to convert to INI format.
  188 + *
  189 + * @return string The value in INI format.
  190 + *
184 191 * @since 11.1
185 192 */
186   - protected function _getValueAsINI($value)
  193 + protected function getValueAsINI($value)
187 194 {
188 195 // Initialize variables.
189 196 $string = '';
27 libraries/joomla/registry/format/json.php
@@ -21,9 +21,11 @@ class JRegistryFormatJSON extends JRegistryFormat
21 21 /**
22 22 * Converts an object into a JSON formatted string.
23 23 *
24   - * @param object Data source object.
25   - * @param array Options used by the formatter.
26   - * @return string JSON formatted string.
  24 + * @param object $object Data source object.
  25 + * @param array $options Options used by the formatter.
  26 + *
  27 + * @return string JSON formatted string.
  28 + *
27 29 * @since 11.1
28 30 */
29 31 public function objectToString($object, $options = array())
@@ -36,16 +38,27 @@ public function objectToString($object, $options = array())
36 38 *
37 39 * If the string is not in JSON format, this method will attempt to parse it as INI format.
38 40 *
39   - * @param string JSON formatted string to convert.
40   - * @param array Options used by the formatter.
  41 + * @param string $data JSON formatted string to convert.
  42 + * @param array $options Options used by the formatter.
  43 + *
41 44 * @return object Data object.
  45 + *
  46 + * @since 11.1
42 47 */
43   - public function stringToObject($data, $process_sections = false)
  48 + public function stringToObject($data, $options = array('sections' => false))
44 49 {
  50 + // Fix legacy API.
  51 + if (is_bool($options)) {
  52 + $options = array('sections' => $options);
  53 +
  54 + // Deprecation warning.
  55 + JLog::add('JRegistryFormatJSON::stringToObject() second argument should not be a boolean.', JLog::WARNING, 'deprecated');
  56 + }
  57 +
45 58 $data = trim($data);
46 59 if ((substr($data, 0, 1) != '{') && (substr($data, -1, 1) != '}')) {
47 60 $ini = JRegistryFormat::getInstance('INI');
48   - $obj = $ini->stringToObject($data, $process_sections);
  61 + $obj = $ini->stringToObject($data, $options);
49 62 } else {
50 63 $obj = json_decode($data);
51 64 }
45 libraries/joomla/registry/format/php.php
@@ -16,25 +16,29 @@
16 16 * @subpackage Registry
17 17 * @since 11.1
18 18 */
19   -class JRegistryFormatPHP extends JRegistryFormat {
20   -
  19 +class JRegistryFormatPHP extends JRegistryFormat
  20 +{
21 21 /**
22 22 * Converts an object into a php class string.
23 23 * - NOTE: Only one depth level is supported.
24 24 *
25   - * @param object Data Source Object
26   - * @param array Parameters used by the formatter
27   - * @return string Config class formatted string
  25 + * @param object $object Data Source Object
  26 + * @param array $params Parameters used by the formatter
  27 + *
  28 + * @return string Config class formatted string
  29 + *
  30 + * @since 11.1
28 31 */
29 32 public function objectToString($object, $params = array())
30 33 {
31 34 // Build the object variables string
32 35 $vars = '';
33   - foreach (get_object_vars($object) as $k => $v) {
  36 + foreach (get_object_vars($object) as $k => $v)
  37 + {
34 38 if (is_scalar($v)) {
35 39 $vars .= "\tpublic $". $k . " = '" . addcslashes($v, '\\\'') . "';\n";
36 40 } else if (is_array($v)) {
37   - $vars .= "\tpublic $". $k . " = " . $this->_getArrayString($v) . ";\n";
  41 + $vars .= "\tpublic $". $k . " = " . $this->getArrayString($v) . ";\n";
38 42 }
39 43 }
40 44
@@ -51,24 +55,39 @@ public function objectToString($object, $params = array())
51 55 }
52 56
53 57 /**
54   - * Placeholder method
  58 + * Parse a PHP class formatted string and convert it into an object.
  59 + *
  60 + * @param string $data PHP Class formatted string to convert.
  61 + * @param array $options Options used by the formatter.
  62 + *
  63 + * @return object Data object.
55 64 *
56   - * @return boolean True
  65 + * @since 11.1
57 66 */
58   - function stringToObject($data, $namespace='')
  67 + function stringToObject($data, $options = array())
59 68 {
60 69 return true;
61 70 }
62 71
63   - protected function _getArrayString($a)
  72 + /**
  73 + * Method to get an array as an exported string.
  74 + *
  75 + * @param array $a The array to get as a string.
  76 + *
  77 + * @return array
  78 + *
  79 + * @since 11.1
  80 + */
  81 + protected function getArrayString($a)
64 82 {
65 83 $s = 'array(';
66 84 $i = 0;
67   - foreach ($a as $k => $v) {
  85 + foreach ($a as $k => $v)
  86 + {
68 87 $s .= ($i) ? ', ' : '';
69 88 $s .= '"'.$k.'" => ';
70 89 if (is_array($v)) {
71   - $s .= $this->_getArrayString($v);
  90 + $s .= $this->getArrayString($v);
72 91 } else {
73 92 $s .= '"'.addslashes($v).'"';
74 93 }
47 libraries/joomla/registry/format/xml.php
@@ -23,9 +23,11 @@ class JRegistryFormatXML extends JRegistryFormat
23 23 * - If more than two levels of nested groups are necessary, since INI is not
24 24 * useful, XML or another format should be used.
25 25 *
26   - * @param object Data source object.
27   - * @param array Options used by the formatter.
28   - * @return string XML formatted string.
  26 + * @param object $object Data source object.
  27 + * @param array $options Options used by the formatter.
  28 + *
  29 + * @return string XML formatted string.
  30 + *
29 31 * @since 11.1
30 32 */
31 33 public function objectToString($object, $options = array())
@@ -49,7 +51,7 @@ public function objectToString($object, $options = array())
49 51 $n->addAttribute('name', $k);
50 52 $n->addAttribute('type', gettype($v));
51 53
52   - $this->_getXmlChildren($n, $v, $nodeName);
  54 + $this->getXmlChildren($n, $v, $nodeName);
53 55 }
54 56 }
55 57
@@ -59,9 +61,11 @@ public function objectToString($object, $options = array())
59 61 /**
60 62 * Parse a XML formatted string and convert it into an object.
61 63 *
62   - * @param string XML formatted string to convert.
63   - * @param array Options used by the formatter.
  64 + * @param string $data XML formatted string to convert.
  65 + * @param array $options Options used by the formatter.
  66 + *
64 67 * @return object Data object.
  68 + *
65 69 * @since 11.1
66 70 */
67 71 public function stringToObject($data, $options = array())
@@ -72,8 +76,9 @@ public function stringToObject($data, $options = array())
72 76 // Parse the XML string.
73 77 $xml = simplexml_load_string($data);
74 78
75   - foreach ($xml->children() as $node) {
76   - $obj->$node['name'] = $this->_getValueFromNode($node);
  79 + foreach ($xml->children() as $node)
  80 + {
  81 + $obj->$node['name'] = $this->getValueFromNode($node);
77 82 }
78 83
79 84 return $obj;
@@ -82,13 +87,13 @@ public function stringToObject($data, $options = array())
82 87 /**
83 88 * Method to get a PHP native value for a SimpleXMLElement object. -- called recursively
84 89 *
85   - * @param object SimpleXMLElement object for which to get the native value.
  90 + * @param object $node SimpleXMLElement object for which to get the native value.
86 91 *
87   - * @return mixed Native value of the SimpleXMLElement object.
  92 + * @return mixed Native value of the SimpleXMLElement object.
88 93 *
89 94 * @since 11.1
90 95 */
91   - protected function _getValueFromNode($node)
  96 + protected function getValueFromNode($node)
92 97 {
93 98 switch ($node['type']) {
94 99 case 'integer':
@@ -108,14 +113,16 @@ protected function _getValueFromNode($node)
108 113 break;
109 114 case 'array':
110 115 $value = array();
111   - foreach ($node->children() as $child) {
112   - $value[(string) $child['name']] = $this->_getValueFromNode($child);
  116 + foreach ($node->children() as $child)
  117 + {
  118 + $value[(string) $child['name']] = $this->getValueFromNode($child);
113 119 }
114 120 break;
115 121 default:
116 122 $value = new stdClass;
117   - foreach ($node->children() as $child) {
118   - $value->$child['name'] = $this->_getValueFromNode($child);
  123 + foreach ($node->children() as $child)
  124 + {
  125 + $value->$child['name'] = $this->getValueFromNode($child);
119 126 }
120 127 break;
121 128 }
@@ -126,15 +133,15 @@ protected function _getValueFromNode($node)
126 133 /**
127 134 * Method to build a level of the XML string -- called recursively
128 135 *
129   - * @param object SimpleXMLElement object to attach children.
130   - * @param object Object that represents a node of the XML document.
131   - * @param string The name to use for node elements.
  136 + * @param object &$node SimpleXMLElement object to attach children.
  137 + * @param object $var Object that represents a node of the XML document.
  138 + * @param string $nodeName The name to use for node elements.
132 139 *
133 140 * @return void
134 141 *
135 142 * @since 11.1
136 143 */
137   - protected function _getXmlChildren(& $node, $var, $nodeName)
  144 + protected function getXmlChildren(&$node, $var, $nodeName)
138 145 {
139 146 // Iterate over the object members.
140 147 foreach ((array) $var as $k => $v)
@@ -148,7 +155,7 @@ protected function _getXmlChildren(& $node, $var, $nodeName)
148 155 $n->addAttribute('name', $k);
149 156 $n->addAttribute('type', gettype($v));
150 157
151   - $this->_getXmlChildren($n, $v, $nodeName);
  158 + $this->getXmlChildren($n, $v, $nodeName);
152 159 }
153 160 }
154 161 }
57 libraries/joomla/registry/registry.php
@@ -31,7 +31,9 @@ class JRegistry
31 31 /**
32 32 * Constructor
33 33 *
34   - * @return JRegistry
  34 + * @param mixed $data The data to bind to the new JRegistry object.
  35 + *
  36 + * @return void
35 37 *
36 38 * @since 11.1
37 39 */
@@ -78,7 +80,6 @@ public function __toString()
78 80 *
79 81 * @param string $key The name of the parameter.
80 82 * @param string $default An optional value for the parameter.
81   - * @param string An optional group for the parameter.
82 83 *
83 84 * @return string The value set, or the default if the value was not previously set (or null).
84 85 *
@@ -108,7 +109,8 @@ public function exists($path)
108 109 $node = $this->data;
109 110
110 111 // Traverse the registry to find the correct node for the result.
111   - for ($i = 0,$n = count($nodes); $i < $n; $i++) {
  112 + for ($i = 0,$n = count($nodes); $i < $n; $i++)
  113 + {
112 114 if (isset($node->$nodes[$i])) {
113 115 $node = $node->$nodes[$i];
114 116 } else {
@@ -139,8 +141,7 @@ public function get($path, $default = null)
139 141 // Initialise variables.
140 142 $result = $default;
141 143
142   - if(!strpos($path, '.'))
143   - {
  144 + if (!strpos($path, '.')) {
144 145 return (isset($this->data->$path) && $this->data->$path !== null && $this->data->$path !== '') ? $this->data->$path : $default;
145 146 }
146 147 // Explode the registry path into an array
@@ -150,7 +151,8 @@ public function get($path, $default = null)
150 151 $node = $this->data;
151 152 $found = false;
152 153 // Traverse the registry to find the correct node for the result.
153   - foreach ($nodes as $n) {
  154 + foreach ($nodes as $n)
  155 + {
154 156 if (isset($node->$n)) {
155 157 $node = $node->$n;
156 158 $found = true;
@@ -214,7 +216,6 @@ public function loadArray($array)
214 216 * Load the public variables of the object into the default namespace.
215 217 *
216 218 * @param object $object The object holding the publics to load
217   - * @param string Namespace to load the INI string into [optional]
218 219 *
219 220 * @return boolean True on success
220 221 *
@@ -272,7 +273,7 @@ public function loadString($data, $format = 'JSON', $options = array())
272 273 /**
273 274 * Merge a JRegistry object into this one
274 275 *
275   - * @param object $source Source JRegistry object to merge.
  276 + * @param object &$source Source JRegistry object to merge.
276 277 *
277 278 * @return boolean True on success
278 279 *
@@ -282,8 +283,9 @@ public function merge(&$source)
282 283 {
283 284 if ($source instanceof JRegistry) {
284 285 // Load the variables into the registry's default namespace.
285   - foreach ($source->toArray() as $k => $v) {
286   - if (($v !== null) && ($v !== '')){
  286 + foreach ($source->toArray() as $k => $v)
  287 + {
  288 + if (($v !== null) && ($v !== '')) {
287 289 $this->data->$k = $v;
288 290 }
289 291 }
@@ -312,7 +314,8 @@ public function set($path, $value)
312 314 $node = $this->data;
313 315
314 316 // Traverse the registry to find the correct node for the result.
315   - for ($i = 0, $n = count($nodes) - 1; $i < $n; $i++) {
  317 + for ($i = 0, $n = count($nodes) - 1; $i < $n; $i++)
  318 + {
316 319 if (!isset($node->$nodes[$i]) && ($i != $n)) {
317 320 $node->$nodes[$i] = new stdClass;
318 321 }
@@ -329,8 +332,6 @@ public function set($path, $value)
329 332 /**
330 333 * Transforms a namespace to an array
331 334 *
332   - * @param string Namespace to return [optional: null returns the default namespace]
333   - *
334 335 * @return array An associative array holding the namespace data
335 336 *
336 337 * @since 11.1
@@ -343,8 +344,6 @@ public function toArray()
343 344 /**
344 345 * Transforms a namespace to an object
345 346 *
346   - * @param string Namespace to return [optional: null returns the default namespace]
347   - *
348 347 * @return object An an object holding the namespace data
349 348 *
350 349 * @since 11.1
@@ -375,23 +374,24 @@ public function toString($format = 'JSON', $options = array())
375 374 /**
376 375 * Method to recursively bind data to a parent object.
377 376 *
378   - * @param object $parent The parent object on which to attach the data values.
379   - * @param mixed $data An array or object of data to bind to the parent object.
  377 + * @param object &$parent The parent object on which to attach the data values.
  378 + * @param mixed $data An array or object of data to bind to the parent object.
380 379 *
381 380 * @return void
382 381 *
383 382 * @since 11.1
384 383 */
385   - protected function bindData(& $parent, $data)
  384 + protected function bindData(&$parent, $data)
386 385 {
387 386 // Ensure the input data is an array.
388   - if(is_object($data)) {
  387 + if (is_object($data)) {
389 388 $data = get_object_vars($data);
390 389 } else {
391 390 $data = (array) $data;
392 391 }
393 392
394   - foreach ($data as $k => $v) {
  393 + foreach ($data as $k => $v)
  394 + {
395 395 if ((is_array($v) && JArrayHelper::isAssociative($v)) || is_object($v)) {
396 396 $parent->$k = new stdClass;
397 397 $this->bindData($parent->$k, $v);
@@ -414,7 +414,8 @@ protected function asArray($data)
414 414 {
415 415 $array = array();
416 416
417   - foreach (get_object_vars((object) $data) as $k => $v) {
  417 + foreach (get_object_vars((object) $data) as $k => $v)
  418 + {
418 419 if (is_object($v)) {
419 420 $array[$k] = $this->asArray($v);
420 421 } else {
@@ -432,8 +433,8 @@ protected function asArray($data)
432 433 /**
433 434 * Load an XML string into the registry into the given namespace [or default if a namespace is not given]
434 435 *
435   - * @param string XML formatted string to load into the registry
436   - * @param string Namespace to load the XML string into [optional]
  436 + * @param string $data XML formatted string to load into the registry
  437 + * @param string $namespace Namespace to load the XML string into [optional]
437 438 *
438 439 * @return boolean True on success
439 440 *
@@ -483,7 +484,7 @@ public function loadJSON($data)
483 484 /**
484 485 * Create a namespace
485 486 *
486   - * @param string Name of the namespace to create
  487 + * @param string $namespace Name of the namespace to create
487 488 *
488 489 * @return boolean True on success
489 490 *
@@ -515,8 +516,8 @@ public function getNameSpaces()
515 516 /**
516 517 * Get a registry value
517 518 *
518   - * @param string Registry path (e.g. joomla.content.showauthor)
519   - * @param mixed Optional default value
  519 + * @param string $path Registry path (e.g. joomla.content.showauthor)
  520 + * @param mixed $default Optional default value
520 521 *
521 522 * @return mixed Value of entry or null
522 523 *
@@ -537,8 +538,8 @@ public function getValue($path, $default=null)
537 538 /**
538 539 * Set a registry value
539 540 *
540   - * @param string Registry Path (e.g. joomla.content.showauthor)
541   - * @param mixed Value of entry
  541 + * @param string $path Registry Path (e.g. joomla.content.showauthor)
  542 + * @param mixed $value Value of entry
542 543 *
543 544 * @return mixed The value after setting.
544 545 *

0 comments on commit 8371313

Please sign in to comment.
Something went wrong with that request. Please try again.