Use triple-equals in a few more places

This commit is contained in:
Aaron van Geffen 2022-12-25 13:44:54 +01:00
parent 2174e1d08b
commit 49390c372d
8 changed files with 17 additions and 17 deletions

View File

@ -263,7 +263,7 @@ class Asset
} }
$data['id_asset'] = $db->insert_id(); $data['id_asset'] = $db->insert_id();
return $return_format == 'object' ? new self($data) : $data; return $return_format === 'object' ? new self($data) : $data;
} }
public function getId() public function getId()
@ -394,7 +394,7 @@ class Asset
finfo_close($finfo); finfo_close($finfo);
// Detected an image? // Detected an image?
if (substr($this->mimetype, 0, 5) == 'image') if (substr($this->mimetype, 0, 5) === 'image')
{ {
$image = new Imagick($destination); $image = new Imagick($destination);
$d = $image->getImageGeometry(); $d = $image->getImageGeometry();

View File

@ -56,7 +56,7 @@ class AssetIterator extends Asset
// Reset internal pointer for next asset. // Reset internal pointer for next asset.
$this->db->data_seek($this->res_thumbs, 0); $this->db->data_seek($this->res_thumbs, 0);
if ($this->return_format == 'object') if ($this->return_format === 'object')
return new Asset($row); return new Asset($row);
else else
return $row; return $row;

View File

@ -519,7 +519,7 @@ class Database
$insertRows[] = $this->quote($insertData, array_combine($indexed_columns, $dataRow)); $insertRows[] = $this->quote($insertData, array_combine($indexed_columns, $dataRow));
// Determine the method of insertion. // Determine the method of insertion.
$queryTitle = $method == 'replace' ? 'REPLACE' : ($method == 'ignore' ? 'INSERT IGNORE' : 'INSERT'); $queryTitle = $method === 'replace' ? 'REPLACE' : ($method === 'ignore' ? 'INSERT IGNORE' : 'INSERT');
// Do the insert. // Do the insert.
return $this->query(' return $this->query('

View File

@ -22,7 +22,7 @@ class Image extends Asset
{ {
$asset = parent::fromId($id_asset, 'array'); $asset = parent::fromId($id_asset, 'array');
if ($asset) if ($asset)
return $return_format == 'object' ? new Image($asset) : $asset; return $return_format === 'object' ? new Image($asset) : $asset;
else else
return false; return false;
} }
@ -34,7 +34,7 @@ class Image extends Asset
$assets = parent::fromIds($id_assets, 'array'); $assets = parent::fromIds($id_assets, 'array');
if ($return_format == 'array') if ($return_format === 'array')
return $assets; return $assets;
else else
{ {

View File

@ -39,7 +39,7 @@ class Tag
if (empty($row)) if (empty($row))
throw new NotFoundException(); throw new NotFoundException();
return $return_format == 'object' ? new Tag($row) : $row; return $return_format === 'object' ? new Tag($row) : $row;
} }
public static function fromSlug($slug, $return_format = 'object') public static function fromSlug($slug, $return_format = 'object')
@ -58,7 +58,7 @@ class Tag
if (empty($row)) if (empty($row))
throw new NotFoundException(); throw new NotFoundException();
return $return_format == 'object' ? new Tag($row) : $row; return $return_format === 'object' ? new Tag($row) : $row;
} }
public static function getAll($limit = 0, $return_format = 'array') public static function getAll($limit = 0, $return_format = 'array')
@ -84,7 +84,7 @@ class Tag
}); });
} }
if ($return_format == 'object') if ($return_format === 'object')
{ {
$return = []; $return = [];
foreach ($rows as $row) foreach ($rows as $row)
@ -110,7 +110,7 @@ class Tag
'limit' => $limit, 'limit' => $limit,
]); ]);
if ($return_format == 'object') if ($return_format === 'object')
{ {
$return = []; $return = [];
foreach ($rows as $row) foreach ($rows as $row)
@ -136,7 +136,7 @@ class Tag
'limit' => $limit, 'limit' => $limit,
]); ]);
if ($return_format == 'object') if ($return_format === 'object')
{ {
$return = []; $return = [];
foreach ($rows as $row) foreach ($rows as $row)
@ -166,7 +166,7 @@ class Tag
if (empty($rows)) if (empty($rows))
return []; return [];
if ($return_format == 'object') if ($return_format === 'object')
{ {
$return = []; $return = [];
foreach ($rows as $row) foreach ($rows as $row)
@ -196,7 +196,7 @@ class Tag
if (empty($rows)) if (empty($rows))
return []; return [];
if ($return_format == 'object') if ($return_format === 'object')
{ {
$return = []; $return = [];
foreach ($rows as $row) foreach ($rows as $row)
@ -244,7 +244,7 @@ class Tag
trigger_error('Could not create the requested tag.', E_USER_ERROR); trigger_error('Could not create the requested tag.', E_USER_ERROR);
$data['id_tag'] = $db->insert_id(); $data['id_tag'] = $db->insert_id();
return $return_format == 'object' ? new Tag($data) : $data; return $return_format === 'object' ? new Tag($data) : $data;
} }
public function getUrl() public function getUrl()

View File

@ -81,7 +81,7 @@ class FormView extends SubTemplate
if ($field['type'] != 'checkbox' && isset($field['label'])) if ($field['type'] != 'checkbox' && isset($field['label']))
echo ' echo '
<dt class="cont_', $field_id, isset($field['tab_class']) ? ' target target-' . $field['tab_class'] : '', '"', in_array($field_id, $this->missing) ? ' style="color: red"' : '', '>', $field['label'], '</dt>'; <dt class="cont_', $field_id, isset($field['tab_class']) ? ' target target-' . $field['tab_class'] : '', '"', in_array($field_id, $this->missing) ? ' style="color: red"' : '', '>', $field['label'], '</dt>';
elseif ($field['type'] == 'checkbox' && isset($field['header'])) elseif ($field['type'] === 'checkbox' && isset($field['header']))
echo ' echo '
<dt class="cont_', $field_id, isset($field['tab_class']) ? ' target target-' . $field['tab_class'] : '', '"', in_array($field_id, $this->missing) ? ' style="color: red"' : '', '>', $field['header'], '</dt>'; <dt class="cont_', $field_id, isset($field['tab_class']) ? ' target target-' . $field['tab_class'] : '', '"', in_array($field_id, $this->missing) ? ' style="color: red"' : '', '>', $field['header'], '</dt>';

View File

@ -49,7 +49,7 @@ class TabularData extends SubTemplate
$th['href'] ? '<a href="' . $th['href'] . '">' . $th['label'] . '</a>' : $th['label']; $th['href'] ? '<a href="' . $th['href'] . '">' . $th['label'] . '</a>' : $th['label'];
if ($th['sort_mode'] ) if ($th['sort_mode'] )
echo ' ', $th['sort_mode'] == 'up' ? '&uarr;' : '&darr;'; echo ' ', $th['sort_mode'] === 'up' ? '&uarr;' : '&darr;';
echo '</th>'; echo '</th>';
} }

View File

@ -15,7 +15,7 @@ abstract class Template
public function adopt(Template $template, $position = 'end') public function adopt(Template $template, $position = 'end')
{ {
// By default, we append it. // By default, we append it.
if ($position == 'end') if ($position === 'end')
$this->_subtemplates[] = $template; $this->_subtemplates[] = $template;
// We can also add it to the beginning of the list, though. // We can also add it to the beginning of the list, though.
else else