Skip to content

Commit e0266df

Browse files
committed
feat: add ExecutorItem class and refactor ExecutorPool to manage executor items
1 parent 34c94d9 commit e0266df

File tree

2 files changed

+40
-3
lines changed

2 files changed

+40
-3
lines changed

src/Classes/ExecutorItem.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace Pharaonic\Laravel\Executor\Classes;
4+
5+
class ExecutorItem
6+
{
7+
public Executor $executor;
8+
public string $path;
9+
10+
public function __construct(Executor $executor, string $path)
11+
{
12+
$this->executor = $executor;
13+
$this->path = $path;
14+
}
15+
16+
/**
17+
* Get info about the executor.
18+
*
19+
* @return array
20+
*/
21+
public function info()
22+
{
23+
return [
24+
'type' => $this->executor->type,
25+
'tags' => $this->executor->tags,
26+
'servers' => $this->executor->servers,
27+
'path' => $this->path,
28+
];
29+
}
30+
}

src/Classes/ExecutorPool.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@ class ExecutorPool
1111
*
1212
* @var array
1313
*/
14-
private array $paths = [];
14+
protected array $paths = [];
15+
16+
/**
17+
* All executors items.
18+
*
19+
* @var array
20+
*/
21+
protected array $items = [];
1522

1623
public function __construct()
1724
{
@@ -44,10 +51,10 @@ public function getPaths(): array
4451
*
4552
* @return array
4653
*/
47-
public function getExecutorsPaths()
54+
public function collect()
4855
{
4956
$list = [];
50-
57+
5158
foreach ($this->paths as $path) {
5259
if (File::isDirectory($path) && ! File::isEmptyDirectory($path, true)) {
5360
foreach (File::files($path) as $executor) {

0 commit comments

Comments
 (0)