mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
Remove is_null
This commit is contained in:
parent
5b243ab2da
commit
3c3c7fe251
|
|
@ -844,10 +844,10 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static function parseValue(string $type, $value)
|
||||
private static function parseValue(string $type, $value = null)
|
||||
{
|
||||
// todo: checking for string === string and is_* is slow. maybe only check type or only string
|
||||
if (is_null($value)) {
|
||||
if ($value === null) {
|
||||
return null;
|
||||
} elseif ($type === 'DateTime' || $value instanceof \DateTime) {
|
||||
return $value->format('Y-m-d H:i:s');
|
||||
|
|
@ -2503,9 +2503,9 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
*/
|
||||
public static function getByRequest(RequestAbstract $request)
|
||||
{
|
||||
if (!is_null($request->getData('id'))) {
|
||||
if ($request->getData('id') !== null) {
|
||||
$result = static::get((int) $request->getData('id'));
|
||||
} elseif (!is_null($filter = ((string) $request->getData('filter')))) {
|
||||
} elseif (($filter = ((string) $request->getData('filter'))) !== null) {
|
||||
$filter = strtolower($filter);
|
||||
|
||||
if ($filter === 'all') {
|
||||
|
|
@ -2515,8 +2515,8 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
$result = static::get(json_decode($list, true));
|
||||
} else {
|
||||
$limit = (int) ($request->getData('limit') ?? 1);
|
||||
$from = !is_null($request->getData('from')) ? new \DateTime((string) $request->getData('from')) : null;
|
||||
$to = !is_null($request->getData('to')) ? new \DateTime((string) $request->getData('to')) : null;
|
||||
$from = $request->getData('from') === null ? null : new \DateTime((string) $request->getData('from'));
|
||||
$to = $request->getData('to') === null ? null : new \DateTime((string) $request->getData('to'));
|
||||
|
||||
$query = static::getQuery();
|
||||
$query->limit($limit);
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ class Grammar extends GrammarAbstract
|
|||
return '(' . rtrim($values, ', ') . ')';
|
||||
} elseif ($value instanceof \DateTime) {
|
||||
return $query->quote($value->format('Y-m-d H:i:s'));
|
||||
} elseif (is_null($value)) {
|
||||
} elseif ($value === null) {
|
||||
return 'NULL';
|
||||
} elseif (is_bool($value)) {
|
||||
return (string) ((int) $value);
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ class Directory extends FileAbstract implements DirectoryInterface
|
|||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
if (!isset($offset)) {
|
||||
$this->addNode($value);
|
||||
} else {
|
||||
$this->nodes[$offset] = $value;
|
||||
|
|
|
|||
|
|
@ -470,7 +470,7 @@ class Directory extends FileAbstract implements DirectoryInterface
|
|||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
if (!isset($offset)) {
|
||||
$this->addNode($value);
|
||||
} else {
|
||||
$this->nodes[$offset] = $value;
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ class ArrayParser
|
|||
return '"' . $value . '"';
|
||||
} elseif (is_scalar($value)) {
|
||||
return (string) $value;
|
||||
} elseif (is_null($value)) {
|
||||
} elseif (!isset($value)) {
|
||||
return 'null';
|
||||
} elseif (is_bool($value)) {
|
||||
return $value ? 'true' : 'false';
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user