Skip to content

Commit

Permalink
CS
Browse files Browse the repository at this point in the history
  • Loading branch information
Maks3w committed Sep 8, 2015
1 parent fade2ba commit d0ed0b5
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/Header/ContentDisposition.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function getFieldValue($format = HeaderInterface::FORMAT_RAW)
return $prepared;
}

$values = array($prepared);
$values = [$prepared];
foreach ($this->parameters as $attribute => $value) {
$values[] = sprintf('%s="%s"', $attribute, $value);
}
Expand All @@ -87,11 +87,12 @@ public function toString()
}

/**
* Set the content disposition
* Set the content disposition.
*
* @param string $disposition
*
* @throws InvalidArgumentException
*
* @return ContentDisposition
*/
public function setDisposition($disposition)
Expand All @@ -105,18 +106,19 @@ public function setDisposition($disposition)
sprintf(
'%s expects to be "inline" or "attachment". Received "%s"',
__METHOD__,
(string)$disposition
(string) $disposition
)
);
break;
}

$this->disposition = $disposition;

return $this;
}

/**
* Retrieve the content disposition
* Retrieve the content disposition.
*
* @return string
*/
Expand All @@ -126,19 +128,20 @@ public function getDisposition()
}

/**
* Add a parameter pair
* Add a parameter pair.
*
* @param string $name
* @param string $value
*
* @return ContentDisposition
*
* @throws InvalidArgumentException for parameter names that do not follow RFC 2822
* @throws InvalidArgumentException for parameter values that do not follow RFC 2822
*/
public function addParameter($name, $value)
{
$name = strtolower($name);
$value = (string)$value;
$value = (string) $value;

if (!HeaderValue::isValid($name)) {
throw new InvalidArgumentException('Invalid content-disposition parameter name detected');
Expand All @@ -148,11 +151,12 @@ public function addParameter($name, $value)
}

$this->parameters[$name] = $value;

return $this;
}

/**
* Get all parameters
* Get all parameters.
*
* @return array
*/
Expand All @@ -162,7 +166,7 @@ public function getParameters()
}

/**
* Get a parameter by name
* Get a parameter by name.
*
* @param string $name
*
Expand All @@ -174,11 +178,12 @@ public function getParameter($name)
if (isset($this->parameters[$name])) {
return $this->parameters[$name];
}

return null;
}

/**
* Remove a named parameter
* Remove a named parameter.
*
* @param string $name
*
Expand All @@ -189,8 +194,10 @@ public function removeParameter($name)
$name = strtolower($name);
if (isset($this->parameters[$name])) {
unset($this->parameters[$name]);

return true;
}

return false;
}
}

0 comments on commit d0ed0b5

Please sign in to comment.