You are here

public function Deleted::setBy in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-feed/src/Writer/Deleted.php \Zend\Feed\Writer\Deleted::setBy()

Set by

Parameters

array $by:

Return value

Deleted

Throws

Exception\InvalidArgumentException

File

vendor/zendframework/zend-feed/src/Writer/Deleted.php, line 172

Class

Deleted

Namespace

Zend\Feed\Writer

Code

public function setBy(array $by) {
  $author = [];
  if (!array_key_exists('name', $by) || empty($by['name']) || !is_string($by['name'])) {
    throw new Exception\InvalidArgumentException('Invalid parameter: author array must include a' . ' "name" key with a non-empty string value');
  }
  $author['name'] = $by['name'];
  if (isset($by['email'])) {
    if (empty($by['email']) || !is_string($by['email'])) {
      throw new Exception\InvalidArgumentException('Invalid parameter: "email" array' . ' value must be a non-empty string');
    }
    $author['email'] = $by['email'];
  }
  if (isset($by['uri'])) {
    if (empty($by['uri']) || !is_string($by['uri']) || !Uri::factory($by['uri'])
      ->isValid()) {
      throw new Exception\InvalidArgumentException('Invalid parameter: "uri" array value must' . ' be a non-empty string and valid URI/IRI');
    }
    $author['uri'] = $by['uri'];
  }
  $this->data['by'] = $author;
  return $this;
}