Skip to content
This repository has been archived by the owner on Jan 16, 2018. It is now read-only.

Commit

Permalink
Merge pull request #51 from rollerworks/analysis-qoLyQp
Browse files Browse the repository at this point in the history
Applied fixes from StyleCI
  • Loading branch information
sstok authored Sep 20, 2016
2 parents aaf3770 + af9c199 commit eb82960
Show file tree
Hide file tree
Showing 23 changed files with 117 additions and 69 deletions.
14 changes: 7 additions & 7 deletions src/Column/ColumnInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,38 +42,38 @@ public function getType();
* @param DataTransformerInterface $viewTransformer
* @param bool $forcePrepend if set to true, prepend instead of appending
*
* @return self The configuration object.
* @return self The configuration object
*/
public function addViewTransformer(DataTransformerInterface $viewTransformer, $forcePrepend = false);

/**
* Clears the view transformers.
*
* @return self The configuration object.
* @return self The configuration object
*/
public function resetViewTransformers();

/**
* Returns the view transformers of the column cell.
*
* @return DataTransformerInterface[] An array of {@link DataTransformerInterface} instances.
* @return DataTransformerInterface[] An array of {@link DataTransformerInterface} instances
*/
public function getViewTransformers();

/**
* Returns all options passed during the construction of the column.
*
* @return array The passed options.
* @return array The passed options
*/
public function getOptions();

/**
* Returns the value of a specific option.
*
* @param string $name The option name.
* @param mixed $default The value returned if the option does not exist.
* @param string $name The option name
* @param mixed $default The value returned if the option does not exist
*
* @return mixed The option value.
* @return mixed The option value
*/
public function getOption($name, $default = null);

Expand Down
6 changes: 3 additions & 3 deletions src/Column/ColumnTypeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface ColumnTypeInterface
/**
* Sets the default options for this type.
*
* @param OptionsResolver $resolver The resolver for the options.
* @param OptionsResolver $resolver The resolver for the options
*/
public function configureOptions(OptionsResolver $resolver);

Expand Down Expand Up @@ -54,14 +54,14 @@ public function buildHeaderView(HeaderView $view, ColumnInterface $column, array
/**
* Returns the prefix of the template block name for this type.
*
* @return string The prefix of the template block name.
* @return string The prefix of the template block name
*/
public function getBlockPrefix();

/**
* Returns the fully-qualified class name of the parent type.
*
* @return string|null The name of the parent type if any, null otherwise.
* @return string|null The name of the parent type if any, null otherwise
*/
public function getParent();
}
6 changes: 3 additions & 3 deletions src/Column/ColumnTypeRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ColumnTypeRegistry implements ColumnTypeRegistryInterface
* Constructor.
*
* @param DatagridExtensionInterface[] $extensions An array of DatagridExtensionInterface
* @param ResolvedColumnTypeFactoryInterface $resolvedTypeFactory The factory for resolved form types.
* @param ResolvedColumnTypeFactoryInterface $resolvedTypeFactory The factory for resolved form types
*
* @throws UnexpectedTypeException if an extension does not implement DatagridExtensionInterface
*/
Expand Down Expand Up @@ -119,9 +119,9 @@ public function getExtensions()
* Wraps a type into a ResolvedFormTypeInterface implementation and connects
* it with its parent type.
*
* @param ColumnTypeInterface $type The type to resolve.
* @param ColumnTypeInterface $type The type to resolve
*
* @return ResolvedColumnTypeInterface The resolved type.
* @return ResolvedColumnTypeInterface The resolved type
*/
private function resolveType(ColumnTypeInterface $type)
{
Expand Down
10 changes: 5 additions & 5 deletions src/Column/ResolvedColumnTypeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,28 @@ interface ResolvedColumnTypeInterface
/**
* Returns the prefix of the template block name for this type.
*
* @return string The prefix of the template block name.
* @return string The prefix of the template block name
*/
public function getBlockPrefix();

/**
* Returns the parent type.
*
* @return ResolvedColumnTypeInterface|null The parent type or null.
* @return ResolvedColumnTypeInterface|null The parent type or null
*/
public function getParent();

/**
* Returns the wrapped column type.
*
* @return ColumnTypeInterface The wrapped form type.
* @return ColumnTypeInterface The wrapped form type
*/
public function getInnerType();

/**
* Returns the extensions of the wrapped column type.
*
* @return ColumnTypeExtensionInterface[] An array of {@link ColumnTypeExtensionInterface} instances.
* @return ColumnTypeExtensionInterface[] An array of {@link ColumnTypeExtensionInterface} instances
*/
public function getTypeExtensions();

Expand Down Expand Up @@ -110,7 +110,7 @@ public function buildCellView(CellView $view, ColumnInterface $column, array $op
/**
* Returns the configured options resolver used for this type.
*
* @return \Symfony\Component\OptionsResolver\OptionsResolver The options resolver.
* @return \Symfony\Component\OptionsResolver\OptionsResolver The options resolver
*/
public function getOptionsResolver();

Expand Down
2 changes: 1 addition & 1 deletion src/DataTransformerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ interface DataTransformerInterface
*
* @param mixed $value The value in the original representation
*
* @throws TransformationFailedException When the transformation fails.
* @throws TransformationFailedException When the transformation fails
*
* @return mixed The value in the transformed representation
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Datagrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ class Datagrid implements DatagridInterface
/**
* Constructor.
*
* @param string $name Name of the datagrid.
* @param string $name Name of the datagrid
* @param ColumnInterface[] $columns Columns of the datagrid
* @param callable|null $viewBuilder A callable view builder.
* Use the decorator pattern to chain multiple.
* Use the decorator pattern to chain multiple
*/
public function __construct($name, array $columns, callable $viewBuilder = null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/DatagridFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function createColumn($name, $type, array $options = []);
/**
* Create a new DatagridInterface instance with a unique name.
*
* @param string $name Name of the datagrid.
* @param string $name Name of the datagrid
* @param ColumnInterface[] $columns Columns of the datagrid
*
* @return DatagridInterface
Expand Down
4 changes: 2 additions & 2 deletions src/DatagridInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ public function createView();
*
* @param array|\Traversable $data
*
* @throws BadMethodCallException When data was already set.
* @throws BadMethodCallException When data was already set
*/
public function setData($data);

/**
* Returns the data collection of the datagrid.
*
* @return array|\Traversable|null Returns null when no data was set.
* @return array|\Traversable|null Returns null when no data was set
*/
public function getData();
}
4 changes: 1 addition & 3 deletions src/DatagridRowView.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

use Rollerworks\Component\Datagrid\Column\CellView;
use Rollerworks\Component\Datagrid\Column\ColumnInterface;
use Rollerworks\Component\Datagrid\Exception\BadMethodCallException;
use Rollerworks\Component\Datagrid\Exception\UnexpectedTypeException;

/**
* @author Sebastiaan Stok <[email protected]>
Expand Down Expand Up @@ -83,7 +81,7 @@ public function count()
/**
* Returns an iterator for the cells.
*
* @return \ArrayIterator The iterator.
* @return \ArrayIterator The iterator
*/
public function getIterator()
{
Expand Down
2 changes: 1 addition & 1 deletion src/DatagridView.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function count()
/**
* Returns an iterator to iterate over rows (implements \IteratorAggregate).
*
* @return \ArrayIterator The iterator.
* @return \ArrayIterator The iterator
*/
public function getIterator()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct($inputTimezone = null, $outputTimezone = null, array
* @throws TransformationFailedException If the given value is not an array,
* if the value could not be transformed
* or if the input timezone is not
* supported.
* supported
*
* @return \DateTime Normalized date
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ public function __construct($inputTimezone = null, $outputTimezone = null, $date
/**
* Transforms a normalized date into a localized date string.
*
* @param \DateTime $dateTime Normalized date.
* @param \DateTime $dateTime Normalized date
*
* @throws TransformationFailedException If the given value is not an instance
* of \DateTime or if the date could not
* be transformed.
* be transformed
*
* @return string|array Localized date string/array.
* @return string|array Localized date string/array
*/
public function transform($dateTime)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class IntegerToLocalizedStringTransformer extends NumberToLocalizedStringTransfo
/**
* Constructs a transformer.
*
* @param int $precision Unused.
* @param bool $grouping Whether thousands should be grouped.
* @param int $roundingMode One of the ROUND_ constants in this class.
* @param int $precision Unused
* @param bool $grouping Whether thousands should be grouped
* @param int $roundingMode One of the ROUND_ constants in this class
*/
public function __construct($precision = null, $grouping = null, $roundingMode = self::ROUND_DOWN)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function __construct($precision = null, $grouping = null, $roundingMode =
* @param array|string|int|float $value array, float or string
*
* @throws TransformationFailedException If the given value is not numeric or
* if the value can not be transformed.
* if the value can not be transformed
*
* @return string Localized money string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ public function __construct($precision = null, $grouping = null, $roundingMode =
/**
* Transforms a number type into localized number.
*
* @param int|float $value Number value.
* @param int|float $value Number value
*
* @throws TransformationFailedException If the given value is not numeric
* or if the value can not be transformed.
* or if the value can not be transformed
*
* @return string Localized value.
* @return string Localized value
*/
public function transform($value)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function __construct($inputTimezone = null, $outputTimezone = null, $form
*
* @throws TransformationFailedException If the given value is not a string,
* if the date could not be parsed or
* if the input timezone is not supported.
* if the input timezone is not supported
*
* @return \DateTime An instance of \DateTime
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class TimestampToDateTimeTransformer extends BaseDateTimeTransformer
* @param string $value A timestamp
*
* @throws TransformationFailedException If the given value is not a timestamp
* or if the given timestamp is invalid.
* or if the given timestamp is invalid
*
* @return \DateTime A \DateTime object
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Extension/Core/Type/ColumnType.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function getParent()
/**
* Returns the prefix of the template block name for this type.
*
* @return string The prefix of the template block name.
* @return string The prefix of the template block name
*/
public function getBlockPrefix()
{
Expand Down
4 changes: 2 additions & 2 deletions src/PreloadedExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ class PreloadedExtension implements DatagridExtensionInterface
* Creates a new preloaded extension.
*
* @param ColumnTypeInterface[] $types The column-types that the extension
* should support.
* should support
* @param ColumnTypeExtensionInterface[] $typeExtensions The column-type extensions that the extension
* should support.
* should support
*/
public function __construct(array $types, array $typeExtensions)
{
Expand Down
36 changes: 27 additions & 9 deletions tests/DatagridPerformanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,21 @@ public function testGenerateViewWith100RowsAnd10Columns()

$datagrid = $this->factory->createDatagridBuilder('test');

$datagrid->add('id', NumberType::class, ['data_provider' => function ($data) { return $data['id']; }]);
$datagrid->add('name', TextType::class, ['data_provider' => function ($data) { return $data['name']; }]);
$datagrid->add('email', TextType::class, ['data_provider' => function ($data) { return $data['email']; }]);
$datagrid->add('regdate', DateTimeType::class, ['data_provider' => function ($data) { return $data['regdate']; }]);
$datagrid->add('lastModified', DateTimeType::class, ['data_provider' => function ($data) { return $data['lastModified']; }]);
$datagrid->add('id', NumberType::class, ['data_provider' => function ($data) {
return $data['id'];
}]);
$datagrid->add('name', TextType::class, ['data_provider' => function ($data) {
return $data['name'];
}]);
$datagrid->add('email', TextType::class, ['data_provider' => function ($data) {
return $data['email'];
}]);
$datagrid->add('regdate', DateTimeType::class, ['data_provider' => function ($data) {
return $data['regdate'];
}]);
$datagrid->add('lastModified', DateTimeType::class, ['data_provider' => function ($data) {
return $data['lastModified'];
}]);
$datagrid->add(
'status',
TextType::class,
Expand All @@ -68,7 +78,9 @@ public function testGenerateViewWith100RowsAnd10Columns()
ActionType::class,
[
'label' => 'Modify',
'data_provider' => function ($data) { return ['id' => $data['id']]; },
'data_provider' => function ($data) {
return ['id' => $data['id']];
},
'uri_scheme' => 'entity/{id}/modify',
]
),
Expand All @@ -77,7 +89,9 @@ public function testGenerateViewWith100RowsAnd10Columns()
ActionType::class,
[
'label' => 'Delete',
'data_provider' => function ($data) { return ['id' => $data['id']]; },
'data_provider' => function ($data) {
return ['id' => $data['id']];
},
'uri_scheme' => 'entity/{id}/delete',
]
),
Expand Down Expand Up @@ -150,7 +164,9 @@ public function testGenerateViewWith100RowsAnd10ColumnsAutoDataProvider()
ActionType::class,
[
'label' => 'Modify',
'data_provider' => function ($data) { return ['id' => $data['id']]; },
'data_provider' => function ($data) {
return ['id' => $data['id']];
},
'uri_scheme' => 'entity/{id}/modify',
]
),
Expand All @@ -159,7 +175,9 @@ public function testGenerateViewWith100RowsAnd10ColumnsAutoDataProvider()
ActionType::class,
[
'label' => 'Delete',
'data_provider' => function ($data) { return ['id' => $data['id']]; },
'data_provider' => function ($data) {
return ['id' => $data['id']];
},
'uri_scheme' => 'entity/{id}/delete',
]
),
Expand Down
Loading

0 comments on commit eb82960

Please sign in to comment.