original_string: public function fromBarcode($barcode)
      {
          $destinationUrl = $this->client->getRedirectLocation('/items', ['item_barcode' => $barcode]);
  
          // Extract the MMS ID from the redirect target URL.
          // Example: https://api-eu.hosted.exlibrisgroup.com/almaws/v1/bibs/999211285764702204/holdings/22156746440002204/items/23156746430002204
          if (!is_null($destinationUrl) && preg_match('$bibs/([0-9]+)/holdings/([0-9]+)/items/([0-9]+)$', $destinationUrl, $matches)) {
              $mms_id = $matches[1];
              $holding_id = $matches[2];
              $item_id = $matches[3];
  
              $bib = Bib::make($this->client, $mms_id);
              $holding = Holding::make($this->client, $bib, $holding_id);
  
              return Item::make($this->client, $bib, $holding, $item_id);
          }
      }
code: public function fromBarcode($barcode)
      {
          $destinationUrl = $this->client->getRedirectLocation('/items', ['item_barcode' => $barcode]);
  
          // Extract the MMS ID from the redirect target URL.
          // Example: https://api-eu.hosted.exlibrisgroup.com/almaws/v1/bibs/999211285764702204/holdings/22156746440002204/items/23156746430002204
          if (!is_null($destinationUrl) && preg_match('$bibs/([0-9]+)/holdings/([0-9]+)/items/([0-9]+)$', $destinationUrl, $matches)) {
              $mms_id = $matches[1];
              $holding_id = $matches[2];
              $item_id = $matches[3];
  
              $bib = Bib::make($this->client, $mms_id);
              $holding = Holding::make($this->client, $bib, $holding_id);
  
              return Item::make($this->client, $bib, $holding, $item_id);
          }
      }
code_tokens: public function fromBarcode ( $ barcode ) { $ destinationUrl = $ this -> client -> getRedirectLocation ( '/items' , [ 'item_barcode' => $ barcode ] ) ; // Extract the MMS ID from the redirect target URL. // Example: https://api-eu.hosted.exlibrisgroup.com/almaws/v1/bibs/999211285764702204/holdings/22156746440002204/items/23156746430002204 if ( ! is_null ( $ destinationUrl ) && preg_match ( '$bibs/([0-9]+)/holdings/([0-9]+)/items/([0-9]+)$' , $ destinationUrl , $ matches ) ) { $ mms_id = $ matches [ 1 ] ; $ holding_id = $ matches [ 2 ] ; $ item_id = $ matches [ 3 ] ; $ bib = Bib :: make ( $ this -> client , $ mms_id ) ; $ holding = Holding :: make ( $ this -> client , $ bib , $ holding_id ) ; return Item :: make ( $ this -> client , $ bib , $ holding , $ item_id ) ; } }
docstring: Get an Item object from a barcode.
  
  @param string $barcode
  
  @return Item|null
docstring_tokens: Get an Item object from a barcode .