Get a checkout preference
@param string $id
@return array(json)
544539
public function get_preference($id) {
        $request = array(
            "uri" => "/checkout/preferences/{$id}",
            "params" => array(
                "access_token" => $this->get_access_token()
            )
        );

        $preference_result = MPRestClient::get($request);
        return $preference_result;
    }
430700
public function getFranchiseById($id)
    {
        $id = (int) $id;
        $id = max(0, $id);

        return $this->request('franchises/'.$id);
    }
312589
protected function getPayload($id)
    {
        $rawPayload = $this->getRedis()->hget($this->getRedisJobNamespace(), $id);

        return static::parsePayload($rawPayload);
    }
357266
public static function getFromCache($id)
    {
        $arrayCache = Configuration::getArrayCache();
        if ($arrayCache->contains($id)) {
            return $arrayCache->fetch($id);
        }

        $cacheDriver = Configuration::getCacheDriver();
        if ($cacheDriver !== null) {
            $cacheResult = $cacheDriver->fetch($id);
            if ($cacheResult !== false) {
                $arrayCache->save($id, $cacheResult);
                return $cacheResult;
            }
        }

        return null;
    }
1124850
public function getById($id)
    {
        $list = $this->getByCriteria($id, $this->getUniqueId());
        return reset($list);
    }
900827
public function get(string $id): ?array
  {
    $mask = $this->db->rselect('bbn_notes_masks', [], ['id_note' => $id]);
    if ( $data = $this->notes->get($mask['id_note']) ){
      $data['default'] = $mask['def'];
      $data['id_type'] = $mask['id_type'];
      $data['type'] = $this->o->text($mask['id_type']);
      $data['name'] = $mask['name'];
      return $data;
    }
    return null;
  }
317616
public function install($id)
    {
        $plugin = $this->getById($id);
        if (!$plugin) {
            return ['code' => -1, 'message' => 'Plugin not found'];
        }

        if ($this->isInstalled($id)) {
            return ['code' => -2, 'message' => 'Plugin has been installed'];
        }

        $ret = $plugin->install();
        if ($ret['code'] !== 1) {
            return $ret;
        }

        $pluginIds = $this->getInstalledIds();
        $pluginIds[] = $id;
        $this->setInstalledIds($pluginIds);

        $this->getEvents(true);

        return $ret;
    }
625300
public function actionQuery($id)
    {
        Yii::$app->response->format = Response::FORMAT_JSON;
        $payment = $this->findModel($id);
        if (!$this->module->hasGateway($payment->gateway)) {
            throw new NotFoundHttpException("Unknown payment gateway '{$payment->payment}'");
        }
        /** @var \yuncms\payment\BaseGateway $gateway */
        $gateway = $this->module->getGateway($payment->gateway);
        $status = $gateway->queryOrder($payment->id);
        if ($status) {
            return ['status' => 'success'];
        } else {
            return ['status' => 'pending'];
        }
    }
456045
public function get($id)
    {
        $response = $this->getResponse();
        $contentType = 'application/json';
        $adapter = '\Zend\Serializer\Adapter\Json';
        $response->getHeaders()->addHeaderLine('Content-Type', $contentType);
        $adapter = new $adapter();
        
        $appId = $this->getEvent()
            ->getRouteMatch()
            ->getParam('appId');
        
        /*
         * $content = array( 'login' => array( 'urls' => array( 'page' => 'http://ic.adfab.fr/pmagento/index.php/customer/account/login/', 'success' => 'http://ic.adfab.fr/pmagento/index.php/customer/account/', ), 'items' => array( array('selector' => 'id', 'name' => 'email') ), ), 'logout' => array( 'urls' => array( 'page' => 'http://ic.adfab.fr/pmagento/', 'success' => 'http://ic.adfab.fr/pmagento/index.php/customer/account/logoutSuccess/', ), ), 'taxonomy' => array( 'config' => array( 'broadcast' => false, ), 'items' => array( array( 'url' => '/account', 'xpath' => "//div[@class='block-account']", 'id' => 'account' ), array( 'url' => '/checkout', 'id' => 'checkout' ), array( 'xpath' => "//div[@class='my-wishlist']", 'id' => 'wishlist' ), ), ), );
         */
        
        $content = array(
            'library' => array(
                'config' => array(
                    'broadcast' => false
                ),
                'stories' => array(
                    'login_user' => array(
                        'events' => array(
                            'before' => array(
                                'url' => '/customer\\/account\\/login/',
                                'xpath' => "//a[@title='Log In']"
                            ),
                            'after' => array(
                                'url' => '/customer\\/account/',
                                'xpath' => "//a[@title='Log Out']"
                            )
                        ),
                        'conditions' => array(
                            'url' => '/customer\\/account/',
                            'xpath' => "//a[@title='Log Out']"
                        ),
                        'action' => 'login',
                        'objects' => array(
                            'id' => 'login_id',
                            'properties' => array(
                                array(
                                    'name' => 'email',
                                    'xpath' => "//input[@id='email']"
                                )
                            )
                        )
                    ),
                    'logout_user' => array(
                        'events' => array(
                            'before' => array(
                                'url' => '/ic.adfab.fr\/pmagento/',
                                'xpath' => "//a[@title='Log Out']"
                            ),
                            'after' => array(
                                'url' => '/ic.adfab.fr\/pmagento/',
                                'xpath' => "//a[@title='Log In']"
                            )
                        ),
                        'conditions' => array(
                            'url' => '/logoutSuccess/',
                            'xpath' => "//a[@title='Log In']"
                        ),
                        'action' => 'logout'
                    ),
                    'tips1' => array(
                        'conditions' => array(
                            'url' => '/ic.adfab.fr\/pmagento/'
                        ),
                        'action' => 'find',
                        'objects' => array(
                            'id' => 'tip 1'
                        ),
                        'event' => array(
                            'xpath' => '//body',
                            'type' => 'mouseup',
                            'area' => array(
                                'debug' => true,
                                'y' => 200,
                                'x' => 200,
                                'text' => 'null',
                                'width' => 400,
                                'height' => 200,
                                'xpath' => "//p[@class='home-callout'][1]/img/@src"
                            )
                        )
                    ),
                    'tips2' => array(
                        'conditions' => array(
                            'url' => '/ic.adfab.fr\/pmagento/'
                        ),
                        'action' => 'find',
                        'objects' => array(
                            'id' => 'tip 2'
                        ),
                        'event' => array(
                            'xpath' => '//body',
                            'type' => 'mouseup',
                            'area' => array(
                                'debug' => true,
                                'y' => null,
                                'x' => null,
                                'text' => 'Your',
                                'width' => null,
                                'height' => null,
                                'xpath' => "//html/body[@class=' cms-index-index cms-home']/div[@class='wrapper']/div[@class='page']/div[@class='header-container']/div[@class='header']/div[@class='quick-access']/div[@class='form-language']/label"
                            )
                        )
                    ),
                    'tips3' => array(
                        'conditions' => array(
                            'url' => '/ic.adfab.fr\/pmagento/'
                        ),
                        'action' => 'find',
                        'objects' => array(
                            'id' => 'tip 1'
                        ),
                        'event' => array(
                            'xpath' => '//body',
                            'type' => 'mouseup',
                            'area' => array(
                                'debug' => false,
                                'y' => 7,
                                'x' => 8,
                                'text' => 'null',
                                'width' => 63,
                                'height' => 32,
                                'xpath' => "//html[1]/body[1]/div[1]/div[1]/div[1]/div[1]/h1[1]/a[1]/img[1]"
                            )
                        )
                    ),
                    'tips4' => array(
                        'conditions' => array(
                            'url' => '/ic.adfab.fr\/pmagento/'
                        ),
                        'action' => 'find',
                        'objects' => array(
                            'id' => 'tip 2'
                        ),
                        'event' => array(
                            'xpath' => '//body',
                            'type' => 'mouseup',
                            'area' => array(
                                'debug' => false,
                                'y' => null,
                                'x' => null,
                                'text' => 'Your',
                                'width' => null,
                                'height' => null,
                                'xpath' => "//html/body[@class=' cms-index-index cms-home']/div[@class='wrapper']/div[@class='page']/div[@class='header-container']/div[@class='header']/div[@class='quick-access']/div[@class='form-language']/label"
                            )
                        )
                    )
                )
            )
        );
        
        $response->setContent($adapter->serialize($content));
        
        return $response;
    }
748447
public function show($id)
    {
        $ret = $this->get('/relations/'.urlencode($id).'.json');
        if (null === $ret) {
            return [];
        }

        return $ret['relation'];
    }
1074499
public function getItemById($id)
    {
        $items = $this->getItems();
        if (isset($items[$id])) {
            return $items[$id];
        }

        return null;
    }
772210
public function getById($id)
    {
        $model = $this
            ->prepareQuery()
            ->where($this->model->getTable() . '.id', $id)
            ->first();

        if (empty($model))
            return null;

        $model = $this->addPermissionsForModel($model);

        return $this->formatModel($model);
    }
1306946
public function getById($id)
    {
        if (isset($this->idList[$id])) {
            return $this->idList[$id];
        }

        return null;
    }
1234411
public function getStatusConfig($id = null)
    {
        if (!isset($id)) {
            $id = $this->getStatusId();
        }
        return isset($this->statuses[$id]) ? $this->statuses[$id] : array();
    }
1124801
public static function getTrade($id)
    {
        $json = static::setRequest('get', static::GET_TRADE_ENDPOINT, [
            'tid' => $id,
        ])['response']['trade'];
        $trade = new Trade();
        $trade->setId($id)
            ->setCreated(new \DateTime($json['created']))
            ->setQrId($json['qr_id'])
            ->setStatus($json['status']);

        return $trade;
    }
348917
public function get($id)
    {
        //ACCESS CHECK
        if (!$this->isAllowed(ResourceName::RESOURCE_SITES, 'admin')) {
            $this->getResponse()->setStatusCode(Response::STATUS_CODE_401);

            return $this->getResponse();
        }

        // get default site data - kinda hacky, but keeps us to one controller
        if ($id == 'default') {
            $siteManager = $this->getSiteManager();

            $data = $siteManager->getDefaultSiteValues();

            $site = new Site(
                $this->getCurrentUserId(),
                'Get default site values in ' . get_class($this)
            );

            $site->populate($data);

            return new ApiJsonModel($site, 0, 'Success');
        }

        // get current site data - kinda hacky, but keeps us to one controller
        if ($id == 'current') {
            $site = $this->getCurrentSite();

            return new ApiJsonModel($site, 0, 'Success');
        }

        /** @var \Rcm\Repository\Site $siteRepo */
        $siteRepo = $this->getEntityManager()->getRepository(
            \Rcm\Entity\Site::class
        );

        try {
            $site = $siteRepo->find($id);
        } catch (\Exception $e) {
            return new ApiJsonModel(
                null,
                1,
                "Failed to find site by id ({$id})"
            );
        }
        /* ADDED THIS CHECK TO GET RID OF ERROR. */
        /* NOT SURE WHY TRY CATCH ABOVE ISN'T WORKING */

        if ($site instanceof Site) {
            return new ApiJsonModel($site, 0, 'Success');
        } else {
            return new ApiJsonModel(null, 1, "Failed to find site by id ({$id})");
        }
    }
89780
public function filterId($id)
    {
        if (1 === count($this->data)) {
            return array_shift($this->data);
        }

        $result = $this->filter(
            function ($key, $value) use ($id) {
                if ($value->getId() == $id) {
                    return true;
                }
            }
        );

        if (!count($result)) {
            return null;
        }

        $collection = $result->getAll();

        return array_shift($collection);
    }