Last active
July 4, 2023 22:49
-
-
Save trikitrok/bb89055689825b93a062153e6e2370da to your computer and use it in GitHub Desktop.
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
// Adapted from Rachel M. Carmena's https://github.com/rachelcarmena/code-smells | |
// see also Ds\Vector in https://www.php.net/manual/en/class.ds-vector.php | |
<?php | |
class CoolStack extends Ds\Vector { | |
public function push(...$values): void { | |
parent::push(...$values); | |
} | |
public function pop() { | |
return parent::pop(); | |
} | |
} | |
//---------------------------------------------------------------------------- | |
//---------------------------------------------------------------------------- | |
<?php | |
class CoolStack<T> { | |
private $elements; | |
function __construct() { | |
$this->elements = new \Ds\Vector(); | |
} | |
public function push(...$values): void { | |
$this->elements->push(...$values); | |
} | |
public function pop() { | |
return $this->elements->pop(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment