Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ArrayIterator committed Jul 14, 2024
2 parents c73f1ee + a96612d commit b9370a4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 9 additions & 4 deletions Depends/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function determineSite($site, &$argumentValid = null) : ?Site
if ($site instanceof Site) {
$argumentValid = true;
if ($site->isPostLoad()) {
return $site;
return $site?:null;
}
$site = $site->getId();
if (!is_int($site)) {
Expand Down Expand Up @@ -101,17 +101,23 @@ public function getBatch(
);
}

/**
* @param Site|int|null $site
* @return int|null
*/
private function normalizeSiteId(Site|int|null $site = null) : ?int
{
$site ??= $this->users->getSite();
return !$site ? null : (is_int($site) ? $site : $site->getId());
$site = $site instanceof Site ? $site->getId() : $site;
return is_int($site) ? $site : null;
}

public function getOrCreate(
string $name,
&$siteObject = null,
Site|false|null $site = false
): ?Options {
$site = $site?:null;
$option = $this->get($name, $site, $siteObject);
if (!$option) {
$option = new Options();
Expand All @@ -135,8 +141,7 @@ public function saveBatch(

/**
* @param string $name
* @param null $siteId
* @param ?Sites $site
* @param Site|null $site
* @return Options|null
*/
public function get(
Expand Down
2 changes: 0 additions & 2 deletions Entities/Site.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,6 @@ final public function isPostLoad(): bool
#[PostLoad]
final public function finalPostLoaded(PostLoadEventArgs $postLoadEventArgs): void
{
// print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2));
// exit;
$this->postLoad = true;
}
}

0 comments on commit b9370a4

Please sign in to comment.