Skip to content
This repository was archived by the owner on Jun 9, 2023. It is now read-only.

Commit df25720

Browse files
committed
Moved the children endpoint to the item class from the section class as it is only scoped to items and makes no sense in the section base class.
1 parent 747d307 commit df25720

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

Server/Library/ItemAbstract.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ abstract class Plex_Server_Library_ItemAbstract
113113
*/
114114
protected $updatedAt;
115115

116+
/**
117+
* Endpoint for listing the child items of a parent or grandparent item.
118+
*/
119+
const ENDPOINT_CHILDREN = 'children';
120+
116121
/**
117122
* Sets an array of attribues, if they exist, to the corresponding class
118123
* member.
@@ -239,6 +244,26 @@ public function getPolymorphicItem($polymorphicData)
239244
}
240245
}
241246

247+
/**
248+
* Builds an endpoint for an item to retrieve its children and grandchildren
249+
* items.
250+
*
251+
* @uses Plex_Server_Library::ENDPOINT_METADATA
252+
* @uses Plex_Server_Library_SectionAbstract::ENDPOINT_CHILDREN
253+
* @uses Plex_Server_Library_ItemAbstract::getRatingKey()
254+
*
255+
* @return string The requested children endpoint.
256+
*/
257+
protected function buildChildrenEndpoint()
258+
{
259+
return sprintf(
260+
'%s/%d/%s',
261+
Plex_Server_Library::ENDPOINT_METADATA,
262+
$this->getRatingKey(),
263+
self::ENDPOINT_CHILDREN
264+
);
265+
}
266+
242267
/**
243268
* Static factory method used to instantiate child item classes by their
244269
* type.

Server/Library/SectionAbstract.php

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,10 @@ abstract class Plex_Server_Library_SectionAbstract extends Plex_Server_Library
156156
const ENDPOINT_CATEGORY_YEAR = 'year';
157157

158158
/**
159-
* Endpoing for searching a section for items.
159+
* Endpoint for searching a section for items.
160160
*/
161161
const ENDPOINT_SEARCH = 'search';
162162

163-
/**
164-
* Endping for listing the child items of a parent or grandparent item.
165-
*/
166-
const ENDPOINT_CHILDREN = 'children';
167-
168163
/**
169164
* Parameter for searching movies.
170165
*/
@@ -295,26 +290,6 @@ protected function buildSearchEndpoint($type, $query)
295290
return $this->buildEndpoint($endpoint);
296291
}
297292

298-
/**
299-
* Builds an endpoint for an item to retrieve its children and grandchildren
300-
* items.
301-
*
302-
* @uses Plex_Server_Library::ENDPOINT_METADATA
303-
* @uses Plex_Server_Library_SectionAbstract::ENDPOINT_CHILDREN
304-
* @uses Plex_Server_Library_ItemAbstract::getRatingKey()
305-
*
306-
* @return string The requested children endpoint.
307-
*/
308-
protected function buildChildrenEndpoint()
309-
{
310-
return sprintf(
311-
'%s/%d/%s',
312-
Plex_Server_Library::ENDPOINT_METADATA,
313-
$this->getRatingKey(),
314-
self::ENDPOINT_CHILDREN
315-
);
316-
}
317-
318293
/**
319294
* Generic method allowing a child class to retrieve all items for its
320295
* section.

0 commit comments

Comments
 (0)