Skip to content

Commit

Permalink
fix: cast variables (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
wilr committed Oct 27, 2023
1 parent 523d196 commit def6be3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/GoogleSitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ public static function clear_registered_routes()
*/
public function getItems($class, $page = 1)
{
//normalise the class name
$page = (int) $page;

try {
$reflectionClass = new ReflectionClass($class);
$class = $reflectionClass->getName();
Expand All @@ -246,9 +247,9 @@ public function getItems($class, $page = 1)
}

$output = new ArrayList();
$count = Config::inst()->get(__CLASS__, 'objects_per_sitemap');
$filter = Config::inst()->get(__CLASS__, 'use_show_in_search');
$redirector = Config::inst()->get(__CLASS__, 'exclude_redirector_pages');
$count = (int) Config::inst()->get(__CLASS__, 'objects_per_sitemap');
$filter = Config::inst()->get(__CLASS__, 'use_show_in_search');
$redirector = Config::inst()->get(__CLASS__, 'exclude_redirector_pages');

// todo migrate to extension hook or DI point for other modules to
// modify state filters
Expand Down Expand Up @@ -416,7 +417,7 @@ public function getSitemaps()
->limit($countPerFile, ($i - 1) * $countPerFile)
->last();

$lastModified = ($sliced) ? date('Y-m-d', strtotime($sliced->LastEdited)): date('Y-m-d');
$lastModified = ($sliced) ? date('Y-m-d', strtotime($sliced->LastEdited)) : date('Y-m-d');

$sitemaps->push(new ArrayData(array(
'ClassName' => $this->sanitiseClassName($class),
Expand Down

0 comments on commit def6be3

Please sign in to comment.