Skip to content
This repository has been archived by the owner on Nov 30, 2017. It is now read-only.

Commit

Permalink
[Report] Decouple from Symfony FrameworkBundle; fix typos and docblocks
Browse files Browse the repository at this point in the history
  • Loading branch information
adamelso committed Sep 4, 2015
1 parent 7a6d1c0 commit 54f66d8
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 92 deletions.
4 changes: 1 addition & 3 deletions DataFetcher/DataFetcherInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@
interface DataFetcherInterface
{
/**
* Fetching data from data base
*
* @param array $configuration
*
* @return Data $data
*/
public function fetch(array $configuration);

/**
* @return Type of data
* @return string
*/
public function getType();
}
4 changes: 2 additions & 2 deletions DataFetcher/DelegatingDataFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ class DelegatingDataFetcher implements DelegatingDataFetcherInterface
protected $registry;

/**
* Constructor.
*
* @param ServiceRegistryInterface $registry
*/
public function __construct(ServiceRegistryInterface $registry)
Expand All @@ -40,6 +38,8 @@ public function __construct(ServiceRegistryInterface $registry)

/**
* {@inheritdoc}
*
* @throws \InvalidArgumentException If the report does not have a data fetcher.
*/
public function fetch(ReportInterface $report, array $configuration = array())
{
Expand Down
14 changes: 7 additions & 7 deletions DataFetcher/DelegatingDataFetcherInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
interface DelegatingDataFetcherInterface
{
/**
* Fetch data for given config.
*
* @param ReportInterface $report
* @param array $configuration
*
* @return array
*/
* Fetch data for given config.
*
* @param ReportInterface $report
* @param array $configuration
*
* @return array
*/
public function fetch(ReportInterface $report, array $configuration = array());
}
89 changes: 14 additions & 75 deletions Model/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
* @author Łukasz Chruściel <lchrusciel@gmail.com>
* @author Mateusz Zalewski <mateusz.zalewski@lakion.com>
*/

class Report implements ReportInterface
{
/**
Expand Down Expand Up @@ -49,8 +48,6 @@ class Report implements ReportInterface
private $renderer = DefaultRenderers::TABLE;

/**
* Renderer configuration.
*
* @var array
*/
private $rendererConfiguration = array();
Expand All @@ -68,66 +65,46 @@ class Report implements ReportInterface
private $dataFetcherConfiguration = array();

/**
* Gets the value of id.
*
* @return integer
* {@inheritdoc}
*/
public function getId()
{
return $this->id;
}

/**
* Gets the value of name.
*
* @return string
* {@inheritdoc}
*/
public function getName()
{
return $this->name;
}

/**
* Sets the value of name.
*
* @param string $name the name
*
* @return self
* {@inheritdoc}
*/
public function setName($name)
{
$this->name = $name;

return $this;
}

/**
* Gets the value of description.
*
* @return string
* {@inheritdoc}
*/
public function getDescription()
{
return $this->description;
}

/**
* Sets the value of description.
*
* @param string $description the description
*
* @return self
* {@inheritdoc}
*/
public function setDescription($description)
{
$this->description = $description;

return $this;
}

/**
* Gets the value of code.
*
* @return string
*/
public function getCode()
Expand All @@ -136,46 +113,30 @@ public function getCode()
}

/**
* Sets the value of code.
*
* @param string $code the code
*
* @return self
* @param string $code
*/
public function setCode($code)
{
$this->code = $code;

return $this;
}

/**
* Gets the dataFetcher name.
*
* @return string
* {@inheritdoc}
*/
public function getDataFetcher()
{
return $this->dataFetcher;
}

/**
* Sets the value of dataFetcher.
*
* @param string $dataFetcher the data fetcher
*
* @return self
* {@inheritdoc}
*/
public function setDataFetcher($dataFetcher)
{
$this->dataFetcher = $dataFetcher;

return $this;
}

/**
* Gets the Renderer name.
*
* @return string
*/
public function getRenderer()
Expand All @@ -184,64 +145,42 @@ public function getRenderer()
}

/**
* Sets the Renderer name.
*
* @param string $renderer the renderer
*
* @return self
* {@inheritdoc}
*/
public function setRenderer($renderer)
{
$this->renderer = $renderer;

return $this;
}

/**
* Gets the value of dataFetcherConfiguration.
*
* @return array
* {@inheritdoc}
*/
public function getDataFetcherConfiguration()
{
return $this->dataFetcherConfiguration;
}

/**
* Sets the value of dataFetcherConfiguration.
*
* @param array $dataFetcherConfiguration the data fetcher configuration
*
* @return self
* {@inheritdoc}
*/
public function setDataFetcherConfiguration(array $dataFetcherConfiguration)
{
$this->dataFetcherConfiguration = $dataFetcherConfiguration;

return $this;
}

/**
* Gets the Renderers configuration.
*
* @return array
* {@inheritdoc}
*/
public function getRendererConfiguration()
{
return $this->rendererConfiguration;
}

/**
* Sets the Renderers configuration.
*
* @param array $rendererConfiguration the renderer configuration
*
* @return self
* {@inheritdoc}
*/
public function setRendererConfiguration($rendererConfiguration)
public function setRendererConfiguration(array $rendererConfiguration)
{
$this->rendererConfiguration = $rendererConfiguration;

return $this;
}
}
53 changes: 52 additions & 1 deletion Model/ReportInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,68 @@

interface ReportInterface
{
/**
* @return mixed
*/
public function getId();

/**
* @return string
*/
public function getName();

/**
* @param string $name
*/
public function setName($name);

/**
* @return string
*/
public function getDescription();

/**
* @param string $description
*/
public function setDescription($description);

/**
* @return string
*/
public function getRenderer();

/**
* @param string $renderer
*/
public function setRenderer($renderer);

/**
* @return array
*/
public function getRendererConfiguration();
public function setRendererConfiguration($rendererConfiguration);

/**
* @param array $rendererConfiguration
*/
public function setRendererConfiguration(array $rendererConfiguration);

/**
* @return string
*/
public function getDataFetcher();

/**
* @param string $dataFetcher
*/
public function setDataFetcher($dataFetcher);

/**
* @return array
*/
public function getDataFetcherConfiguration();

/**
* @param array $dataFetcherConfiguration
*/
public function setDataFetcherConfiguration(array $dataFetcherConfiguration);
}
7 changes: 5 additions & 2 deletions Renderer/DelegatingRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,18 @@ class DelegatingRenderer implements DelegatingRendererInterface
protected $registry;

/**
* Contructor
*
* @param ServiceRegistryInterface $registry
*/
public function __construct(ServiceRegistryInterface $registry)
{
$this->registry = $registry;
}

/**
* {@inheritdoc}
*
* @throws \InvalidArgumentException If the report subject does not have a renderer.
*/
public function render(ReportInterface $subject, Data $data)
{
if (null === $type = $subject->getRenderer()) {
Expand Down
1 change: 0 additions & 1 deletion Renderer/DelegatingRendererInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
interface DelegatingRendererInterface
{
/**
*
* @param ReportInterface $subject
* @param Data $data
*
Expand Down
2 changes: 1 addition & 1 deletion Renderer/RendererInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface RendererInterface
{
/**
* @param ReportInterface $report
* @param Data $data
* @param Data $data
*
* @return string
*/
Expand Down
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
"require-dev": {
"phpspec/phpspec": "~2.1"
},
"suggest": {
"symfony/templating": "~2.3"
},
"autoload": {
"psr-4": { "Sylius\\Component\\Report\\": "" }
},
Expand Down

0 comments on commit 54f66d8

Please sign in to comment.