Skip to content

Commit

Permalink
[CS] Remove some dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
landrok committed Apr 7, 2024
1 parent 8d5249d commit 6c9d419
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 29 deletions.
3 changes: 3 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<report>
<clover outputFile="build/logs/clover.xml"/>
</report>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="ActivityPhp Test Suite">
Expand Down
30 changes: 12 additions & 18 deletions src/ActivityPhp/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,12 @@ public function inbox(string $handle): Inbox
{
$this->logger()->info($handle . ':' . __METHOD__);

if (isset($this->inboxes[$handle])) {
return $this->inboxes[$handle];
}

// Build actor
$actor = $this->actor($handle);
if (! isset($this->inboxes[$handle])) {
// Build actor
$actor = $this->actor($handle);

$this->inboxes[$handle] = new Inbox($actor, $this);
$this->inboxes[$handle] = new Inbox($actor, $this);
}

return $this->inboxes[$handle];
}
Expand All @@ -133,14 +131,12 @@ public function outbox(string $handle): Outbox
{
$this->logger()->info($handle . ':' . __METHOD__);

if (isset($this->outboxes[$handle])) {
return $this->outboxes[$handle];
}
if (! isset($this->outboxes[$handle])) {
// Build actor
$actor = $this->actor($handle);

// Build actor
$actor = $this->actor($handle);

$this->outboxes[$handle] = new Outbox($actor, $this);
$this->outboxes[$handle] = new Outbox($actor, $this);
}

return $this->outboxes[$handle];
}
Expand All @@ -152,12 +148,10 @@ public function actor(string $handle): Actor
{
$this->logger()->info($handle . ':' . __METHOD__);

if (isset($this->actors[$handle])) {
return $this->actors[$handle];
if (! isset($this->actors[$handle])) {
$this->actors[$handle] = new Actor($handle, $this);
}

$this->actors[$handle] = new Actor($handle, $this);

return $this->actors[$handle];
}

Expand Down
15 changes: 4 additions & 11 deletions src/ActivityPhp/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

namespace ActivityPhp;

use Exception;

/**
* \ActivityPhp\Version handles current version of this package
*/
Expand Down Expand Up @@ -49,22 +51,13 @@ public static function getRootNamespace(): string
}

/**
* Check that given filename is a string and is readable
* Check that given filename is a readable file
*
* @throws \Exception if filename is not a string
* or if filename is not a file
* @throws \Exception if filename is not a file
* or if file is not readable
*/
public static function checkFile(string $filename): void
{
// Must be a string
if (! is_string($filename)) {
throw new Exception(
'FILE_ERROR Filename must be a string. Given: '
. gettype($filename)
);
}

// Must be readable
if (! is_readable($filename)) {
throw new Exception(
Expand Down

0 comments on commit 6c9d419

Please sign in to comment.