Skip to content

Commit

Permalink
HP-1751 added ability to check if PriceTypeDefinition has specific be…
Browse files Browse the repository at this point in the history
…haviour
  • Loading branch information
VadymHrechukha committed Jan 3, 2025
1 parent 10cb39b commit 2a0421b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/product/ParentNodeDefinitionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
interface ParentNodeDefinitionInterface
{
public function withBehaviors(): BehaviorCollection;

public function hasBehavior(string $behaviorClassName): bool;
}
11 changes: 11 additions & 0 deletions src/product/PriceTypeDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,17 @@ public function withBehaviors(): PriceTypeDefinitionBehaviourCollection
return $this->behaviorCollection;
}

public function hasBehavior(string $behaviorClassName): bool
{
foreach ($this->behaviorCollection as $behavior) {
if ($behavior instanceof $behaviorClassName) {
return true;
}
}

return false;
}

/**
* це параметер визначає агрегатну функцію яка застосовується для щоденно записаних ресурсів щоб визнизначти
* місячне споживання за яке потрібно пробілити клієнта
Expand Down

0 comments on commit 2a0421b

Please sign in to comment.