-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
76 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Dakujem\Oliva; | ||
|
||
/** | ||
* DataNodeContract | ||
* | ||
* @author Andrej Rypak <xrypak@gmail.com> | ||
*/ | ||
interface DataNodeContract | ||
{ | ||
/** | ||
* @return mixed | ||
*/ | ||
public function data(); //:mixed; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Dakujem\Oliva; | ||
|
||
/** | ||
* Base contract supporting tree traversals. | ||
* | ||
* @author Andrej Rypak <xrypak@gmail.com> | ||
*/ | ||
interface TreeNodeContract | ||
{ | ||
public function parent(): ?TreeNodeContract; | ||
|
||
public function children(): iterable; | ||
|
||
/** | ||
* Returns `true` if the node has no children. | ||
*/ | ||
public function isLeaf(): bool; | ||
|
||
/** | ||
* Get a specific child. | ||
* | ||
* @param string|int $index | ||
* @return mixed | ||
*/ | ||
public function child(/*string|int*/ $index): ?TreeNodeContract; | ||
|
||
/** | ||
* @return string|int|null | ||
*/ | ||
public function childIndex(TreeNodeContract $node);//:mixed; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,6 @@ refactor | |
- traits into classes | ||
- ditch all PHP 5 constructs | ||
- fully typed | ||
|
||
add | ||
- address object/interface |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters