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

View File

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

View File

@ -519,7 +519,7 @@ class Database
$insertRows[] = $this->quote($insertData, array_combine($indexed_columns, $dataRow));
// 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.
return $this->query('

View File

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

View File

@ -39,7 +39,7 @@ class Tag
if (empty($row))
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')
@ -58,7 +58,7 @@ class Tag
if (empty($row))
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')
@ -84,7 +84,7 @@ class Tag
});
}
if ($return_format == 'object')
if ($return_format === 'object')
{
$return = [];
foreach ($rows as $row)
@ -110,7 +110,7 @@ class Tag
'limit' => $limit,
]);
if ($return_format == 'object')
if ($return_format === 'object')
{
$return = [];
foreach ($rows as $row)
@ -136,7 +136,7 @@ class Tag
'limit' => $limit,
]);
if ($return_format == 'object')
if ($return_format === 'object')
{
$return = [];
foreach ($rows as $row)
@ -166,7 +166,7 @@ class Tag
if (empty($rows))
return [];
if ($return_format == 'object')
if ($return_format === 'object')
{
$return = [];
foreach ($rows as $row)
@ -196,7 +196,7 @@ class Tag
if (empty($rows))
return [];
if ($return_format == 'object')
if ($return_format === 'object')
{
$return = [];
foreach ($rows as $row)
@ -244,7 +244,7 @@ class Tag
trigger_error('Could not create the requested tag.', E_USER_ERROR);
$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()

View File

@ -81,7 +81,7 @@ class FormView extends SubTemplate
if ($field['type'] != 'checkbox' && isset($field['label']))
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>';
elseif ($field['type'] == 'checkbox' && isset($field['header']))
elseif ($field['type'] === 'checkbox' && isset($field['header']))
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>';

View File

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

View File

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