1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-14 02:34:24 +02:00

Some phpdoc updates in a few classes, plus fix a bug in the $config->paths() method

This commit is contained in:
Ryan Cramer
2016-11-17 15:20:09 -05:00
parent ab7b7a6380
commit a1219e38e9
7 changed files with 41 additions and 33 deletions

View File

@@ -215,7 +215,7 @@ class Config extends WireData {
* @return null|string * @return null|string
* *
*/ */
public function paths($for) { return $this->paths($for); } public function paths($for) { return $this->path($for); }
/** /**
* List of config keys that are also exported in javascript * List of config keys that are also exported in javascript

View File

@@ -2271,7 +2271,7 @@ class Page extends WireData implements \Countable, WireMatchable {
* ~~~~~ * ~~~~~
* *
* #pw-group-manipulation * #pw-group-manipulation
* #pw-links [Blog post about setAndSave](https://processwire.com/blog/posts/processwire-2.6.9-core-updates-and-new-procache-version/#new-page-gt-setandsave-method) * #pw-links [Blog post about setAndSave](https://processwire.com/blog/posts/processwire-2.6.9-core-updates-and-new-procache-version/)
* *
* @param array|string $key Field or property name to set, or array of one or more ['property' => $value]. * @param array|string $key Field or property name to set, or array of one or more ['property' => $value].
* @param string|int|bool|object $value Value to set, or omit if you provided an array in first argument. * @param string|int|bool|object $value Value to set, or omit if you provided an array in first argument.

View File

@@ -278,8 +278,8 @@ class Pages extends Wire {
* *
* #pw-group-retrieval * #pw-group-retrieval
* *
* @param $selector * @param string|array|Selectors $selector Selector to find pages
* @param array $options * @param array $options Options to modify behavior. See `Pages::find()` $options argument for details.
* @return PageArray * @return PageArray
* @since 3.0.19 * @since 3.0.19
* @see Pages::find(), Pages::findOne() * @see Pages::find(), Pages::findOne()

View File

@@ -914,15 +914,15 @@ class Sanitizer extends Wire {
* #pw-group-strings * #pw-group-strings
* *
* @param string $value String value to sanitize * @param string $value String value to sanitize
* @param array $options Options to modify default behavior: * @param array $options Options to modify default behavior:
* - `maxLength` (int): maximum characters allowed, or 0=no max (default=255). * - `maxLength` (int): maximum characters allowed, or 0=no max (default=255).
* - `maxBytes` (int): maximum bytes allowed (default=0, which implies maxLength*4). * - `maxBytes` (int): maximum bytes allowed (default=0, which implies maxLength*4).
* - `stripTags` (bool): strip markup tags? (default=true). * - `stripTags` (bool): strip markup tags? (default=true).
* - `allowableTags` (string): markup tags that are allowed, if stripTags is true (use same format as for PHP's `strip_tags()` function. * - `allowableTags` (string): markup tags that are allowed, if stripTags is true (use same format as for PHP's `strip_tags()` function.
* - `multiLine` (bool): allow multiple lines? if false, then $newlineReplacement below is applicable (default=false). * - `multiLine` (bool): allow multiple lines? if false, then $newlineReplacement below is applicable (default=false).
* - `newlineReplacement` (string): character to replace newlines with, OR specify boolean TRUE to remove extra lines (default=" "). * - `newlineReplacement` (string): character to replace newlines with, OR specify boolean TRUE to remove extra lines (default=" ").
* - `inCharset` (string): input character set (default="UTF-8"). * - `inCharset` (string): input character set (default="UTF-8").
* - `outCharset` (string): output character set (default="UTF-8"). * - `outCharset` (string): output character set (default="UTF-8").
* @return string * @return string
* @see Sanitizer::textarea() * @see Sanitizer::textarea()
* *
@@ -1007,7 +1007,7 @@ class Sanitizer extends Wire {
* *
* @param string $value String value to sanitize * @param string $value String value to sanitize
* @param array $options Options to modify default behavior * @param array $options Options to modify default behavior
* - `maxLength` (int): maximum characters allowed, or 0=no max (default=16384 or 16kb). * - `maxLength` (int): maximum characters allowed, or 0=no max (default=16384 or 16kb).
* - `maxBytes` (int): maximum bytes allowed (default=0, which implies maxLength*3 or 48kb). * - `maxBytes` (int): maximum bytes allowed (default=0, which implies maxLength*3 or 48kb).
* - `stripTags` (bool): strip markup tags? (default=true). * - `stripTags` (bool): strip markup tags? (default=true).
* - `allowableTags` (string): markup tags that are allowed, if stripTags is true (use same format as for PHP's `strip_tags()` function. * - `allowableTags` (string): markup tags that are allowed, if stripTags is true (use same format as for PHP's `strip_tags()` function.

View File

@@ -1900,6 +1900,7 @@ class WireArray extends Wire implements \IteratorAggregate, \ArrayAccess, \Count
* - `append` (string): String to append to result. Ignored if result is blank. * - `append` (string): String to append to result. Ignored if result is blank.
* - Please note that if delimiter is omitted, $options becomes the second argument. * - Please note that if delimiter is omitted, $options becomes the second argument.
* @return string * @return string
* @see WireArray::each(), WireArray::explode()
* *
*/ */
public function implode($delimiter, $property = '', array $options = array()) { public function implode($delimiter, $property = '', array $options = array()) {
@@ -1966,6 +1967,7 @@ class WireArray extends Wire implements \IteratorAggregate, \ArrayAccess, \Count
* - `getMethod` (string): Method to call on each item to retrieve $property (default = "get") * - `getMethod` (string): Method to call on each item to retrieve $property (default = "get")
* - `key` (string|null): Property of Wire objects to use for key of array, or omit (null) for non-associative array (default). * - `key` (string|null): Property of Wire objects to use for key of array, or omit (null) for non-associative array (default).
* @return array * @return array
* @see WireArray::each(), WireArray::implode()
* *
*/ */
public function explode($property, array $options = array()) { public function explode($property, array $options = array()) {
@@ -2046,11 +2048,10 @@ class WireArray extends Wire implements \IteratorAggregate, \ArrayAccess, \Count
* @param string|null $key Name of data property you want to get or set. Omit to get all data properties. * @param string|null $key Name of data property you want to get or set. Omit to get all data properties.
* @param mixed|null $value Value of data property you want to set. Omit when getting properties. * @param mixed|null $value Value of data property you want to set. Omit when getting properties.
* @return $this|mixed|null Returns one of the following, depending on specified arguments: * @return $this|mixed|null Returns one of the following, depending on specified arguments:
* - `mixed` when getting a single property: whatever you set is what you will get back. * - `mixed` when getting a single property: whatever you set is what you will get back.
* - `null` if the property you are trying to get does not exist in the data. * - `null` if the property you are trying to get does not exist in the data.
* - `$this` reference to this WireArray if you were setting a value. * - `$this` reference to this WireArray if you were setting a value.
* - `array` of all data if you specified no arguments. * - `array` of all data if you specified no arguments.
*
* *
*/ */
public function data($key = null, $value = null) { public function data($key = null, $value = null) {
@@ -2202,6 +2203,7 @@ class WireArray extends Wire implements \IteratorAggregate, \ArrayAccess, \Count
* (if using option #3 in arguments). * (if using option #3 in arguments).
* - `array` (4): Returns an array of associative arrays containing the property values for each item * - `array` (4): Returns an array of associative arrays containing the property values for each item
* you requested (if using option #4 in arguments). * you requested (if using option #4 in arguments).
* @see WireArray::implode(), WireArray::explode()
* *
*/ */
public function each($func = null) { public function each($func = null) {

View File

@@ -337,13 +337,13 @@ class WireCache extends Wire {
* *
* @param string $name Name of cache, can be any string up to 255 chars * @param string $name Name of cache, can be any string up to 255 chars
* @param string|array|PageArray $data Data that you want to cache * @param string|array|PageArray $data Data that you want to cache
* @param int|Page $expire Lifetime of this cache, in seconds * @param int|Page $expire Lifetime of this cache, in seconds, OR one of the following:
* ...or specify: WireCache::expireHourly, WireCache::expireDaily, WireCache::expireWeekly, WireCache::expireMonthly * - Specify one of the `WireCache::expire*` constants.
* ...or specify the future date you want it to expire (as unix timestamp or any strtotime compatible date format) * - Specify the future date you want it to expire (as unix timestamp or any strtotime compatible date format)
* ...or provide a Page object to expire when any page using that template is saved. * - Provide a Page object to expire when any page using that template is saved.
* ...or specify: WireCache::expireNever to prevent expiration. * - Specify `WireCache::expireNever` to prevent expiration.
* ...or specify: WireCache::expireSave to expire when any page or template is saved. * - Specify `WireCache::expireSave` to expire when any page or template is saved.
* ...or specify: Selector string matching pages that, when saved, expire the cache. * - Specify selector string matching pages that, when saved, expire the cache.
* @return bool Returns true if cache was successful, false if not * @return bool Returns true if cache was successful, false if not
* @throws WireException if given uncachable data * @throws WireException if given uncachable data
* *
@@ -401,11 +401,17 @@ class WireCache extends Wire {
/** /**
* Same as save() except with namespace * Same as save() except with namespace
* *
* @param string|object $ns Namespace * @param string|object $ns Namespace for cache
* @param $name * @param string $name Name of cache, can be any string up to 255 chars
* @param $data * @param string|array|PageArray $data Data that you want to cache
* @param int $expire * @param int|Page $expire Lifetime of this cache, in seconds, OR one of the following:
* @return bool * - Specify one of the `WireCache::expire*` constants.
* - Specify the future date you want it to expire (as unix timestamp or any strtotime compatible date format)
* - Provide a Page object to expire when any page using that template is saved.
* - Specify `WireCache::expireNever` to prevent expiration.
* - Specify `WireCache::expireSave` to expire when any page or template is saved.
* - Specify selector string matching pages that, when saved, expire the cache.
* @return bool Returns true if cache was successful, false if not
* *
*/ */
public function saveFor($ns, $name, $data, $expire = self::expireDaily) { public function saveFor($ns, $name, $data, $expire = self::expireDaily) {
@@ -521,7 +527,7 @@ class WireCache extends Wire {
/** /**
* Delete the cache identified by $name within given namespace ($ns) * Delete the cache identified by $name within given namespace ($ns)
* *
* @param string $ns * @param string $ns Namespace of cache
* @param string $name If none specified, all for $ns are deleted * @param string $name If none specified, all for $ns are deleted
* @return bool True on success, false on failure * @return bool True on success, false on failure
* *

View File

@@ -365,7 +365,7 @@ class WireDateTime extends Wire {
* *
* ~~~~~~ * ~~~~~~
* // Output the current date/time in relative format * // Output the current date/time in relative format
* echo $date->formatDate('relative'); * echo $datetime->date('relative');
* ~~~~~~ * ~~~~~~
* *
* @param string|int $format Use one of the following: * @param string|int $format Use one of the following: