/** * @group utility */ function testIsProductSort() { $this->assertFalse(InputValidator::isProductSort("Some String")); $this->assertFalse(InputValidator::isProductSort(3)); $this->assertFalse(InputValidator::isProductSort(null)); $this->assertFalse(InputValidator::isProductSort(1.2)); $this->assertFalse(InputValidator::isProductSort("NAME")); $this->assertTrue(InputValidator::isProductSort("name")); }
/** * This function sets the order parameter to show. * * @author David Pauli <*****@*****.**> * @since 0.0.0 * @since 0.1.0 Use attribute unstatic. * @api * @param String $sort The sort parameter to filter. * @return boolean True if setting the sort parameter works, false if not. */ public function setSort($sort) { if (!InputValidator::isProductSort($sort)) { return false; } $this->sort = $sort; return true; }
/** * This function sets the order parameter to show. * * @author David Pauli <*****@*****.**> * @param String $sort The sort parameter to filter. * @return boolean True if setting the sort parameter works, false if not. * @since 0.0.0 * @since 0.1.0 Use attribute unstatic. * @since 0.1.2 Add error reporting. */ public function setSort($sort) { $this->errorReset(); if (!InputValidator::isProductSort($sort)) { $this->errorSet("PF-6"); Logger::warning("ep6\\ProductFilter\nThe parameter " . $sort . " as a product filter sort has not a valid value."); return false; } $this->sort = $sort; return true; }