1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-22 17:31:35 +02:00
invoiceninja/app/Ninja/Import/Harvest/ClientTransformer.php

28 lines
566 B
PHP
Raw Normal View History

<?php namespace App\Ninja\Import\Harvest;
2015-12-08 11:10:20 +01:00
use App\Ninja\Import\BaseTransformer;
use League\Fractal\Resource\Item;
/**
* Class ClientTransformer
*/
2015-12-08 11:10:20 +01:00
class ClientTransformer extends BaseTransformer
{
/**
* @param $data
* @return bool|Item
*/
2015-12-08 11:10:20 +01:00
public function transform($data)
{
2015-12-08 11:10:20 +01:00
if ($this->hasClient($data->client_name)) {
return false;
}
2015-12-08 11:10:20 +01:00
return new Item($data, function ($data) {
return [
2016-01-06 08:52:26 +01:00
'name' => $this->getString($data, 'client_name'),
];
});
}
}