Executes an API Request.
@param \CharlotteDunois\Yasmin\HTTP\APIRequest  $item
@return void
550923
protected function execute(\CharlotteDunois\Yasmin\HTTP\APIRequest $item) {
        $endpoint = $this->getRatelimitEndpoint($item);
        $ratelimit = null;
        
        if(!empty($endpoint)) {
            $ratelimit = $this->getRatelimitBucket($endpoint);
            $ratelimit->setBusy(true);
        }
        
        $this->client->emit('debug', 'Executing item "'.$item->getEndpoint().'"');
        
        $item->execute($ratelimit)->then(function ($data) use ($item) {
            if($data === 0) {
                $item->deferred->resolve();
            } elseif($data !== -1) {
                $item->deferred->resolve($data);
            }
        }, function ($error) use ($item) {
            $this->client->emit('debug', 'Request for item "'.$item->getEndpoint().'" failed with '.($error instanceof \Throwable ? 'exception '.\get_class($error) : 'error '.$error));
            $item->deferred->reject($error);
        })->then(null, function ($error) {
            $this->client->handlePromiseRejection($error);
        })->done(function () use ($ratelimit, $endpoint) {
            if($ratelimit instanceof \CharlotteDunois\Yasmin\Interfaces\RatelimitBucketInterface) {
                if(isset($this->bucketRatelimitPromises[$endpoint])) {
                    $this->bucketRatelimitPromises[$endpoint]->done(function () use ($ratelimit) {
                        $ratelimit->setBusy(false);
                        $this->processDelayed();
                    });
                } else {
                    $ratelimit->setBusy(false);
                    $this->processDelayed();
                }
            } else {
                $this->processDelayed();
            }
        });
    }
437739
public function add_item(cc_i_item &$item) {
        if (is_null($this->itemlist)) {
            $this->itemlist = array();
        }
        $this->itemlist[$item->identifier] = $item;
    }
988412
public function doLog( common_log_Item $item)
    {

        if (is_null($this->resource)) {
        	$this->resource  = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
        	socket_set_nonblock($this->resource);
        }
        if ($this->resource !== false) {
        	$message = json_encode(array(
        		's' => $item->getSeverity(),
        		'd' => $item->getDescription(),
        		'p' => $this->prefix,
        		't' => $item->getTags(),
        		'f' => $item->getCallerFile(),
        		'l' => $item->getCallerLine(),
        		'b' => $item->getBacktrace()
        	));
        	@socket_sendto($this->resource, $message, strlen($message), 0, $this->host, $this->port);
        	//ignore errors, socket might already be closed because php is shutting down
        }

    }
835518
public function addItem($item)
    {
        $indentation = $this->indent($this->indentation);

        $this->buffer[] = $indentation.$item;
    }
1191002
public function indexAction(Item $item, Request $request)
    {
        /* @var $response \Symfony\Component\HttpFoundation\Response */
        $response = $this->get('cache_time_keeper')->getResponse($item->getDateUpdate(), self::CACHE_LIFETIME);
        /* @var $widget \AnimeDb\Bundle\ShikimoriWidgetBundle\Service\Widget */
        $widget = $this->get('anime_db.shikimori.widget');

        // get shikimori item id
        if (!($item_id = $widget->getItemId($item))) {
            return $response;
        }

        $list = $this->get('anime_db.shikimori.browser')
            ->get(str_replace('#ID#', $item_id, self::PATH_SIMILAR_ITEMS));
        // add Etag by list items
        $response->setEtag($widget->hash($list));

        // response was not modified for this request
        if ($response->isNotModified($request) || !$list) {
            return $response;
        }

        // build list item entities
        foreach ($list as $key => $item) {
            $list[$key] = $widget->getWidgetItem($widget->getItem($item['id']));
        }

        return $this->render(
            'AnimeDbShikimoriSimilarItemsWidgetBundle:Widget:index.html.twig',
            ['items' => $list],
            $response
        );
    }
1133747
protected function persist(Item $item)
    {
        $this->em->persist($item);
        foreach ($item->getNames() as $name) {
            $this->em->persist($name);
        }
        foreach ($item->getSources() as $source) {
            $this->em->persist($source);
        }
    }
585688
public function addItem($item)
	{
		if( ! $item instanceof Model )
		{
			$item = new $this->defaultModel($item);
		}

		$this->data[] = $item;
	}
1303620
public function savePersistCurrentCookie($item)
    {
        $varName = $this->getCurrentVarName();
        CookieJar::instance()->newCookie()
            ->setName($varName)
            ->setValue($item->id)
            ->save();
    }
1279816
private function updatePrices(ApiItemInterface $item, $data)
    {
        //TODO: currency
        $currency = null;

        // set products price by data
        if ($item->getUseProductsPrice() === false) {
            $item->setPrice($this->getProperty($data, 'price', $item->getPrice()));
        }

        // set items total net price
        $price = $this->itemPriceCalculator->calculate($item, $currency, $item->getUseProductsPrice());
        $item->setTotalNetPrice($price);

        // set items price
        $itemPrice = $this->itemPriceCalculator->getItemPrice($item, $currency, $item->getUseProductsPrice());
        $item->setPrice($itemPrice);
    }
589315
public function add($item)
    {
        if (is_object($item)) {
            $item = (array) $item;
        }

        $this->validate($item);
        $this->addItem($item);

        return true;
    }
1302268
public function add($item)
    {
        if ($item instanceof ItemInterface) {
            $this->items[] = $item;
        } else {
            $this->items[] = new MulticardsItem($item);
        }
    }
887562
public function remove($item)
    {
        if (!($item instanceof $this->dataClass)) {
            throw new InvalidArgumentException(
                "HasManyList::remove() expecting a $this->dataClass object, or ID",
                E_USER_ERROR
            );
        }

        // Don't remove item which doesn't belong to this list
        $foreignID = $this->getForeignID();
        $foreignKey = $this->getForeignKey();

        if (empty($foreignID)
            || (is_array($foreignID) && in_array($item->$foreignKey, $foreignID))
            || $foreignID == $item->$foreignKey
        ) {
            $item->$foreignKey = null;
            $item->write();
        }
    }
1256520
public function fillAction(Item $item)
    {
        // do fill
        $this->get('anime_db.item_folder_filler.filler_folder')->fillFolder($item);

        return $this->render('AnimeDbItemFolderFillerBundle:Filler:fill.html.twig', [
            'item' => $item
        ]);
    }
776094
protected function bindParamListIfProvided(JsonRpcRequest $request, array $item) : void
    {
        if (isset($item[self::KEY_PARAM_LIST])) {
            $this->validateArray($item[self::KEY_PARAM_LIST], 'Parameter list must be an array');
            $request->setParamList($item[self::KEY_PARAM_LIST]);
        }
    }
614151
protected function resolveItems(Collection &$items): void
    {
        $resolver = function ($property) {
            return $this->resolve($property) ?: $property;
        };

        $items->each(function (MenuItem $item) use ($resolver) {
            $item->fill(array_map($resolver, $item->properties));
        });
    }
296020
public function writeItem($item)
    {
        if ($this->autoDetectHeader && !$this->header) {
            $this->handleAutoDetectHeader($item);
        }

        $this->table->addRow(
            $this->getValues($item, $this->getKeys($item))
        );
    }
1035552
public function execute()
    {
        $params = $this->getRequest()->getParams();

        //if no value to any of the required params send error response
        if (empty($params['apiUser']) ||
            empty($params['pass']) ||
            empty($params['code']) ||
            ! $this->isCodeValid($params['code'])
        ) {
            $this->sendAjaxResponse(true);
        } else {
            $this->processAccountCallback($params);
        }
    }