Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop docblock parameter/return types #26

Merged
merged 1 commit into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions src/AuthorizedKeys.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final class AuthorizedKeys implements \IteratorAggregate
private array $keyLines = [];

/**
* @param string $content content of the authorized_keys file
* @param $content content of the authorized_keys file
*/
public function __construct(string $content = null)
{
Expand All @@ -47,8 +47,7 @@ public function __construct(string $content = null)
/**
* Creates a new instance from a file
*
* @param string $file path of authorized_keys file
* @return AuthorizedKeys
* @param $file path of authorized_keys file
* @throws FilePermissionException if the authorized_keys file cannot be read
*/
public static function fromFile(string $file): AuthorizedKeys
Expand Down Expand Up @@ -104,10 +103,8 @@ public function getKeys(): array

/**
* Add a public key to the file
*
* @param PublicKey $key a public key
*/
public function addKey(PublicKey $key)
public function addKey(PublicKey $key): void
{
$index = $key->getKey();

Expand All @@ -120,10 +117,8 @@ public function addKey(PublicKey $key)

/**
* Remove a public key from the file
*
* @param PublicKey $key a public key
*/
public function removeKey(PublicKey $key)
public function removeKey(PublicKey $key): void
{
$index = $key->getKey();

Expand All @@ -134,17 +129,12 @@ public function removeKey(PublicKey $key)

/**
* Returns the file content as string
*
* @return string
*/
public function __toString(): string
{
return implode("\n", $this->lines);
}

/**
* @return \Traversable
*/
public function getIterator(): \Traversable
{
foreach ($this->getKeys() as $key) {
Expand Down
17 changes: 0 additions & 17 deletions src/InvalidPublicKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,51 +36,34 @@ public function __construct(string $key, InvalidKeyException $error)
$this->error = $error;
}

/**
* @return string
*/
public function getOptions(): string
{
return '';
}

/**
* @return string
*/
public function getType(): string
{
return '';
}

/**
* @return string
*/
public function getKey(): string
{
return $this->key;
}

/**
* @return string
*/
public function getComment(): string
{
return '';
}

/**
* Returns the file content as string
*
* @return string
*/
public function __toString(): string
{
return $this->key;
}

/**
* @return InvalidKeyException
*/
public function getError(): InvalidKeyException
{
return $this->error;
Expand Down
40 changes: 0 additions & 40 deletions src/PublicKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ final class PublicKey implements KeyInterface

private string $comment = '';

/**
* @param string $key public key string
*/
public function __construct(string $key)
{
$parts = $this->parse($key);
Expand All @@ -46,79 +43,46 @@ public function __construct(string $key)
}
}

/**
* @return string
*/
public function getOptions(): string
{
return $this->options;
}

/**
* @param string $options
* @return void
*/
public function setOptions(string $options): void
{
$this->options = $options;
}

/**
* @return string
*/
public function getType(): string
{
return $this->type;
}

/**
* @param string $type
* @return void
*/
public function setType(string $type): void
{
$this->type = $type;
}

/**
* @return string
*/
public function getKey(): string
{
return $this->key;
}

/**
* @param string $key
* @return void
*/
public function setKey(string $key): void
{
$this->key = $key;
}

/**
* @return string
*/
public function getComment(): string
{
return $this->comment;
}

/**
* @param string $comment
* @return void
*/
public function setComment(string $comment): void
{
$this->comment = $comment;
}

/**
* Returns the file content as string
*
* @return string
*/
public function __toString(): string
{
$parts = [];
Expand All @@ -138,10 +102,6 @@ public function __toString(): string
}

/**
* Parses a publie key string
*
* @param string $key public key string
* @return array
* @throws InvalidKeyException if the key is invalid
*/
private function parse(string $key): array
Expand Down