5 * @author Galen Grover <galenjr@gmail.com>
6 * @license http://opensource.org/licenses/mit-license.php The MIT License
9 namespace Instagram\Collection;
14 * Holds a collection of tags
16 class TagCollection extends \Instagram\Collection\CollectionAbstract {
19 * Set the collection data
21 * @param StdClass $raw_data
24 public function setData( $raw_data ) {
25 if ( isset( $raw_data->data ) ) {
26 $this->data = $raw_data->data;
28 elseif( is_array( $raw_data ) ) {
29 $this->data = array_map( function( $t ){ return (object)array( 'name' => $t ); }, $raw_data );
31 $this->convertData( '\Instagram\Tag' );
35 * Get an array of tag names
37 * @return array Returns an array of tags
40 public function toArray() {
42 foreach( $this->data as $tag ) {
43 $tags[] = $tag->getName();