public function get_supported_attributes($params) { $accepted_resources = array('Product', 'ProductAttribute', 'Category', 'Comment', 'Order', 'OrderItem', 'OrderTaxItem', 'OrderCouponItem', 'Customer', 'Coupon', 'Review', 'Image', 'Tag', 'FeaturedImage'); $models = $this->orEq($params['arguments'], 'resources', $accepted_resources); if (!is_array($models)) { $this->badArgument('resources', 'an Array of Strings'); } $results = array(); foreach ($models as $m) { if ($m == 'Product') { $model = new API\Product(); } else { if ($m == 'Category') { $model = new API\Category(); } else { if ($m == 'Order') { $model = new API\Order(); } else { if ($m == 'OrderItem') { $model = new API\OrderItem(); } else { if ($m == 'Customer') { $model = new API\Customer(); } else { if ($m == 'Coupon') { $model = new API\Coupon(); } else { if ($m == 'Comment') { $model = new API\Comment(); } else { if ($m == 'Image') { $model = new API\Image(); } else { if ($m == 'FeaturedImage') { $model = new API\Image(); } else { if ($m == 'Review') { $model = new API\Review(); } else { if ($m == 'OrderTaxItem') { $model = new API\OrderTaxItem(); } else { if ($m == 'OrderCouponItem') { $model = new API\OrderCouponItem(); } else { if ($m == 'ProductAttribute') { $model = new API\ProductAttribute(); } else { if ($m == 'Tag') { $model = new API\Category(); } else { $this->badArgument($m, join(',', $accepted_resources)); return $this->done(); } } } } } } } } } } } } } } $results[$m] = $model->getSupportedAttributes(); } $this->result->setPayload(array($results)); return $this->done(); }