Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 75a89e5

Browse files
committedJan 2, 2025·
#155 Add docs for [Input][FileReader|LineReader|FolderBrowser]Tasks
1 parent 745db03 commit 75a89e5

7 files changed

+260
-3
lines changed
 

‎docs/index.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,14 @@
5555
- [YamlWriterTask]
5656
- File
5757
- [FileMoverTask]
58-
- [FileReaderTask]
58+
- [FileReaderTask](reference/tasks/file_reader_task.md)
5959
- [FileRemoverTask]
6060
- [FileWriterTask]
61-
- [FolderBrowserTask]
62-
- [InputFolderBrowserTask]
61+
- [FolderBrowserTask](reference/tasks/folder_browser_task.md)
62+
- [InputFileReaderTask](reference/tasks/input_file_reader_task.md)
63+
- [InputFolderBrowserTask](reference/tasks/input_folder_browser_task.md)
64+
- [InputLineReaderTask](reference/tasks/input_line_reader_task.md)
65+
- [LineReaderTask](reference/tasks/line_reader_task.md)
6366
- Flow manipulation
6467
- [AggregateIterableTask](reference/tasks/aggregate_iterable_task.md)
6568
- [InputAggregatorTask](reference/tasks/input_aggregator_task.md)
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
FileReaderTask
2+
=============
3+
4+
Reads a file and return raw content as a string
5+
6+
Task reference
7+
--------------
8+
9+
* **Service**: `CleverAge\ProcessBundle\Task\File\FileReaderTask`
10+
11+
Accepted inputs
12+
---------------
13+
14+
Input is ignored
15+
16+
Possible outputs
17+
----------------
18+
19+
`string`: raw content of the file.
20+
Underlying method is [file_get_contents](https://www.php.net/manual/en/function.file-get-contents.php).
21+
22+
Options
23+
-------
24+
25+
| Code | Type | Required | Default | Description |
26+
|------------|----------|:---------:|----------|------------------------------------------|
27+
| `filename` | `string` | **X** | | Path of the file to read from (absolute) |
28+
29+
Example
30+
-------
31+
32+
```yaml
33+
# Task configuration level
34+
code:
35+
service: '@CleverAge\ProcessBundle\Task\File\FileReaderTask'
36+
options:
37+
filename: 'path/to/file.txt'
38+
```
39+
40+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
FolderBrowserTask
2+
=============
3+
4+
Reads a folder and iterate on each file, returning absolute path as string.
5+
6+
Task reference
7+
--------------
8+
9+
* **Service**: `CleverAge\ProcessBundle\Task\File\FolderBrowserTask`
10+
* **Iterable task**
11+
12+
Accepted inputs
13+
---------------
14+
15+
Input is ignored
16+
17+
Possible outputs
18+
----------------
19+
20+
`string`: absolute path of the file.
21+
Underlying method is [Symfony Finder component](https://symfony.com/doc/current/components/finder.html).
22+
23+
Options
24+
-------
25+
26+
| Code | Type | Required | Default | Description |
27+
|-------------------|-------------------------------|:---------:|---------------------------|------------------------------------|
28+
| `folder_path` | `string` | **X** | | Path of the directory to read from |
29+
| `name_pattern` | `null` or `string` or `array` | | null | Restrict files using a pattern |
30+
| `empty_log_level` | `string` | | Psr\Log\LogLevel::WARNING | From Psr\Log\LogLevel constants |
31+
32+
Example
33+
-------
34+
35+
```yaml
36+
# Task configuration level
37+
code:
38+
service: '@CleverAge\ProcessBundle\Task\File\FolderBrowserTask'
39+
options:
40+
folder_path: '%kernel.project_dir%/var/data'
41+
```
42+
43+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
InputFileReaderTask
2+
=============
3+
4+
Reads a file and return raw content as a string
5+
6+
Task reference
7+
--------------
8+
9+
* **Service**: `CleverAge\ProcessBundle\Task\File\InputFileReaderTask`
10+
11+
Accepted inputs
12+
---------------
13+
14+
`string`: file path
15+
16+
Possible outputs
17+
----------------
18+
19+
`string`: raw content of the file.
20+
Underlying method is [file_get_contents](https://www.php.net/manual/en/function.file-get-contents.php).
21+
22+
Options
23+
-------
24+
25+
None
26+
27+
Example
28+
-------
29+
30+
```yaml
31+
# Task configuration level
32+
entry:
33+
service: '@CleverAge\ProcessBundle\Task\File\FolderBrowserTask'
34+
options:
35+
folder_path: '%kernel.project_dir%/var/data'
36+
outputs: read
37+
read:
38+
service: '@CleverAge\ProcessBundle\Task\File\InputFileReaderTask'
39+
```
40+
41+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
InputFolderBrowserTask
2+
=============
3+
4+
Reads a folder and iterate on each file, returning absolute path as string.
5+
6+
Task reference
7+
--------------
8+
9+
* **Service**: `CleverAge\ProcessBundle\Task\File\InputFolderBrowserTask`
10+
* **Iterable task**
11+
12+
Accepted inputs
13+
---------------
14+
15+
`string`: folder path
16+
17+
Possible outputs
18+
----------------
19+
20+
`string`: absolute path of the file.
21+
Underlying method is [Symfony Finder component](https://symfony.com/doc/current/components/finder.html).
22+
23+
Options
24+
-------
25+
26+
| Code | Type | Required | Default | Description |
27+
|--------------------|----------|:---------:|---------|---------------------------------------|
28+
| `base_folder_path` | `string` | | | Concatenated with input `folder_path` |
29+
30+
Example
31+
-------
32+
33+
```yaml
34+
# Task configuration level
35+
entry:
36+
service: '@CleverAge\ProcessBundle\Task\ConstantOutputTask'
37+
options:
38+
output: '/var/data'
39+
outputs: directory
40+
directory:
41+
service: '@CleverAge\ProcessBundle\Task\File\InputFolderBrowserTask'
42+
options:
43+
base_folder_path: '%kernel.project_dir%'
44+
outputs: read
45+
```
46+
47+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
InputLineReaderTask
2+
=============
3+
4+
Reads a file and iterate on each line, returning content as string. Skips empty lines.
5+
6+
Task reference
7+
--------------
8+
9+
* **Service**: `CleverAge\ProcessBundle\Task\File\InputLineReaderTask`
10+
* **Iterable task**
11+
12+
Accepted inputs
13+
---------------
14+
15+
`string`: file path
16+
17+
Possible outputs
18+
----------------
19+
20+
`string`: foreach line, it will return content as string.
21+
Underlying method is [SplFileObject](https://www.php.net/manual/en/class.splfileobject.php).
22+
23+
Options
24+
-------
25+
26+
None
27+
28+
Example
29+
-------
30+
31+
```yaml
32+
# Task configuration level
33+
entry:
34+
service: '@CleverAge\ProcessBundle\Task\File\FolderBrowserTask'
35+
options:
36+
folder_path: '%kernel.project_dir%/var/data'
37+
outputs: read
38+
read:
39+
service: '@CleverAge\ProcessBundle\Task\File\InputLineReaderTask'
40+
```
41+
42+
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
LineReaderTask
2+
=============
3+
4+
Reads a file and iterate on each line, returning content as string. Skips empty lines.
5+
6+
Task reference
7+
--------------
8+
9+
* **Service**: `CleverAge\ProcessBundle\Task\File\LineReaderTask`
10+
* **Iterable task**
11+
12+
Accepted inputs
13+
---------------
14+
15+
Input is ignored
16+
17+
Possible outputs
18+
----------------
19+
20+
`string`: foreach line, it will return content as string.
21+
Underlying method is [SplFileObject](https://www.php.net/manual/en/class.splfileobject.php).
22+
23+
Options
24+
-------
25+
26+
| Code | Type | Required | Default | Description |
27+
|------------|----------|:---------:|----------|------------------------------------------|
28+
| `filename` | `string` | **X** | | Path of the file to read from (absolute) |
29+
30+
Example
31+
-------
32+
33+
```yaml
34+
# Task configuration level
35+
code:
36+
service: '@CleverAge\ProcessBundle\Task\File\LineReaderTask'
37+
options:
38+
filename: 'path/to/file.txt'
39+
```
40+
41+

0 commit comments

Comments
 (0)
Please sign in to comment.