/*
Get the singleton cart of this line item.
344113
public function getCartInstance(){
        $carts = app('cart_instances');
        foreach ($carts as $name => $cart) {
            if($cart->id === $this->cart_id){
                return $cart;
            }
        }
        return null;
    }
1256313
def get(self, item, fastpath=True):
        
        if self.items.is_unique:

            if not isna(item):
                loc = self.items.get_loc(item)
            else:
                indexer = np.arange(len(self.items))[isna(self.items)]

                # allow a single nan location indexer
                if not is_scalar(indexer):
                    if len(indexer) == 1:
                        loc = indexer.item()
                    else:
                        raise ValueError("cannot label index with a null key")

            return self.iget(loc, fastpath=fastpath)
        else:

            if isna(item):
                raise TypeError("cannot label index with a null key")

            indexer = self.items.get_indexer_for([item])
            return self.reindex_indexer(new_axis=self.items[indexer],
                                        indexer=indexer, axis=0,
                                        allow_dups=True)
214654
public synchronized static Lesto getInstance() {
        if (lesto == null) {
            lesto = new Lesto(null);
            lesto.gatherInformations();
        }
        return lesto;
    }
100967
public Item getItem(int position) {
        if (shouldInsertItemAtPosition(position)) {
            return mItems.get(itemInsertedBeforeCount(position - 1));
        }
        return null;
    }
688916
public @Nullable TwinTextItem getItemById(int id) {
        for(int index = getCount()-1; index >= 0; index--) {
            TwinTextItem item = getItem(index);
            if(item.getId() == id)
                return item;
        }
        return null;
    }
215950
@Override
	public List<CommerceOrderItem> findByCPInstanceId(long CPInstanceId) {
		return findByCPInstanceId(CPInstanceId, QueryUtil.ALL_POS,
			QueryUtil.ALL_POS, null);
	}
907827
public long get(T item) {
        MutableLong count = map.get(item);
        return count == null ? 0 : count.value;
    }
761026
private Double fetchInstancesOnlineRatio(ObjectId collectorItemId) {
    int totalInstances = 0, totalInstancesOnline = 0;
    Double instancesOnlineScore = null;

    List<EnvironmentStatus> statuses = environmentStatusRepository
      .findByCollectorItemId(collectorItemId);

    if (null == statuses || statuses.isEmpty()) {
      return null;
    }

    for (EnvironmentStatus environmentStatus : statuses) {
      totalInstances++;
      if (environmentStatus.isOnline()) {
        totalInstancesOnline++;
      }
    }
    instancesOnlineScore = ((totalInstancesOnline * 100) / (double) totalInstances);
    LOGGER.info("totalInstances " + totalInstances + " totalInstancesOnline " + totalInstancesOnline + " instancesOnlineScore " + instancesOnlineScore);

    return instancesOnlineScore;
  }
485944
public final CartLn createCartItem(final Cart pShoppingCart) {
    CartLn cartLn = new CartLn();
    cartLn.setIsNew(true);
    cartLn.setDisab(false);
    cartLn.setForc(false);
    cartLn.setItsOwner(pShoppingCart);
    pShoppingCart.getItems().add(cartLn);
    return cartLn;
  }
486027
public function get($instance = 'default')
    {
        if (config('laracart.cross_devices', false) && $this->authManager->check()) {
            if (!empty($cartSessionID = $this->authManager->user()->cart_session_id)) {
                $this->session->setId($cartSessionID);
                $this->session->start();
            }
        }

        if (empty($this->cart = $this->session->get($this->prefix.'.'.$instance))) {
            $this->cart = new Cart($instance);
        }

        return $this;
    }
805002
public Integer getInstance() {
    try {
      return Integer.valueOf(uri.getPath().split("/")[2]);
    } catch (IndexOutOfBoundsException e) {
      return null;
    }
  }
725489
public static DesignContextMenu getInstance() {
        Page page = ExecutionContext.getPage();
        DesignContextMenu contextMenu = page.getAttribute(DesignConstants.ATTR_DESIGN_MENU, DesignContextMenu.class);

        if (contextMenu == null) {
            contextMenu = create();
            page.setAttribute(DesignConstants.ATTR_DESIGN_MENU, contextMenu);
        }

        return contextMenu;
    }
914516
public static <T extends PropertyDispatcher> T getInstance(Class<T> cls)
    {
        return getInstance(cls, null);
    }
989294
static function instance()
    {
        $confirmOrderHandler = null;
        if ( eZExtension::findExtensionType( array( 'ini-name' => 'shopaccount.ini',
                                                    'repository-group' => 'HandlerSettings',
                                                    'repository-variable' => 'Repositories',
                                                    'extension-group' => 'HandlerSettings',
                                                    'extension-variable' => 'ExtensionRepositories',
                                                    'type-group' => 'ConfirmOrderSettings',
                                                    'type-variable' => 'Handler',
                                                    'alias-group' => 'ConfirmOrderSettings',
                                                    'alias-variable' => 'Alias',
                                                    'subdir' => 'confirmorderhandlers',
                                                    'type-directory' => false,
                                                    'extension-subdir' => 'confirmorderhandlers',
                                                    'suffix-name' => 'confirmorderhandler.php' ),
                                             $out ) )
        {
            $filePath = $out['found-file-path'];
            include_once( $filePath );
            $class = $out['type'] . 'ConfirmOrderHandler';
            return new $class();
        }

        return new eZDefaultConfirmOrderHandler();
    }
399302
function instance(defaults, options) {
  if (!singletonQS) {
    singletonQS = queryState(defaults, options);
  } else if (defaults) {
    singletonQS.setIfEmpty(defaults);
  }

  return singletonQS;
}
100017
function getItem()
    {
        $sourceObject = $this->sourceObject;
        if ($this->value !== null) {
            $item = $sourceObject::get()->byID($this->value);
        } else {
            $item = $sourceObject::create();
        }
        return $item;
    }
1012834
public static AbstractItem getItemStreamInstance(String itemClassName) {
        AbstractItem itemStream = itemInterfaceRef.getService().getItemStreamInstance(itemClassName);;
        return itemStream;
    }