Skip to content

Commit

Permalink
Introduce steps
Browse files Browse the repository at this point in the history
  • Loading branch information
Baachi committed Apr 30, 2015
1 parent 45069d8 commit 9751e1d
Show file tree
Hide file tree
Showing 60 changed files with 687 additions and 1,074 deletions.
2 changes: 2 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tools:
external_code_coverage: true
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ language: php

sudo: false

php:
- 5.3
php:
- 5.4
- 5.5
- 5.6
Expand All @@ -17,7 +16,7 @@ matrix:

cache:
directories:
- $HOME/.composer/cache
- $HOME/.composer/cache

before_script:
- sh -c "if [ \"$TRAVIS_PHP_VERSION\" == \"hhvm\" ]; then composer require --dev mongofill/mongofill=dev-master --no-update; fi"
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"source": "https://github.com/ddeboer/data-import"
},
"require": {
"php": ">=5.3.0",
"php": ">=5.4.0",
"psr/log": "~1.0"
},
"require-dev": {
Expand Down
4 changes: 2 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="./tests/bootstrap.php" colors="true">
<phpunit bootstrap="./tests/bootstrap.php" colors="true" convertErrorsToExceptions="true">
<testsuites>
<testsuite name="ddeboer/data-import">
<directory suffix="Test.php">./tests</directory>
Expand All @@ -15,4 +15,4 @@
</exclude>
</whitelist>
</filter>
</phpunit>
</phpunit>
13 changes: 13 additions & 0 deletions src/Ddeboer/DataImport/Exception/MappingException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Ddeboer\DataImport\Exception;

/**
* Description of MappingException
*
* @author gnat
*/
class MappingException extends \Exception implements ExceptionInterface
{

}
48 changes: 0 additions & 48 deletions src/Ddeboer/DataImport/Filter/CallbackFilter.php

This file was deleted.

18 changes: 5 additions & 13 deletions src/Ddeboer/DataImport/Filter/DateTimeThresholdFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
* This filter can be used to filter out some items from a specific date. Useful
* to do incremental imports
*/
class DateTimeThresholdFilter implements FilterInterface
class DateTimeThresholdFilter
{
/**
* @var DateTime threshold dates strictly before this date will be filtered out.
* defaults to null
* @var \DateTime threshold dates strictly before this date will be filtered out.
* defaults to null
*/
protected $threshold;

Expand Down Expand Up @@ -47,14 +47,14 @@ public function __construct(
/**
* {@inheritDoc}
*/
public function filter(array $item)
public function __invoke(array $item)
{
if ($this->threshold == null) {
throw new \LogicException('Make sure you set a threshold');
}

return
$this->valueConverter->convert($item[$this->timeColumnName])
call_user_func($this->valueConverter, $item[$this->timeColumnName])
>=
$this->threshold;
}
Expand All @@ -69,12 +69,4 @@ public function setThreshold(\DateTime $value)

return $this;
}

/**
* {@inheritdoc}
*/
public function getPriority()
{
return $this->priority;
}
}
25 changes: 0 additions & 25 deletions src/Ddeboer/DataImport/Filter/FilterInterface.php

This file was deleted.

12 changes: 2 additions & 10 deletions src/Ddeboer/DataImport/Filter/OffsetFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @author Ville Mattila <ville@eventio.fi>
*/
class OffsetFilter implements FilterInterface
class OffsetFilter
{
/**
* @var int
Expand Down Expand Up @@ -50,7 +50,7 @@ public function __construct($offset = 0, $limit = null)
/**
* {@inheritDoc}
*/
public function filter(array $item)
public function __invoke(array $item)
{
// In case we've already filtered up to limited
if ($this->maxLimitHit) {
Expand Down Expand Up @@ -81,12 +81,4 @@ public function filter(array $item)

return false;
}

/**
* {@inheritdoc}
*/
public function getPriority()
{
return 128;
}
}
12 changes: 2 additions & 10 deletions src/Ddeboer/DataImport/Filter/ValidatorFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Symfony\Component\Validator\Constraints;
use Ddeboer\DataImport\Exception\ValidationException;

class ValidatorFilter implements FilterInterface
class ValidatorFilter
{
private $validator;

Expand Down Expand Up @@ -50,7 +50,7 @@ public function getViolations()
return $this->violations;
}

public function filter(array $item)
public function __invoke(array $item)
{
if (!$this->strict) {
// Only validate properties which have an constaint.
Expand All @@ -72,12 +72,4 @@ public function filter(array $item)

return 0 === count($list);
}

/**
* {@inheritdoc}
*/
public function getPriority()
{
return 256;
}
}
38 changes: 0 additions & 38 deletions src/Ddeboer/DataImport/ItemConverter/CallbackItemConverter.php

This file was deleted.

20 changes: 0 additions & 20 deletions src/Ddeboer/DataImport/ItemConverter/ItemConverterInterface.php

This file was deleted.

Loading

3 comments on commit 9751e1d

@delphimat
Copy link

@delphimat delphimat commented on 9751e1d Jul 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damn but where is the documentation Oo. You changed a lot of function. now too upgrade to the last version It is a mess. #needHelp.

CallbackValueConverter <= ?
CallbackFilter < = ?

Thanks

@Baachi
Copy link
Collaborator Author

@Baachi Baachi commented on 9751e1d Jul 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @delphimat,

first of all its better to open an issue instead of comment to a 1 year old commit.

To your question:
The CallbackValueConverter and the CallbackFilter isn't needed anymore, because each filter has to be callable. So you only need to pass a Closure.

@delphimat
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Baachi Thanks for you answer and sorry for the issue.

I'm new at all this community things , i was just too lost because i didn't find anything in the doc for the bundle. I will just remove my post.

And take care a little more when i write something.

have a nice day

Please sign in to comment.