-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use class for graph isplay params
- Loading branch information
1 parent
46c95bd
commit 8dbb7eb
Showing
4 changed files
with
94 additions
and
40 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,73 @@ | ||
<?php | ||
|
||
namespace Wcms; | ||
|
||
class Graph extends Item | ||
{ | ||
protected bool $showorphans = true; | ||
protected bool $showredirection = false; | ||
protected bool $showexternallinks = false; | ||
protected string $layout = 'euler'; | ||
|
||
public const LAYOUTS = [ | ||
'cose' => 'cose', | ||
'fcose' => 'fcose', | ||
'cose-bilkent' => 'cose-bilkent', | ||
'euler' => 'euler', | ||
'circle' => 'circle', | ||
'breadthfirst' => 'breadthfirst', | ||
'concentric' => 'concentric', | ||
'grid' => 'grid', | ||
'random' => 'random', | ||
]; | ||
|
||
/** | ||
* @param mixed[] $datas | ||
*/ | ||
public function __construct(array $datas) | ||
{ | ||
$this->hydrate($datas); | ||
} | ||
|
||
public function showorphans(): bool | ||
{ | ||
return $this->showorphans; | ||
} | ||
|
||
public function showredirection(): bool | ||
{ | ||
return $this->showredirection; | ||
} | ||
|
||
public function showexternallinks(): bool | ||
{ | ||
return $this->showexternallinks; | ||
} | ||
|
||
public function layout(): string | ||
{ | ||
return $this->layout; | ||
} | ||
|
||
public function setshowredirection($showredirection): void | ||
{ | ||
$this->showredirection = boolval($showredirection); | ||
} | ||
|
||
public function setshoworphans($showorphans): void | ||
{ | ||
$this->showorphans = boolval($showorphans); | ||
} | ||
|
||
public function setshowexternallinks($showexternallinks): void | ||
{ | ||
$this->showexternallinks = boolval($showexternallinks); | ||
} | ||
|
||
public function setlayout($layout): void | ||
{ | ||
if (key_exists($layout, $this::LAYOUTS)) { | ||
$this->layout = $layout; | ||
} | ||
} | ||
} |
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