This file contains hidden or 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
<?php | |
class Temperature | |
{ | |
const KELVIN = 'kelvin'; | |
const FAHRENHEIT = 'fahrenheit'; | |
const CELSIUS = 'celsius'; | |
private $unit; | |
private $value; |
This file contains hidden or 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
<?php | |
class PostStatus | |
{ | |
const PRIVATE = 'private'; | |
const DRAFT = 'draft'; | |
const PUBLISHED = 'published'; | |
const TRASHED = 'trash'; | |
/** |
This file contains hidden or 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
<?php | |
class ChairFactory | |
{ | |
public function createChair(bool $cheap, bool $fancy): ChairInterface | |
{ | |
if ($cheap && $fancy) { | |
return new ModernChair(); | |
} elseif ($fancy) { | |
return new VictorianRockingChair(); |
This file contains hidden or 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
<?php | |
/** | |
* This is a very simple and basic trait for overcoming the deprectation of dynamic properties in 8.2, and broken in 9.0. | |
* | |
* If using a 8.2 or later, use the #[AllowDynamicProperties] attribute instead of this. | |
* | |
* I suggest this is better than traditional dynamic properties for the simple fact that it's excplicit and therefore | |
* intentional. If your class already has magic methods then you don't need this. This will work in 8.2 or later and as far | |
* back as 5.4, so it should cover most sensible cases. |
This file contains hidden or 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
set @row_num:=0; | |
INSERT INTO wp_mb_relationships | |
( | |
`to`, | |
`type`, | |
`order_from`, | |
`order_to`, | |
`from` | |
) |