Skip to content

Commit

Permalink
Merge pull request #55 from ndrx-io/develop
Browse files Browse the repository at this point in the history
Code synthax
  • Loading branch information
lahaxearnaud committed Dec 26, 2015
2 parents 1d1b63c + c2682fe commit 22c75ca
Show file tree
Hide file tree
Showing 43 changed files with 41 additions and 84 deletions.
3 changes: 0 additions & 3 deletions src/Collectors/Collector.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@
use Ndrx\Profiler\DataSources\Contracts\DataSourceInterface;
use Ndrx\Profiler\JsonPatch;
use Ndrx\Profiler\Process;
use Ndrx\Profiler\Renderer\BarRenderableInterface;
use Ndrx\Profiler\Renderer\Html\Data\PhPVersion;
use Ndrx\Profiler\Renderer\RenderableInterface;
use Ndrx\Profiler\Renderer\RendererInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

abstract class Collector implements CollectorInterface, RenderableInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Collectors/Data/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ abstract class Config extends Collector implements StartCollectorInterface
{
public function validate()
{
if(!is_array($this->data)) {
if (!is_array($this->data)) {
throw new \LogicException('Duration must be an array ' . json_encode($this->data) . ' given');
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Collectors/Data/CpuUsage.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function resolve()

public function validate()
{
if(!is_numeric($this->data)) {
if (!is_numeric($this->data)) {
throw new \LogicException('Duration must be a numeric ' . json_encode($this->data) . ' given');
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Collectors/Data/Duration.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(Process $process, DataSourceInterface $dataSource, J

public function validate()
{
if(!is_numeric($this->data)) {
if (!is_numeric($this->data)) {
throw new \LogicException('Duration must be a number ' . json_encode($this->data) . ' given');
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/Collectors/Data/Included.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@

use Ndrx\Profiler\Collectors\Collector;
use Ndrx\Profiler\Collectors\Contracts\FinalCollectorInterface;
use Ndrx\Profiler\DataSources\Contracts\DataSourceInterface;
use Ndrx\Profiler\JsonPatch;
use Ndrx\Profiler\Process;

class Included extends Collector implements FinalCollectorInterface
{
Expand All @@ -35,7 +32,7 @@ public function getPath()

public function validate()
{
if(!is_array($this->data)) {
if (!is_array($this->data)) {
throw new \LogicException('Duration must be an array ' . json_encode($this->data) . ' given');
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/Collectors/Data/PhpVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Ndrx\Profiler\Collectors\Collector;
use Ndrx\Profiler\Collectors\Contracts\StartCollectorInterface;
use Ndrx\Profiler\Renderer\BarRenderableInterface;
use Ndrx\Profiler\Renderer\RenderableInterface;

class PhpVersion extends Collector implements StartCollectorInterface, BarRenderableInterface
{
Expand All @@ -26,7 +25,7 @@ public function resolve()

public function validate()
{
if(!is_string($this->data)) {
if (!is_string($this->data)) {
throw new \LogicException('Duration must be a string ' . json_encode($this->data) . ' given');
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/Collectors/Data/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace Ndrx\Profiler\Collectors\Data;


use Ndrx\Profiler\Collectors\Collector;
use Ndrx\Profiler\Collectors\Contracts\StartCollectorInterface;
use Ndrx\Profiler\Renderer\BarRenderableInterface;
Expand Down Expand Up @@ -44,7 +43,7 @@ public function getDataFields()

public function validate()
{
foreach($this->data as $element) {
foreach ($this->data as $element) {
$this->validator->validate($element);
}
}
Expand Down
1 change: 0 additions & 1 deletion src/Collectors/Data/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace Ndrx\Profiler\Collectors\Data;


use Ndrx\Profiler\Collectors\Collector;
use Ndrx\Profiler\Collectors\Contracts\StartCollectorInterface;
use Ndrx\Profiler\Renderer\BarRenderableInterface;
Expand Down
4 changes: 2 additions & 2 deletions src/Collectors/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Validator
*/
protected $optionResolver;

public function __construct(array $required, array $defaults = array())
public function __construct(array $required)
{
$this->optionResolver = new OptionsResolver();
$this->optionResolver->setDefaults(array_fill_keys($required, null));
Expand All @@ -49,4 +49,4 @@ public function validate(array $data)

return true;
}
}
}
1 change: 0 additions & 1 deletion src/Context/NullContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Ndrx\Profiler\Process;


/**
* Created by PhpStorm.
* User: arnaud
Expand Down
6 changes: 2 additions & 4 deletions src/Controllers/Bar.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

use Ndrx\Profiler\ProfilerInterface;
use Ndrx\Profiler\Renderer\Html\Bar as BarRenderer;
use Ndrx\Profiler\Renderer\Html\Process;
use Ndrx\Profiler\Renderer\Html\ProcessList;

/**
* Created by PhpStorm.
Expand Down Expand Up @@ -38,7 +36,7 @@ public function __construct(ProfilerInterface $profiler)
public function show($id)
{
$profile = $this->objectToArray($this->profiler->getProfile($id));
$renderer = new BarRenderer ($profile, $this->profiler);
$renderer = new BarRenderer($profile, $this->profiler);

return $renderer->content();
}
Expand All @@ -64,4 +62,4 @@ protected function objectToArray($obj)

return $new;
}
}
}
2 changes: 1 addition & 1 deletion src/Controllers/Web.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ protected function objectToArray($obj)

return $new;
}
}
}
1 change: 0 additions & 1 deletion src/DataSources/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public function __construct($outputFolder)
*/
public function getProcess($processId)
{

$finder = new Finder();
$iterator = $finder
->name('*.json')
Expand Down
1 change: 0 additions & 1 deletion src/NullProfiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ public function getProfile($id)
*/
public function getContext()
{

return new NullContext();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Profiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public function runGroup($name)

$collector->persist();
} catch (\Exception $e) {
if(!$this->logger === null) {
if (!$this->logger === null) {
$this->emergency($e->getMessage(), [
'collector', get_class($collector)
]);
Expand Down
4 changes: 1 addition & 3 deletions src/Renderer/BarRenderableInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

namespace Ndrx\Profiler\Renderer;


interface BarRenderableInterface extends RenderableInterface
{

}
}
3 changes: 1 addition & 2 deletions src/Renderer/Html/Bar.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public function getTemplate()
*/
public function getData()
{

$collectors = [];

$dataCollectors = $this->profiler->getCollectors();
Expand Down Expand Up @@ -96,4 +95,4 @@ public function getTitle()
{
return 'Bar';
}
}
}
2 changes: 1 addition & 1 deletion src/Renderer/Html/BarInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ public function getBadge();
* @return string
*/
public function getBarContent();
}
}
3 changes: 1 addition & 2 deletions src/Renderer/Html/BarLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
namespace Ndrx\Profiler\Renderer\Html;

use Ndrx\Profiler\ProfilerInterface;
use Ndrx\Profiler\Renderer\RenderableInterface;

class BarLoader extends Renderer
{
Expand Down Expand Up @@ -59,4 +58,4 @@ public function getTitle()
{
return 'Bar';
}
}
}
4 changes: 1 addition & 3 deletions src/Renderer/Html/Data/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace Ndrx\Profiler\Renderer\Html\Data;


use Ndrx\Profiler\Renderer\Html\BarInterface;
use Ndrx\Profiler\Renderer\Html\PageInterface;

Expand All @@ -27,7 +26,6 @@ public function getTitle()
*/
public function getBadge()
{

if (empty($this->profile['value'])) {
return '-';
}
Expand All @@ -42,4 +40,4 @@ public function getBarContent()
{
return false;
}
}
}
2 changes: 1 addition & 1 deletion src/Renderer/Html/Data/Collector.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ public function getIcon()
{
return 'info';
}
}
}
3 changes: 1 addition & 2 deletions src/Renderer/Html/Data/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace Ndrx\Profiler\Renderer\Html\Data;


use Ndrx\Profiler\Renderer\Html\BarInterface;
use Ndrx\Profiler\Renderer\Html\PageInterface;

Expand Down Expand Up @@ -37,4 +36,4 @@ public function getBarContent()
{
return false;
}
}
}
3 changes: 1 addition & 2 deletions src/Renderer/Html/Data/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace Ndrx\Profiler\Renderer\Html\Data;


use Ndrx\Profiler\Renderer\Html\BarInterface;
use Ndrx\Profiler\Renderer\Html\PageInterface;

Expand Down Expand Up @@ -46,4 +45,4 @@ public function getIcon()
{
return 'fa-compass';
}
}
}
3 changes: 1 addition & 2 deletions src/Renderer/Html/Data/CpuUsage.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace Ndrx\Profiler\Renderer\Html\Data;


use Ndrx\Profiler\Renderer\Html\BarInterface;

class CpuUsage extends Collector implements BarInterface
Expand Down Expand Up @@ -45,4 +44,4 @@ public function getIcon()
{
return 'fa-heartbeat';
}
}
}
4 changes: 1 addition & 3 deletions src/Renderer/Html/Data/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace Ndrx\Profiler\Renderer\Html\Data;


use Ndrx\Profiler\Renderer\Html\BarInterface;
use Ndrx\Profiler\Renderer\Html\PageInterface;

Expand All @@ -27,7 +26,6 @@ public function getTitle()
*/
public function getBadge()
{

if (empty($this->profile['value'])) {
return '-';
}
Expand All @@ -47,4 +45,4 @@ public function getIcon()
{
return 'fa-database';
}
}
}
3 changes: 1 addition & 2 deletions src/Renderer/Html/Data/Duration.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace Ndrx\Profiler\Renderer\Html\Data;


use Ndrx\Profiler\Renderer\Html\BarInterface;

class Duration extends Collector implements BarInterface
Expand Down Expand Up @@ -46,4 +45,4 @@ public function getIcon()
{
return 'fa-clock-o';
}
}
}
3 changes: 1 addition & 2 deletions src/Renderer/Html/Data/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace Ndrx\Profiler\Renderer\Html\Data;


use Ndrx\Profiler\Renderer\Html\BarInterface;
use Ndrx\Profiler\Renderer\Html\PageInterface;

Expand Down Expand Up @@ -46,4 +45,4 @@ public function getIcon()
{
return 'fa-bell';
}
}
}
3 changes: 1 addition & 2 deletions src/Renderer/Html/Data/Included.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace Ndrx\Profiler\Renderer\Html\Data;


use Ndrx\Profiler\Renderer\Html\PageInterface;

class Included extends Collector implements PageInterface
Expand All @@ -25,4 +24,4 @@ public function getIcon()
{
return 'fa-file';
}
}
}
3 changes: 1 addition & 2 deletions src/Renderer/Html/Data/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace Ndrx\Profiler\Renderer\Html\Data;


use Ndrx\Profiler\Renderer\Html\BarInterface;
use Ndrx\Profiler\Renderer\Html\PageInterface;

Expand Down Expand Up @@ -42,4 +41,4 @@ public function getIcon()
{
return 'fa-list-alt';
}
}
}

0 comments on commit 22c75ca

Please sign in to comment.