for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace gossi\swagger;
use gossi\swagger\parts\DescriptionPart;
use phootwork\collection\CollectionUtils;
use gossi\swagger\parts\SchemaPart;
use phootwork\collection\Map;
use gossi\swagger\parts\RefPart;
use gossi\swagger\parts\ExtensionPart;
use phootwork\lang\Arrayable;
use gossi\swagger\collections\Headers;
class Response extends AbstractModel implements Arrayable {
use RefPart;
use DescriptionPart;
use SchemaPart;
use ExtensionPart;
/** @var string */
private $code;
/** @var Map */
private $examples;
/** @var Headers */
private $headers;
public function __construct($code, $contents = []) {
$this->code = $code;
$this->parse($contents);
}
private function parse($contents = []) {
$data = CollectionUtils::toMap($contents);
$this->examples = $data->get('examples', new Map());
$this->headers = new Headers($data->get('headers'));
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
$a = "a"; $ab = "ab"; $abc = "abc";
will produce issues in the first and second line, while this second example
will produce no issues.
// parts
$this->parseRef($data);
$this->parseDescription($data);
$this->parseSchema($data);
$this->parseExtensions($data);
public function toArray() {
return $this->export('description', 'schema', 'headers', 'examples');
/**
* Returns the responses code
*
* @return string
*/
public function getCode() {
return $this->code;
* @return Map
public function getExamples() {
return $this->examples;
* Returns headers for this response
* @return Headers
public function getHeaders() {
return $this->headers;
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.