Skip to content

Commit

Permalink
Merge pull request #172 from kokspflanze/translator-problem
Browse files Browse the repository at this point in the history
fix translation / php-cs-fixer / php-doc / cleanup
  • Loading branch information
ThaDafinser committed Apr 17, 2015
2 parents 9c5169f + 1074b29 commit 8b40cb2
Show file tree
Hide file tree
Showing 29 changed files with 186 additions and 69 deletions.
2 changes: 1 addition & 1 deletion config/daterange.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
],
],
],
]
],
];
2 changes: 1 addition & 1 deletion config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,5 @@
'template_path_stack' => [
'ZfcDatagrid' => __DIR__ . '/../view',
],
]
],
];
25 changes: 10 additions & 15 deletions src/ZfcDatagrid/Column/Formatter/GenerateLink.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<?php


namespace ZfcDatagrid\Column\Formatter;


use Zend\ServiceManager\ServiceManager;
use Zend\ServiceManager\ServiceManagerAwareInterface;
use ZfcDatagrid\Column\AbstractColumn;
Expand Down Expand Up @@ -32,7 +29,7 @@ class GenerateLink extends AbstractFormatter implements ServiceManagerAwareInter
* @param null $key
* @param array $params
*/
public function __construct( ServiceManager $sm, $route, $key = null, $params = array() )
public function __construct(ServiceManager $sm, $route, $key = null, $params = [])
{
$this->setServiceManager($sm);
$this->setRoute($route);
Expand All @@ -41,20 +38,20 @@ public function __construct( ServiceManager $sm, $route, $key = null, $params =
}

/**
* @param AbstractColumn $columnUniqueId
* @param AbstractColumn $column
* @return string
*/
public function getFormattedValue( AbstractColumn $column )
public function getFormattedValue(AbstractColumn $column)
{
$row = $this->getRowData();
$value = $row[$column->getUniqueId()];

$routeKey = !is_null($this->getRouteKey())?
$routeKey = !is_null($this->getRouteKey()) ?
$this->getRouteKey()
:
$column->getUniqueId();

$params = $this->getRouteParams();
$params = $this->getRouteParams();
$params[$routeKey] = $value;

$url = (string) $this->getViewRenderer()->url($this->getRoute(), $params);
Expand All @@ -66,7 +63,7 @@ public function getFormattedValue( AbstractColumn $column )
* Set service manager
* @param ServiceManager $serviceManager
*/
public function setServiceManager( ServiceManager $serviceManager )
public function setServiceManager(ServiceManager $serviceManager)
{
$this->serviceManager = $serviceManager;

Expand Down Expand Up @@ -105,7 +102,7 @@ public function getRoute()
* @param string $route
* @return GenerateLink
*/
public function setRoute( $route )
public function setRoute($route)
{
$this->route = $route;

Expand All @@ -124,7 +121,7 @@ public function getRouteParams()
* @param array $routeParams
* @return GenerateLink
*/
public function setRouteParams( $routeParams )
public function setRouteParams($routeParams)
{
$this->routeParams = $routeParams;

Expand All @@ -143,12 +140,10 @@ public function getRouteKey()
* @param null|string $routeKey
* @return GenerateLink
*/
public function setRouteKey( $routeKey )
public function setRouteKey($routeKey)
{
$this->routeKey = $routeKey;

return $this;
}


}
}
1 change: 1 addition & 0 deletions src/ZfcDatagrid/Column/Style/Color.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* general or based on a value
*
*/

namespace ZfcDatagrid\Column\Style;

class Color extends AbstractColor
Expand Down
7 changes: 7 additions & 0 deletions src/ZfcDatagrid/Column/Type/AbstractType.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,11 @@ public function getUserValue($val)
{
return $val;
}

/**
* Get the type name
*
* @return string
*/
abstract public function getTypeName();
}
17 changes: 10 additions & 7 deletions src/ZfcDatagrid/Column/Type/DateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class DateTime extends AbstractType
*
* @param string $sourceDateTimeFormat
* PHP DateTime format
* @param unknown $outputDateType
* @param unknown $outputTimeType
* @param int $outputDateType
* @param int $outputTimeType
* @param string $locale
* @param string $sourceTimezone
* @param string $outputTimezone
Expand All @@ -60,23 +60,26 @@ public function __construct($sourceDateTimeFormat = 'Y-m-d H:i:s', $outputDateTy
$this->setOutputTimezone($outputTimezone);
}

/**
* @return string
*/
public function getTypeName()
{
return 'dateTime';
}

/**
* Set Daterange Filter enabled true/false
* @param bool $val
*/
* Set Daterange Filter enabled true/false
* @param bool $val
*/
public function setDaterangePickerEnabled($val = true)
{
$this->daterangePickerEnabled = $val;
}

/**
* Check if the Daterange Filter is enabled
*/
* Check if the Daterange Filter is enabled
*/
public function isDaterangePickerEnabled()
{
return $this->daterangePickerEnabled;
Expand Down
4 changes: 4 additions & 0 deletions src/ZfcDatagrid/Column/Type/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/**
* Image type
*/

namespace ZfcDatagrid\Column\Type;

use InvalidArgumentException;
Expand All @@ -20,6 +21,9 @@ class Image extends AbstractType
*/
protected $resizeHeight = 20.5;

/**
* @return string
*/
public function getTypeName()
{
return 'image';
Expand Down
38 changes: 38 additions & 0 deletions src/ZfcDatagrid/DataSource/AbstractDataSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ abstract class AbstractDataSource implements DataSourceInterface
*/
protected $paginatorAdapter;

/**
* Set the data source
* - array
* - ZF2: Zend\Db\Sql\Select
* - Doctrine2: Doctrine\ORM\QueryBuilder
* - ...
*
* @param mixed $data
*/
public function __construct($data)
{
// we need this exception, because a abstract __construct, create a exception in php-unit for mocking
throw new \Exception(sprintf('Missing __construct in %s', get_class($this)));
}

/**
* Set the columns
*
Expand Down Expand Up @@ -65,6 +80,9 @@ public function addSortCondition(Column\AbstractColumn $column, $sortDirection =
];
}

/**
* @param array $sortConditions
*/
public function setSortConditions(array $sortConditions)
{
$this->sortConditions = $sortConditions;
Expand All @@ -89,6 +107,10 @@ public function addFilter(Filter $filter)
$this->filters[] = $filter;
}

/**
*
* @param array $filters
*/
public function setFilters(array $filters)
{
$this->filters = $filters;
Expand All @@ -103,6 +125,9 @@ public function getFilters()
return $this->filters;
}

/**
* @param PaginatorAdapterInterface $paginator
*/
public function setPaginatorAdapter(PaginatorAdapterInterface $paginator)
{
$this->paginatorAdapter = $paginator;
Expand All @@ -116,4 +141,17 @@ public function getPaginatorAdapter()
{
return $this->paginatorAdapter;
}

/**
* Get the data back from construct
* @return mixed
*/
abstract public function getData();

/**
* Execute the query and set the paginator
* - with sort statements
* - with filters statements
*/
abstract public function execute();
}
30 changes: 30 additions & 0 deletions src/ZfcDatagrid/DataSource/DataSourceInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php
namespace ZfcDatagrid\DataSource;

use ZfcDatagrid\Column;
use ZfcDatagrid\Filter;

interface DataSourceInterface
{
/**
Expand All @@ -27,4 +30,31 @@ public function getData();
* - with filters statements
*/
public function execute();

/**
* Set the columns
*
* @param array $columns
*/
public function setColumns(array $columns);

/**
* Set sort conditions
*
* @param Column\AbstractColumn $column
* @param string $sortDirection
*/
public function addSortCondition(Column\AbstractColumn $column, $sortDirection = 'ASC');

/**
*
* @param array $filters
*/
public function addFilter(Filter $filter);

/**
*
* @return \Zend\Paginator\Adapter\AdapterInterface
*/
public function getPaginatorAdapter();
}
2 changes: 1 addition & 1 deletion src/ZfcDatagrid/DataSource/Doctrine2/Filter.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
namespace ZfcDatagrid\DataSource\Doctrine2;

use Doctrine\ORM\QueryBuilder;
use Doctrine\ORM\Query\Expr;
use Doctrine\ORM\QueryBuilder;
use ZfcDatagrid\Column;
use ZfcDatagrid\Filter as DatagridFilter;

Expand Down
1 change: 1 addition & 0 deletions src/ZfcDatagrid/DataSource/Doctrine2/Paginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* or if we use the "safe" variant by Doctrine2
*
*/

namespace ZfcDatagrid\DataSource\Doctrine2;

use Doctrine\ORM\QueryBuilder;
Expand Down
2 changes: 1 addition & 1 deletion src/ZfcDatagrid/DataSource/Doctrine2Collection.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
namespace ZfcDatagrid\DataSource;

use DoctrineModule\Stdlib\Hydrator\DoctrineObject as DoctrineHydrator;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\EntityManager;
use DoctrineModule\Stdlib\Hydrator\DoctrineObject as DoctrineHydrator;
use ZfcDatagrid\DataSource\PhpArray as SourceArray;

class Doctrine2Collection extends AbstractDataSource
Expand Down
Loading

0 comments on commit 8b40cb2

Please sign in to comment.