-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from vitorccs/feature/add_importing_feature
Adds CSV Importing feature
- Loading branch information
Showing
97 changed files
with
2,831 additions
and
555 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Concerns/FromArray.php → src/Concerns/Exportables/FromArray.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Concerns/FromCollection.php → src/Concerns/Exportables/FromCollection.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/Concerns/FromQuery.php → src/Concerns/Exportables/FromQuery.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Concerns/FromQueryCursor.php → src/Concerns/Exportables/FromQueryCursor.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Vitorccs\LaravelCsv\Concerns\Importables; | ||
|
||
interface FromContents | ||
{ | ||
/** | ||
* @return string | ||
*/ | ||
public function contents(): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Vitorccs\LaravelCsv\Concerns\Importables; | ||
|
||
interface FromDisk | ||
{ | ||
/** | ||
* @return string|null | ||
*/ | ||
public function disk(): ?string; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function filename(): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Vitorccs\LaravelCsv\Concerns\Importables; | ||
|
||
interface FromFile | ||
{ | ||
/** | ||
* @return string | ||
*/ | ||
public function filename(): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Vitorccs\LaravelCsv\Concerns\Importables; | ||
|
||
interface FromResource | ||
{ | ||
/** | ||
* @return resource | ||
*/ | ||
public function resource(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
namespace Vitorccs\LaravelCsv\Concerns\Importables; | ||
|
||
use Vitorccs\LaravelCsv\Entities\CsvConfig; | ||
use Vitorccs\LaravelCsv\Facades\CsvImporter; | ||
|
||
trait Importable | ||
{ | ||
/** | ||
* @return int|null | ||
*/ | ||
public function limit(): ?int | ||
{ | ||
return null; | ||
} | ||
|
||
/** | ||
* @return CsvConfig | ||
*/ | ||
public function getConfig(): CsvConfig | ||
{ | ||
return CsvImporter::getConfig(); | ||
} | ||
|
||
/** | ||
* @param CsvConfig $config | ||
*/ | ||
public function setConfig(CsvConfig $config): void | ||
{ | ||
CsvImporter::setConfig($config); | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function count(): int | ||
{ | ||
return CsvImporter::count($this); | ||
} | ||
|
||
/** | ||
* @param callable(array,int):void $callable | ||
* @param int|null $size | ||
* @return void | ||
*/ | ||
public function chunkArray(callable $callable, | ||
?int $size = null): void | ||
{ | ||
CsvImporter::chunkArray($this, $callable, $size); | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getArray(): array | ||
{ | ||
return CsvImporter::getArray($this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Vitorccs\LaravelCsv\Handlers\Readers; | ||
|
||
interface Handler | ||
{ | ||
/** | ||
* @return int | ||
*/ | ||
public function count(): int; | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getAll(): array; | ||
|
||
/** | ||
* @param callable(array,int):void $callable | ||
* @param int $size | ||
* @param int|null $maxRecords | ||
* @return void | ||
*/ | ||
public function getChunk(callable $callable, | ||
int $size, | ||
?int $maxRecords = null): void; | ||
|
||
/** | ||
* @return resource | ||
*/ | ||
public function getResource(); | ||
} |
Oops, something went wrong.