diff --git a/Changelog b/Changelog index 74f5cd9b2..e220d9cc1 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2017-06-26 DariusIII + * Chg: Move getAll function to AdultMovies class * Chg: Update XXX processing, set protected on most methods, AdultMovies do not extend XXX anymore to fix circular reference * Chg: Add check to XXX class for false returned result in updateXXXInfo function * Chg: Remove safe_backfill from processStartWork and processEndWork functions in Forking class diff --git a/nntmux/processing/adult/ADE.php b/nntmux/processing/adult/ADE.php index 1beda1c27..41fb0122d 100755 --- a/nntmux/processing/adult/ADE.php +++ b/nntmux/processing/adult/ADE.php @@ -150,11 +150,10 @@ class ADE extends AdultMovies /** * Gets Product Information and/or Features * - * @param bool $features Include features? true/false - * + * @param bool $extras * @return array - ProductInfo/Extras = features */ - protected function productInfo($features = false) + protected function productInfo($extras = false) { $dofeature = null; $this->_tmpResponse = str_ireplace('Section ProductInfo', 'spdinfo', $this->_response); @@ -171,7 +170,7 @@ class ADE extends AdultMovies $this->_res['productinfo'][] = trim($strong->innertext); } } else { - if ($features === true) { + if ($extras === true) { $this->_res['extras'][] = trim($strong->innertext); } } @@ -224,37 +223,4 @@ class ADE extends AdultMovies } return false; } - - /** - * Gets All Information from the methods - * - * @return array - */ - public function getAll() - { - $results = []; - if (!empty($this->_directUrl)) { - $results['directurl'] = $this->_directUrl; - $results['title'] = $this->_title; - } - if (is_array($this->synopsis())) { - $results = array_merge($results, $this->synopsis()); - } - if (is_array($this->productInfo(true))) { - $results = array_merge($results, $this->productInfo(true)); - } - if (is_array($this->cast())) { - $results = array_merge($results, $this->cast()); - } - if (is_array($this->genres())) { - $results = array_merge($results, $this->genres()); - } - if (is_array($this->covers())) { - $results = array_merge($results, $this->covers()); - } - if (is_array($this->trailers())) { - $results = array_merge($results, $this->trailers()); - } - return $results; - } } diff --git a/nntmux/processing/adult/ADM.php b/nntmux/processing/adult/ADM.php index 62d2cabd9..b522a8820 100755 --- a/nntmux/processing/adult/ADM.php +++ b/nntmux/processing/adult/ADM.php @@ -110,9 +110,11 @@ class ADM extends AdultMovies * Get Product Information and Director * * + * @param bool $extras + * * @return array */ - protected function productInfo() + protected function productInfo($extras = false) { foreach ($this->_html->find('ul.list-unstyled li') as $li) { @@ -219,41 +221,6 @@ class ADM extends AdultMovies return $result; } - /** - * Gets all information - * @return array - */ - public function getAll() - { - $results = []; - if (!empty($this->_directUrl)) { - $results['title'] = $this->_title; - $results['directurl'] = $this->_directUrl; - } - - if (is_array($this->synopsis())) { - $results = array_merge($results, $this->synopsis()); - } - - if (is_array($this->productInfo())) { - $results = array_merge($results, $this->productInfo()); - } - - if (is_array($this->cast())) { - $results = array_merge($results, $this->cast()); - } - - if (is_array($this->genres())) { - $results = array_merge($results, $this->genres()); - } - - if (is_array($this->covers())) { - $results = array_merge($results, $this->covers()); - } - - $results = empty($results) ? false : $results; - return $results; - } protected function trailers() { diff --git a/nntmux/processing/adult/AEBN.php b/nntmux/processing/adult/AEBN.php index 5b53a37cc..a84d02cde 100755 --- a/nntmux/processing/adult/AEBN.php +++ b/nntmux/processing/adult/AEBN.php @@ -155,9 +155,11 @@ class AEBN extends AdultMovies /** * Gets the product information * + * @param bool $extras + * * @return array */ - protected function productInfo() + protected function productInfo($extras = false) { if ($ret = $this->_html->find('div#md-detailsLeft', 0)) { foreach ($ret->find('div') as $div) { @@ -244,42 +246,4 @@ class AEBN extends AdultMovies return false; } - - /** - * Gets all the information - * - * @return array|bool - */ - public function getAll() - { - $results = []; - if (!empty($this->_directUrl)) { - $results['title'] = $this->_title; - $results['directurl'] = $this->_directUrl; - } - if (is_array($this->synopsis())) { - $results = array_merge($results, $this->synopsis()); - } - if (is_array($this->productInfo())) { - $results = array_merge($results, $this->productInfo()); - } - if (is_array($this->cast())) { - $results = array_merge($results, $this->cast()); - } - if (is_array($this->genres())) { - $results = array_merge($results, $this->genres()); - } - $covers = $this->covers(); - if (is_array($covers)) { - $results = array_merge($results, $covers); - } - if (is_array($this->trailers())) { - $results = array_merge($results, $this->trailers()); - } - if (empty($results)) { - return false; - } - - return $results; - } } diff --git a/nntmux/processing/adult/AdultMovies.php b/nntmux/processing/adult/AdultMovies.php index f4001a3d6..0f71a797e 100644 --- a/nntmux/processing/adult/AdultMovies.php +++ b/nntmux/processing/adult/AdultMovies.php @@ -10,6 +10,11 @@ abstract class AdultMovies */ protected $_html; + /** + * @var string + */ + protected $_title; + /** * AdultMovies constructor. * @@ -23,9 +28,11 @@ abstract class AdultMovies } /** + * @param bool $extras + * * @return mixed */ - abstract protected function productInfo(); + abstract protected function productInfo($extras = false); /** * @return mixed @@ -55,12 +62,46 @@ abstract class AdultMovies abstract public function processSite($movie); /** - * @return mixed + * Gets all information + * + * @return array|bool */ - abstract public function getAll(); + public function getAll() + { + $results = []; + if (isset($this->_directUrl)) { + $results['title'] = $this->_title; + $results['directurl'] = $this->_directUrl; + } + if (is_array($this->synopsis())) { + $results = array_merge($results, $this->synopsis()); + } + if (is_array($this->productInfo(true))) { + $results = array_merge($results, $this->productInfo(true)); + } + if (is_array($this->cast())) { + $results = array_merge($results, $this->cast()); + } + if (is_array($this->genres())) { + $results = array_merge($results, $this->genres()); + } + if (is_array($this->covers())) { + $results = array_merge($results, $this->covers()); + } + if (is_array($this->trailers())) { + $results = array_merge($results, $this->trailers()); + } + if (empty($results)) { + return false; + } + + return $results; + } /** * @return mixed */ abstract protected function trailers(); + + } \ No newline at end of file diff --git a/nntmux/processing/adult/Hotmovies.php b/nntmux/processing/adult/Hotmovies.php index d65e7cf47..7bdec6028 100755 --- a/nntmux/processing/adult/Hotmovies.php +++ b/nntmux/processing/adult/Hotmovies.php @@ -91,41 +91,6 @@ class Hotmovies extends AdultMovies return false; } - /** - * Gets all information - * @return bool|array - */ - public function getAll() - { - $results = []; - if (!empty($this->_directUrl)) { - $results['title'] = $this->_title; - $results['directurl'] = $this->_directUrl; - } - if (is_array($this->synopsis())) { - $results = array_merge($results, $this->synopsis()); - } - if (is_array($this->productInfo())) { - $results = array_merge($results, $this->productInfo()); - } - if (is_array($this->cast())) { - $results = array_merge($results, $this->cast()); - } - if (is_array($this->genres())) { - $results = array_merge($results, $this->genres()); - } - if (is_array($this->covers())) { - $results = array_merge($results, $this->covers()); - } - - if (empty($results)) { - return false; - } - - return $results; - - } - /** * Gets the synopsis * @@ -145,10 +110,12 @@ class Hotmovies extends AdultMovies } /**Process ProductInfo + * + * @param bool $extras * * @return array */ - protected function productInfo(): array + protected function productInfo($extras = false): array { $studio = false; $director = false; diff --git a/nntmux/processing/adult/Popporn.php b/nntmux/processing/adult/Popporn.php index adf754a55..2fcf19403 100755 --- a/nntmux/processing/adult/Popporn.php +++ b/nntmux/processing/adult/Popporn.php @@ -151,7 +151,7 @@ class Popporn extends AdultMovies * * @return array|bool */ - protected function productInfo($extras = true) + protected function productInfo($extras = false) { $country = false; if ($ret = $this->_html->find('div#lside', 0)) { @@ -324,41 +324,4 @@ class Popporn extends AdultMovies return false; } - - /** - * Gets all information - * - * @return array|bool - */ - public function getAll() - { - $results = []; - if (isset($this->_directUrl)) { - $results['title'] = $this->_title; - $results['directurl'] = $this->_directUrl; - } - if (is_array($this->synopsis())) { - $results = array_merge($results, $this->synopsis()); - } - if (is_array($this->productInfo(true))) { - $results = array_merge($results, $this->productInfo(true)); - } - if (is_array($this->cast())) { - $results = array_merge($results, $this->cast()); - } - if (is_array($this->genres())) { - $results = array_merge($results, $this->genres()); - } - if (is_array($this->covers())) { - $results = array_merge($results, $this->covers()); - } - if (is_array($this->trailers())) { - $results = array_merge($results, $this->trailers()); - } - if (empty($results)) { - return false; - } - - return $results; - } }