Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Snowden committed May 19, 2015
1 parent e45ea44 commit 6984223
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/LukeSnowden/GoogleShoppingFeed/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,19 @@ public function createItem() {
$this->channel();
$item = new Item;
$this->items[] = $item;
$item->setIndex( count($this->items)-1 );
return $item;
}

/**
* [removeItemByIndex description]
* @param [type] $index [description]
* @return [type] [description]
*/
public function removeItemByIndex( $index ) {
unset( $this->items[$index] );
}

/**
* [standardiseSizeVarient description]
* @param [type] $value [description]
Expand Down
22 changes: 22 additions & 0 deletions src/LukeSnowden/GoogleShoppingFeed/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ class Item {
*/
private $nodes = array();

/**
* [$index description]
* @var null
*/
private $index = null;

/**
* [$namespace - (g:) namespace definition]
* @var string
Expand Down Expand Up @@ -283,6 +289,22 @@ public function nodes() {
return $this->nodes;
}

/**
* [setIndex description]
* @param [type] $index [description]
*/
public function setIndex( $index ) {
$this->index = $index;
}

/**
* [delete description]
* @return [type] [description]
*/
public function delete() {
GoogleShopping::removeItemByIndex( $this->index );
}

/**
* [clone description]
* @return [type] [description]
Expand Down

0 comments on commit 6984223

Please sign in to comment.