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)) {
              $mmsId = $matches[1];
  
              return $this->get($mmsId);
          }
      }
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)) {
              $mmsId = $matches[1];
  
              return $this->get($mmsId);
          }
      }
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 ) ) { $ mmsId = $ matches [ 1 ] ; return $ this -> get ( $ mmsId ) ; } }
docstring: Get a Bib object from a item barcode.
  
  @param string $barcode
  
  @return Bib
docstring_tokens: Get a Bib object from a item barcode .