Skip to content

Commit 28c2c97

Browse files
committed
[ci skip] Add return types to library docs
1 parent 9228f85 commit 28c2c97

28 files changed

+836
-666
lines changed

user_guide_src/source/libraries/benchmark.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,18 @@ Class Reference
135135

136136
.. method:: mark($name)
137137

138-
:param string $name: the name you wish to assign to your marker
139-
:returns: void
138+
:param string $name: the name you wish to assign to your marker
139+
:rtype: void
140140

141141
Sets a benchmark marker.
142142

143-
144143
.. method:: elapsed_time([$point1 = ''[, $point2 = ''[, $decimals = 4]]])
145144

146-
:param string $point1: a particular marked point
147-
:param string $point2: a particular marked point
148-
:param int $decimals: number of decimal places for precision
149-
:returns: string
145+
:param string $point1: a particular marked point
146+
:param string $point2: a particular marked point
147+
:param int $decimals: number of decimal places for precision
148+
:returns: Elapsed time
149+
:rtype: string
150150

151151
Calculates and returns the time difference between two marked points.
152152

@@ -158,7 +158,8 @@ Class Reference
158158

159159
.. method:: memory_usage()
160160

161-
:returns: string
161+
:returns: Memory usage info
162+
:rtype: string
162163

163164
Simply returns the ``{memory_usage}`` marker.
164165

user_guide_src/source/libraries/caching.rst

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ Class Reference
5656

5757
.. method:: is_supported($driver)
5858

59-
:param string $driver: the name of the caching driver
60-
:returns: TRUE if supported, FALSE if not
59+
:param string $driver: the name of the caching driver
60+
:returns: TRUE if supported, FALSE if not
61+
:rtype: bool
6162

6263
This method is automatically called when accessing drivers via
6364
``$this->cache->get()``. However, if the individual drivers are used,
@@ -75,8 +76,9 @@ Class Reference
7576

7677
.. method:: get($id)
7778

78-
:param string $id: name of cached item
79-
:returns: The item if it exists, FALSE if it does not
79+
:param string $id: Cache item name
80+
:returns: Item value or FALSE if not found
81+
:rtype: mixed
8082

8183
This method will attempt to fetch an item from the cache store. If the
8284
item does not exist, the method will return FALSE.
@@ -86,11 +88,12 @@ Class Reference
8688

8789
.. method:: save($id, $data[, $ttl = 60[, $raw = FALSE]])
8890

89-
:param string $id: name of the cached item
90-
:param mixed $data: the data to save
91-
:param int $ttl: Time To Live, in seconds (default 60)
92-
:param bool $raw: Whether to store the raw value
93-
:returns: TRUE on success, FALSE on failure
91+
:param string $id: Cache item name
92+
:param mixed $data: the data to save
93+
:param int $ttl: Time To Live, in seconds (default 60)
94+
:param bool $raw: Whether to store the raw value
95+
:returns: TRUE on success, FALSE on failure
96+
:rtype: string
9497

9598
This method will save an item to the cache store. If saving fails, the
9699
method will return FALSE.
@@ -103,8 +106,9 @@ Class Reference
103106

104107
.. method:: delete($id)
105108

106-
:param string $id: name of cached item
107-
:returns: TRUE if deleted, FALSE if the deletion fails
109+
:param string $id: name of cached item
110+
:returns: TRUE on success, FALSE on failure
111+
:rtype: bool
108112

109113
This method will delete a specific item from the cache store. If item
110114
deletion fails, the method will return FALSE.
@@ -114,9 +118,10 @@ Class Reference
114118

115119
.. method:: increment($id[, $offset = 1])
116120

117-
:param string $id: Cache ID
118-
:param int $offset: Step/value to add
119-
:returns: New value on success, FALSE on failure
121+
:param string $id: Cache ID
122+
:param int $offset: Step/value to add
123+
:returns: New value on success, FALSE on failure
124+
:rtype: mixed
120125

121126
Performs atomic incrementation of a raw stored value.
122127
::
@@ -129,9 +134,10 @@ Class Reference
129134

130135
.. method:: decrement($id[, $offset = 1])
131136

132-
:param string $id: Cache ID
133-
:param int $offset: Step/value to reduce by
134-
:returns: New value on success, FALSE on failure
137+
:param string $id: Cache ID
138+
:param int $offset: Step/value to reduce by
139+
:returns: New value on success, FALSE on failure
140+
:rtype: mixed
135141

136142
Performs atomic decrementation of a raw stored value.
137143
::
@@ -144,7 +150,8 @@ Class Reference
144150

145151
.. method:: clean()
146152

147-
:returns: TRUE if deleted, FALSE if the deletion fails
153+
:returns: TRUE on success, FALSE on failure
154+
:rtype: bool
148155

149156
This method will 'clean' the entire cache. If the deletion of the
150157
cache files fails, the method will return FALSE.
@@ -154,7 +161,8 @@ Class Reference
154161

155162
.. method:: cache_info()
156163

157-
:returns: information on the entire cache
164+
:returns: Information on the entire cache database
165+
:rtype: mixed
158166

159167
This method will return information on the entire cache.
160168
::
@@ -166,8 +174,9 @@ Class Reference
166174

167175
.. method:: get_metadata($id)
168176

169-
:param string $id: name of cached item
170-
:returns: metadadta for the cached item
177+
:param string $id: Cache item name
178+
:returns: Metadata for the cached item
179+
:rtype: mixed
171180

172181
This method will return detailed information on a specific item in the
173182
cache.

user_guide_src/source/libraries/calendar.rst

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -201,48 +201,49 @@ Class Reference
201201

202202
.. method:: initialize([$config = array()])
203203

204-
:param array $config: config preferences
205-
:returns: void
204+
:param array $config: Configuration parameters
205+
:rtype: void
206206

207207
Initializes the Calendaring preferences. Accepts an associative array as input, containing display preferences.
208208

209-
210209
.. method:: generate([$year = ''[, $month = ''[, $data = array()]]])
211210

212-
:param int $year: the year
213-
:param int $month: the month
214-
:param array $data: the data to be shown in the calendar cells
215-
:returns: string
211+
:param int $year: Year
212+
:param int $month: Month
213+
:param array $data: Data to be shown in the calendar cells
214+
:returns: HTML-formatted calendar
215+
:rtype: string
216216

217217
Generate the calendar.
218218

219219

220220
.. method:: get_month_name($month)
221221

222-
:param int $month: the numeric month
223-
:returns: string
222+
:param int $month: Month
223+
:returns: Month name
224+
:rtype: string
224225

225226
Generates a textual month name based on the numeric month provided.
226227

227-
228228
.. method:: get_day_names($day_type = '')
229229

230-
:param string $day_type: one of 'long', 'short', or 'abr'
231-
:returns: array
230+
:param string $day_type: 'long', 'short', or 'abr'
231+
:returns: Array of day names
232+
:rtype: array
232233

233234
Returns an array of day names (Sunday, Monday, etc.) based on the type
234235
provided. Options: long, short, abr. If no ``$day_type`` is provided (or
235236
if an invalid type is provided) this method will return the "abbreviated"
236237
style.
237238

238-
239239
.. method:: adjust_date($month, $year)
240240

241-
:param int $month: the month
242-
:param int $year: the year
243-
:returns: array
241+
:param int $month: Month
242+
:param int $year: Year
243+
:returns: An associative array containing month and year
244+
:rtype: array
244245

245-
This method makes usre that you have a valid month/year. For example, if
246+
This method makes sure that you have a valid month/year. For example, if
246247
you submit 13 as the month, the year will increment and the month will
247248
become January::
248249

@@ -256,30 +257,30 @@ Class Reference
256257
[year] => '2014'
257258
)
258259

259-
260260
.. method:: get_total_days($month, $year)
261261

262-
:param int $month: the month
263-
:param int $year: the year
264-
:returns: int
262+
:param int $month: Month
263+
:param int $year: Year
264+
:returns: Count of days in the specified month
265+
:rtype: int
265266

266267
Total days in a given month::
267268

268269
echo $this->calendar->get_total_days(2, 2012);
269270
// 29
270271

271-
272272
.. method:: default_template()
273273

274-
:returns: array
274+
:returns: An array of template values
275+
:rtype: array
275276

276277
Sets the default template. This method is used when you have not created
277278
your own template.
278279

279280

280281
.. method:: parse_template()
281282

282-
:returns: void
283+
:rtype: void
283284

284285
Harvests the data within the template ``{pseudo-variables}`` used to
285286
display the calendar.

user_guide_src/source/libraries/cart.rst

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -275,92 +275,95 @@ Class Reference
275275

276276
.. method:: insert([$items = array()])
277277

278-
:param array $items: the items to insert into the cart
279-
:returns: bool
278+
:param array $items: Items to insert into the cart
279+
:returns: TRUE on success, FALSE on failure
280+
:rtype: bool
280281

281282
Insert items into the cart and save it to the session table. Returns TRUE
282283
on success and FALSE on failure.
283284

284285

285286
.. method:: update([$items = array()])
286287

287-
:param array $items: the items to update in the cart
288-
:returns: bool
288+
:param array $items: Items to update in the cart
289+
:returns: TRUE on success, FALSE on failure
290+
:rtype: bool
289291

290292
This method permits the quantity of a given item to be changed.
291293
Typically it is called from the "view cart" page if a user makes changes
292294
to the quantity before checkout. That array must contain the product ID
293295
and quantity for each item.
294296

295-
296297
.. method:: remove($rowid)
297298

298-
:param int $rowid: the ID of the item to remove from the cart
299-
:returns: bool
299+
:param int $rowid: ID of the item to remove from the cart
300+
:returns: TRUE on success, FALSE on failure
301+
:rtype: bool
300302

301303
Allows you to remove an item from the shopping cart by passing it the
302304
``$rowid``.
303305

304-
305306
.. method:: total()
306307

307-
:returns: int
308+
:returns: Total amount
309+
:rtype: int
308310

309311
Displays the total amount in the cart.
310312

311313

312314
.. method:: total_items()
313315

314-
:returns: int
316+
:returns: Total amount of items in the cart
317+
:rtype: int
315318

316319
Displays the total number of items in the cart.
317320

318321

319322
.. method:: contents([$newest_first = FALSE])
320323

321-
:param bool $newest_first: order the array with newest first?
322-
:returns: array
324+
:param bool $newest_first: Whether to order the array with newest items first
325+
:returns: An array of cart contents
326+
:rtype: array
323327

324328
Returns an array containing everything in the cart. You can sort the
325329
order by which the array is returned by passing it TRUE where the contents
326330
will be sorted from newest to oldest, otherwise it is sorted from oldest
327331
to newest.
328332

329-
330333
.. method:: get_item($row_id)
331334

332-
:param int $row_id: the row ID to retrieve
333-
:returns: array
335+
:param int $row_id: Row ID to retrieve
336+
:returns: Array of item data
337+
:rtype: array
334338

335339
Returns an array containing data for the item matching the specified row
336340
ID, or FALSE if no such item exists.
337341

338-
339342
.. method:: has_options($row_id = '')
340343

341-
:param int $row_id: the row ID to inspect
342-
:returns: bool
344+
:param int $row_id: Row ID to inspect
345+
:returns: TRUE if options exist, FALSE otherwise
346+
:rtype: bool
343347

344348
Returns TRUE (boolean) if a particular row in the cart contains options.
345-
This method is designed to be used in a loop with :meth:contents:, since
349+
This method is designed to be used in a loop with ``contents()``, since
346350
you must pass the rowid to this function, as shown in the Displaying
347351
the Cart example above.
348352

349-
350353
.. method:: product_options([$row_id = ''])
351354

352-
:param int $row_id: the row ID
353-
:returns: array
355+
:param int $row_id: Row ID
356+
:returns: Array of product options
357+
:rtype: array
354358

355359
Returns an array of options for a particular product. This method is
356-
designed to be used in a loop with :meth:contents:, since you
360+
designed to be used in a loop with ``contents()``, since you
357361
must pass the rowid to this method, as shown in the Displaying the
358362
Cart example above.
359363

360-
361364
.. method:: destroy()
362365

363-
:returns: void
366+
:rtype: void
364367

365368
Permits you to destroy the cart. This method will likely be called
366369
when you are finished processing the customer's order.

0 commit comments

Comments
 (0)