Skip to content

Commit

Permalink
made almost all getters and setters protected
Browse files Browse the repository at this point in the history
they were never meant to be actually used and most of them will not be needed with PHP 7.4
  • Loading branch information
konecnyjakub committed Nov 21, 2019
1 parent c6e8a50 commit b7a681a
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 72 deletions.
8 changes: 4 additions & 4 deletions src/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ public function __construct(string $identifier, string $domain = "") {
$this->domain = $domain;
}

public function getIdentifier(): string {
protected function getIdentifier(): string {
return $this->identifier;
}

public function setIdentifier(string $identifier): void {
protected function setIdentifier(string $identifier): void {
$this->identifier = $identifier;
}

public function getDomain(): string {
protected function getDomain(): string {
return $this->domain;
}

public function setDomain(string $domain): void {
protected function setDomain(string $domain): void {
$this->domain = $domain;
}

Expand Down
20 changes: 10 additions & 10 deletions src/Cloud.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,52 +38,52 @@ public function __construct(string $domain, int $port, string $path, string $reg
$this->setProtocol($protocol);
}

public function getDomain(): string {
protected function getDomain(): string {
return $this->domain;
}

public function setDomain(string $domain): void {
protected function setDomain(string $domain): void {
$this->domain = $domain;
}

public function getPort(): int {
protected function getPort(): int {
return $this->port;
}

public function setPort(int $port): void {
protected function setPort(int $port): void {
$this->port = Numbers::range($port, 0, 65535);
}

public function getPath(): string {
protected function getPath(): string {
return $this->path;
}

/**
* @throws \InvalidArgumentException
*/
public function setPath(string $path): void {
protected function setPath(string $path): void {
if(!Strings::startsWith($path, "/")) {
throw new \InvalidArgumentException("Path has to start with /.");
}
$this->path = $path;
}

public function getRegisterProcedure(): string {
protected function getRegisterProcedure(): string {
return $this->registerProcedure;
}

public function setRegisterProcedure(string $registerProcedure): void {
protected function setRegisterProcedure(string $registerProcedure): void {
$this->registerProcedure = $registerProcedure;
}

public function getProtocol(): string {
protected function getProtocol(): string {
return $this->protocol;
}

/**
* @throws \InvalidArgumentException
*/
public function setProtocol(string $protocol): void {
protected function setProtocol(string $protocol): void {
if(!in_array($protocol, ["xml-rpc", "soap", "http-post", ], true)) {
throw new \InvalidArgumentException("Invalid value for protocol. Expected xml-rpc, soap or http-post, $protocol given.");
}
Expand Down
12 changes: 6 additions & 6 deletions src/Enclosure.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,27 @@ public function __construct(string $url, int $length, string $type) {
$this->type = $type;
}

public function getUrl(): string {
protected function getUrl(): string {
return $this->url;
}

public function setUrl(string $url): void {
protected function setUrl(string $url): void {
$this->url = $url;
}

public function getLength(): int {
protected function getLength(): int {
return $this->length;
}

public function setLength(int $length): void {
protected function setLength(int $length): void {
$this->length = $length;
}

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

public function setType(string $type): void {
protected function setType(string $type): void {
$this->type = $type;
}

Expand Down
46 changes: 23 additions & 23 deletions src/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,62 +53,62 @@ public function __construct() {
$this->extensions[] = new RssCore();
}

public function setDataSource(callable $dataSource): void {
protected function setDataSource(callable $dataSource): void {
$this->dataSource = $dataSource;
}
public function getShortenDescription(): int {

protected function getShortenDescription(): int {
return $this->shortenDescription;
}
public function setShortenDescription(int $value): void {

protected function setShortenDescription(int $value): void {
$this->shortenDescription = $value;
}
public function getDateTimeFormat(): string {

protected function getDateTimeFormat(): string {
return $this->dateTimeFormat;
}
public function setDateTimeFormat(string $format): void {

protected function setDateTimeFormat(string $format): void {
$this->dateTimeFormat = $format;
}

public function getGenerator(): string {
protected function getGenerator(): string {
return $this->generator;
}

public function setGenerator(string $generator): void {
protected function setGenerator(string $generator): void {
$this->generator = $generator;
}

public function getDocs(): string {
protected function getDocs(): string {
return $this->docs;
}

public function setDocs(string $docs): void {
protected function setDocs(string $docs): void {
$this->docs = $docs;
}

public function getTemplate(): string {
return $this->template;
}

/**
* @internal
*/
public function getExtensions(): \Nexendrie\Utils\Collection {
return $this->extensions;
protected function getTemplate(): string {
return $this->template;
}

/**
* @throws \RuntimeException
*/
public function setTemplate(string $template): void {
protected function setTemplate(string $template): void {
if(!is_file($template) || !is_readable($template)) {
throw new \RuntimeException("File $template does not exist or is not readable.");
}
$this->template = $template;
}

/**
* @internal
*/
public function getExtensions(): \Nexendrie\Utils\Collection {
return $this->extensions;
}

/**
* @throws InvalidStateException
Expand Down
6 changes: 3 additions & 3 deletions src/GenericElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ public function __construct(string $name, $value) {
$this->value = $value;
}

public function getName(): string {
protected function getName(): string {
return $this->name;
}

/**
* @return mixed
*/
public function getValue() {
protected function getValue() {
return $this->value;
}

/**
* @param mixed $value
*/
public function setValue($value): void {
protected function setValue($value): void {
$this->value = $value;
}

Expand Down
24 changes: 12 additions & 12 deletions src/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,51 +39,51 @@ public function __construct(string $url, string $title, string $link, string $de
$this->description = $description;
}

public function getUrl(): string {
protected function getUrl(): string {
return $this->url;
}

public function setUrl(string $url): void {
protected function setUrl(string $url): void {
$this->url = $url;
}

public function getTitle(): string {
protected function getTitle(): string {
return $this->title;
}

public function setTitle(string $title): void {
protected function setTitle(string $title): void {
$this->title = $title;
}

public function getLink(): string {
protected function getLink(): string {
return $this->link;
}

public function setLink(string $link): void {
protected function setLink(string $link): void {
$this->link = $link;
}

public function getWidth(): int {
protected function getWidth(): int {
return $this->width;
}

public function setWidth(int $width): void {
protected function setWidth(int $width): void {
$this->width = Numbers::range($width, 0, 144);
}

public function getHeight(): int {
protected function getHeight(): int {
return $this->height;
}

public function setHeight(int $height): void {
protected function setHeight(int $height): void {
$this->height = Numbers::range($height, 0, 400);
}

public function getDescription(): string {
protected function getDescription(): string {
return $this->description;
}

public function setDescription(string $description): void {
protected function setDescription(string $description): void {
$this->description = $description;
}

Expand Down
4 changes: 2 additions & 2 deletions src/RssResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ final class RssResponse implements \Nette\Application\IResponse {
public function __construct(string $source) {
$this->source = $source;
}
public function getSource(): string {

protected function getSource(): string {
return $this->source;
}

Expand Down
8 changes: 4 additions & 4 deletions src/Source.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ public function __construct(string $url = "", string $title = "") {
$this->title = $title;
}

public function getUrl(): string {
protected function getUrl(): string {
return $this->url;
}

public function setUrl(string $url): void {
protected function setUrl(string $url): void {
$this->url = $url;
}

public function getTitle(): string {
protected function getTitle(): string {
return $this->title;
}

public function setTitle(string $title): void {
protected function setTitle(string $title): void {
$this->title = $title;
}

Expand Down
16 changes: 8 additions & 8 deletions src/TextInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,35 +31,35 @@ public function __construct(string $title, string $description, string $name, st
$this->link = $link;
}

public function getTitle(): string {
protected function getTitle(): string {
return $this->title;
}

public function setTitle(string $title): void {
protected function setTitle(string $title): void {
$this->title = $title;
}

public function getDescription(): string {
protected function getDescription(): string {
return $this->description;
}

public function setDescription(string $description): void {
protected function setDescription(string $description): void {
$this->description = $description;
}

public function getName(): string {
protected function getName(): string {
return $this->name;
}

public function setName(string $name): void {
protected function setName(string $name): void {
$this->name = $name;
}

public function getLink(): string {
protected function getLink(): string {
return $this->link;
}

public function setLink(string $link): void {
protected function setLink(string $link): void {
$this->link = $link;
}

Expand Down

0 comments on commit b7a681a

Please sign in to comment.