Skip to content

Commit 3d2cf83

Browse files
committed
#4 add logic in class
1 parent 236a1b7 commit 3d2cf83

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/Extractors/Attributes/AttributeExtract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
interface AttributeExtract
88
{
9-
/** @return array<string, mixed> */
9+
/** @return array<int, array<string, mixed>> */
1010
public function extract(): array;
1111
}

src/Extractors/Attributes/BodyParamAttributeExtract.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace DenisKorbakov\LaravelDataScribe\Extractors\Attributes;
66

7+
use Knuckles\Scribe\Attributes\BodyParam;
78
use ReflectionAttribute;
89

910
/** Extracts Body Param attribute from method attributes */
@@ -15,9 +16,19 @@ public function __construct(
1516
) {
1617
}
1718

18-
/** @return array<string, string> Get array arguments or empty array */
19+
/** @return array<int, array<string, mixed>> Get array arguments or empty array */
1920
public function extract(): array
2021
{
21-
return ['test' => 'test'];
22+
$arguments = [];
23+
24+
foreach ($this->attributes as $attribute) {
25+
if ($attribute instanceof ReflectionAttribute) {
26+
if(is_a($attribute->getName(), BodyParam::class, true)) {
27+
$arguments[] = $attribute->getArguments();
28+
}
29+
}
30+
}
31+
32+
return $arguments;
2233
}
2334
}

0 commit comments

Comments
 (0)