Uakron\SocialItem\SocialItemFactory.php
<?php
namespace Uakron\SocialItem;
use Uakron\SocialUtility;
class SocialItemFactory
{
//Single Tweet/Instagram/Whatever ID String
public static function fromID($service, $id){
return SocialItemFactory::targetServiceFromID($service, $id);
}
//Multi-Service ID Digesting Factory
public static function arrayFromID($serviceIDArray){
//Stuff all these into an array, let the user (me) sort that big ugly array
$items = array();
foreach($serviceIDArray as $service => $id){
foreach(SocialItemFactory::targetServiceFromID($service, $id) as $item){
array_push($items, $item);
}
}
return $items;
}
private static function targetServiceFromID($service, $id){
$class = 'Uakron\\SocialItem\\'.$service.'\\'.$service.'ItemFactory';
return $class::fromID($id);
}
}