- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
final class SimpleToArrayTransformer
{
/**
* @var SimpleToArrayTransformer
*/
private static $instance = null;
private function __construct()
{/*_*/}
/**
* @return SimpleToArrayTransformer
*/
public static function me()
{
if (!self::$instance) {
self::$instance = new self();
}
return self::$instance;
}
public function transform($item)
{
return (array) $item;
}
}
// используем так
$data = SimpleToArrayTransformer::me()->transform($item);
// нужно было
$data = (array) $item;
Her 28.10.2015 14:45 # +2
inkanus-gray 28.10.2015 17:55 # +2
kegdan 28.10.2015 18:13 # +2
http://vignette3.wikia.nocookie.net/warcrafterss/images/6/69/25_11779_oboi_illidan_s_klinkami_1920x1200.jpg/revision/latest?cb=20140116190415&path-prefix=ru
inkanus-gray 28.10.2015 18:27 # +1
kegdan 28.10.2015 18:34 # 0
inkanus-gray 28.10.2015 18:08 # 0
Идея:
inkanus-gray 28.10.2015 18:12 # +2
https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
https://github.com/Herzult/SimplePHPEasyPlus