Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/Annotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@ class Annotation implements AnnotationInterface
{
/**
* ----------------------|
* Parameter separator |
* Parameter separator
* ----------------------|
* Разделитель параметров|
* Разделитель параметров
* ----------------------|
*
* --------------------------------------------------------|
* in the line ',', example: key='param', key2='param2' |
* in the array ';', example: {key:'param'; key2:'param2'} |
* in the line ',', example: key='param', key2='param2'
* in the array ';', example: {key:'param'; key2:'param2'}
* --------------------------------------------------------|
*/
public const array DELIMITER = ["string" => ',', "array" => ';'];

/**
* -----------------|
* Assignment mark |
* Assignment mark
* -----------------|
* Знак присваивания|
* Знак присваивания
* -----------------|
*
* ----------------------------------------|
* in the line '=', example: key='param' |
* in the array ':', example: {key:'param'}|
* in the line '=', example: key='param'
* in the array ':', example: {key:'param'}
* ----------------------------------------|
*/
public const array ASSIGNMENT = ["string" => '=', "array" => ':'];
Expand Down Expand Up @@ -114,9 +114,9 @@ private function parseAnnotations(string $docBlock): array

/**
* --------------------------------------------------------------------------------------|
* $matches[0][0] - @Annotation(param1, param2='param2', param3={param1;param2:'param2'})|
* $matches[1][0] - Annotation |
* $matches[2][0] - param1, param2 = 'param2', param3={param1;param2:'param2'} |
* $matches[0][0] - @Annotation(param1, param2='param2', param3={param1;param2:'param2'})
* $matches[1][0] - Annotation
* $matches[2][0] - param1, param2 = 'param2', param3={param1;param2:'param2'}
* --------------------------------------------------------------------------------------|
*/
if (preg_match_all("/@([A-Za-z_-]+)\((.*)?\)/", $docBlock, $matches)) {
Expand All @@ -125,7 +125,7 @@ private function parseAnnotations(string $docBlock): array

/**
* ----------------------------------------------------------------------------------------------------------------------|
* $annotations = ["Annotation" => [[0 => "param1", "param2" => "param2", "param3" => ["param1", "param2" => "param2"]]]]|
* $annotations = ["Annotation" => [[0 => "param1", "param2" => "param2", "param3" => ["param1", "param2" => "param2"]]]]
* ----------------------------------------------------------------------------------------------------------------------|
*/
for ($i = 0; $i < $count; $i++) {
Expand Down
30 changes: 15 additions & 15 deletions src/ParamsExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ class ParamsExtractor
{
/**
* --------------------------------------------------------------|
* Parses an array of parameter strings into an associative array|
* Parses an array of parameter strings into an associative array
* --------------------------------------------------------------|
* Преобразует массив строк с параметрами в ассоциативный массив |
* Преобразует массив строк с параметрами в ассоциативный массив
* --------------------------------------------------------------|
*
* ------------------------------------------------------------------------------------|
* `from: "param1, param2 = 'param2', param3={param1;param2:'param2'}"` |
* `to: ["param1", "param2" => "param2", "param3" => ["param1", "param2" => "param2"]]`|
* `from: "param1, param2 = 'param2', param3={param1;param2:'param2'}"`
* `to: ["param1", "param2" => "param2", "param3" => ["param1", "param2" => "param2"]]`
* ------------------------------------------------------------------------------------|
*
* @param array $exploded
Expand All @@ -46,18 +46,18 @@ public function getParams(array $exploded, string $assignment): array

/**
* --------------------------------------------|
* Parses data into `key => value` pairs |
* Parses data into `key => value` pairs
* --------------------------------------------|
* Преобразует данные в пары `ключ => значение`|
* Преобразует данные в пары `ключ => значение`
* --------------------------------------------|
*
* ⚠️ IMPORTANT / ВАЖНО:
* --------------------------------------------|
* Values inside arrays (curly braces) must not|
* contain the array assignment mark (`:`) |
* Values inside arrays (curly braces) must not
* contain the array assignment mark (`:`)
* --------------------------------------------|
* Значения внутри массивов (фигурные скобки) |
* не должны содержать знак присваивания (`:`) |
* Значения внутри массивов (фигурные скобки)
* не должны содержать знак присваивания (`:`)
* --------------------------------------------|
*
* @param string $data
Expand All @@ -69,9 +69,9 @@ private function handleData(string $data, array $exploded): ?array
{
/**
* --------------------------------------------------------------|
* If in data an array of type param3={param1;param2:'param2'} |
* If in data an array of type param3={param1;param2:'param2'}
* --------------------------------------------------------------|
* Если в данных есть массив типа param3={param1;param2:'param2'}|
* Если в данных есть массив типа param3={param1;param2:'param2'}
* --------------------------------------------------------------|
*/
if (preg_match("/=\s*{/", $data) && preg_match("/{(.*)}/", $exploded[1], $matches)) {
Expand All @@ -85,13 +85,13 @@ private function handleData(string $data, array $exploded): ?array

/**
* ---------------------------------------|
* Remove quotation marks around parameter|
* Remove quotation marks around parameter
* ---------------------------------------|
* Удаляет кавычки вокруг параметра |
* Удаляет кавычки вокруг параметра
* ---------------------------------------|
*
* ----------------------|
* matches[1] = 'param2';|
* matches[1] = 'param2';
* ----------------------|
*/
if (preg_match("/'(.*)'/", $exploded[1], $matches)) {
Expand Down
Loading