idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
59,900
private function configureProcessProperties ( OptionsResolver $ resolver ) { $ resolver -> setRequired ( 'command' ) -> setAllowedTypes ( 'command' , 'string' ) ; $ resolver -> setDefined ( 'process_name' ) -> setAllowedTypes ( 'process_name' , 'string' ) ; $ resolver -> setDefined ( 'numprocs' ) -> setAllowedTypes ( '...
Configures process related properties .
59,901
private function configureStartControlProperties ( OptionsResolver $ resolver ) { $ resolver -> setDefined ( 'autostart' ) -> setAllowedTypes ( 'autostart' , 'bool' ) ; $ resolver -> setDefined ( 'autorestart' ) -> setAllowedTypes ( 'autorestart' , [ 'bool' , 'string' ] ) -> setAllowedValues ( 'autorestart' , [ true , ...
Configures start control related properties .
59,902
private function configureStopControlProperties ( OptionsResolver $ resolver ) { $ resolver -> setDefined ( 'exitcodes' ) ; $ this -> configureArrayProperty ( 'exitcodes' , $ resolver ) ; $ resolver -> setDefined ( 'stopsignal' ) -> setAllowedTypes ( 'stopsignal' , 'string' ) -> setAllowedValues ( 'stopsignal' , [ 'TER...
Configures stop control related properties .
59,903
private function configureLogProperties ( OptionsResolver $ resolver ) { $ resolver -> setDefined ( 'redirect_stderr' ) -> setAllowedTypes ( 'redirect_stderr' , 'bool' ) ; $ this -> configureStdoutLogProperties ( $ resolver ) ; $ this -> configureStderrLogProperties ( $ resolver ) ; }
Configures log related properties .
59,904
private function configureStdoutLogProperties ( OptionsResolver $ resolver ) { $ resolver -> setDefined ( 'stdout_logfile' ) -> setAllowedTypes ( 'stdout_logfile' , 'string' ) ; $ resolver -> setDefined ( 'stdout_logfile_maxbytes' ) ; $ this -> configureByteProperty ( 'stdout_logfile_maxbytes' , $ resolver ) ; $ resolv...
Configures stdout log related properties .
59,905
private function configureStderrLogProperties ( OptionsResolver $ resolver ) { $ resolver -> setDefined ( 'stderr_logfile' ) -> setAllowedTypes ( 'stderr_logfile' , 'string' ) ; $ resolver -> setDefined ( 'stderr_logfile_maxbytes' ) ; $ this -> configureByteProperty ( 'stderr_logfile_maxbytes' , $ resolver ) ; $ resolv...
Configures stderr log related properties .
59,906
public static function fromHeader ( string $ string ) : array { $ cookies = \ explode ( ";" , $ string ) ; $ result = [ ] ; try { foreach ( $ cookies as $ cookie ) { $ parts = \ explode ( '=' , $ cookie , 2 ) ; if ( 2 !== \ count ( $ parts ) ) { return [ ] ; } list ( $ name , $ value ) = $ parts ; $ result [ ] = new se...
Parses the cookies from a cookie header .
59,907
public function withExpiry ( \ DateTimeInterface $ date ) : self { $ new = clone $ this ; if ( $ date instanceof \ DateTimeImmutable ) { $ new -> expiry = $ date ; } elseif ( $ date instanceof \ DateTime ) { $ new -> expiry = \ DateTimeImmutable :: createFromMutable ( $ date ) ; } else { $ new -> expiry = new \ DateTim...
Applies the given expiry to the cookie .
59,908
public function changeField ( $ name , array $ attributes ) { Argument :: i ( ) -> test ( 1 , 'string' ) ; $ this -> changeFields [ $ name ] = $ attributes ; return $ this ; }
Changes attributes of the table given the field name
59,909
public function getSEOScoreTips ( ) { $ score_criteria_tips = array ( 'pagesubject_defined' => _t ( 'SEO.SEOScoreTipPageSubjectDefined' , 'Page subject is not defined for page' ) , 'pagesubject_in_title' => _t ( 'SEO.SEOScoreTipPageSubjectInTitle' , 'Page subject is not in the title of this page' ) , 'pagesubject_in_fi...
getSEOScoreTips . Get array of tips translated in current locale
59,910
public function getHTMLStars ( ) { $ treshold_score = $ this -> seo_score - 2 < 0 ? 0 : $ this -> seo_score - 2 ; $ num_stars = intval ( ceil ( $ treshold_score ) / 2 ) ; $ num_nostars = 5 - $ num_stars ; $ html = '<div id="fivestar-widget">' ; for ( $ i = 1 ; $ i <= $ num_stars ; $ i ++ ) { $ html .= '<div class="star...
getHTMLStars . Get html of stars rating in CMS maximum score is 12 threshold 2
59,911
public function getSEOScoreCalculation ( ) { $ this -> score_criteria [ 'pagesubject_defined' ] = $ this -> checkPageSubjectDefined ( ) ; $ this -> score_criteria [ 'pagesubject_in_title' ] = $ this -> checkPageSubjectInTitle ( ) ; $ this -> score_criteria [ 'pagesubject_in_firstparagraph' ] = $ this -> checkPageSubjec...
getSEOScoreCalculation . Do SEO score calculation and set class Array score_criteria 12 corresponding assoc values Also set class Integer seo_score with score 0 - 12 based on values which are true in score_criteria array Do SEO score calculation and set class Array score_criteria 11 corresponding assoc values Also set ...
59,912
public function setSEOScoreTipsUL ( ) { $ tips = $ this -> getSEOScoreTips ( ) ; $ this -> seo_score_tips = '<ul id="seo_score_tips">' ; foreach ( $ this -> score_criteria as $ index => $ crit ) { if ( ! $ crit ) { $ this -> seo_score_tips .= '<li>' . $ tips [ $ index ] . '</li>' ; } } $ this -> seo_score_tips .= '</ul...
setSEOScoreTipsUL . Set SEO Score tips ul > li for SEO tips literal field based on score_criteria
59,913
private function createDOMDocumentFromHTML ( $ html = null ) { if ( $ html != null ) { libxml_use_internal_errors ( true ) ; $ dom = new DOMDocument ; $ dom -> loadHTML ( $ html ) ; libxml_clear_errors ( ) ; libxml_use_internal_errors ( false ) ; return $ dom ; } }
checkContentHasSubtitles . check if page Content has a h2 s in it
59,914
public function checkPageSubjectInImageAltTags ( ) { $ html = $ this -> getPageContent ( ) ; if ( $ html == '' ) { return false ; } $ dom = $ this -> createDOMDocumentFromHTML ( $ html ) ; $ images = $ dom -> getElementsByTagName ( 'img' ) ; foreach ( $ images as $ image ) { if ( $ image -> hasAttribute ( 'alt' ) && $ ...
checkPageSubjectInImageAlt . Checks if image alt tags contain page subject
59,915
private function checkImageAltTags ( ) { $ html = $ this -> getPageContent ( ) ; if ( $ html == '' ) { return false ; } $ dom = $ this -> createDOMDocumentFromHTML ( $ html ) ; $ images = $ dom -> getElementsByTagName ( 'img' ) ; $ imagesWithAltTags = 0 ; foreach ( $ images as $ image ) { if ( $ image -> hasAttribute (...
checkImageAltTags . Checks if images in content have alt tags
59,916
private function checkImageTitleTags ( ) { $ html = $ this -> getPageContent ( ) ; if ( $ html == '' ) { return false ; } $ dom = $ this -> createDOMDocumentFromHTML ( $ html ) ; $ images = $ dom -> getElementsByTagName ( 'img' ) ; $ imagesWithTitleTags = 0 ; foreach ( $ images as $ image ) { if ( $ image -> hasAttribu...
checkImageTitleTags . Checks if images in content have title tags
59,917
public function checkPageSubjectInTitle ( ) { if ( $ this -> checkPageSubjectDefined ( ) ) { if ( preg_match ( '/' . preg_quote ( $ this -> owner -> SEOPageSubject , '/' ) . '/i' , $ this -> owner -> MetaTitle ) ) { return true ; } elseif ( preg_match ( '/' . preg_quote ( $ this -> owner -> SEOPageSubject , '/' ) . '/i...
checkPageSubjectInTitle . Checks if defined PageSubject is present in the Page Title
59,918
public function checkPageSubjectInContent ( ) { if ( $ this -> checkPageSubjectDefined ( ) ) { if ( preg_match ( '/' . preg_quote ( $ this -> owner -> SEOPageSubject , '/' ) . '/i' , $ this -> getPageContent ( ) ) ) { return true ; } else { return false ; } } return false ; }
checkPageSubjectInContent . Checks if defined PageSubject is present in the Page Content
59,919
public function checkPageSubjectInFirstParagraph ( ) { if ( $ this -> checkPageSubjectDefined ( ) ) { $ first_paragraph = $ this -> owner -> dbObject ( 'Content' ) -> FirstParagraph ( ) ; if ( trim ( $ first_paragraph != '' ) ) { if ( preg_match ( '/' . preg_quote ( $ this -> owner -> SEOPageSubject , '/' ) . '/i' , $ ...
checkPageSubjectInFirstParagraph . Checks if defined PageSubject is present in the Page Content s First Paragraph
59,920
public function checkPageSubjectInUrl ( ) { if ( $ this -> checkPageSubjectDefined ( ) ) { $ url_segment = $ this -> owner -> URLSegment ; $ pagesubject_url_segment = $ this -> owner -> generateURLSegment ( $ this -> owner -> SEOPageSubject ) ; if ( preg_match ( '/' . preg_quote ( $ pagesubject_url_segment , '/' ) . '/...
checkPageSubjectInUrl . Checks if defined PageSubject is present in the Page URLSegment
59,921
public function checkPageSubjectInMetaDescription ( ) { if ( $ this -> checkPageSubjectDefined ( ) ) { if ( preg_match ( '/' . preg_quote ( $ this -> owner -> SEOPageSubject , '/' ) . '/i' , $ this -> owner -> MetaDescription ) ) { return true ; } else { return false ; } } return false ; }
checkPageSubjectInMetaDescription . Checks if defined PageSubject is present in the Page MetaDescription
59,922
private function checkPageTitleLength ( ) { $ site_title_length = strlen ( $ this -> owner -> getSiteConfig ( ) -> Title ) ; return ( ( $ this -> getNumCharsTitle ( ) + 3 + $ site_title_length ) >= 40 ) ? true : false ; }
checkPageTitleLength . check if length of Title and SiteConfig . Title has a minimal of 40 chars
59,923
private function checkPageHasImages ( ) { $ html = $ this -> getPageContent ( ) ; if ( $ html == '' ) { return false ; } $ dom = $ this -> createDOMDocumentFromHTML ( $ html ) ; $ elements = $ dom -> getElementsByTagName ( 'img' ) ; return ( $ elements -> length ) ? true : false ; }
checkPageHasImages . check if page Content has a img s in it
59,924
public static function fromSruRecord ( SruRecord $ record , Client $ client = null ) { $ record -> data -> registerXPathNamespace ( 'marc' , 'http://www.loc.gov/MARC21/slim' ) ; $ mmsId = $ record -> data -> text ( './/marc:controlfield[@tag="001"]' ) ; return ( new self ( $ client , $ mmsId ) ) -> setMarcRecord ( $ re...
Initialize from SRU record without having to fetch the Bib record .
59,925
public function save ( ) { $ this -> init ( ) ; $ marcXml = new QuiteSimpleXMLElement ( $ this -> _marc -> toXML ( 'UTF-8' , false , false ) ) ; $ this -> data -> first ( 'record' ) -> replace ( $ marcXml ) ; $ newData = $ this -> data -> asXML ( ) ; $ newData = str_replace ( ' xmlns="http://www.loc.gov/MARC21/slim"' ,...
Save the MARC record .
59,926
public function getNzMmsId ( ) { $ this -> init ( ) ; $ nz_mms_id = $ this -> data -> text ( "linked_record_id[@type='NZ']" ) ; if ( ! $ nz_mms_id ) { throw new NoLinkedNetworkZoneRecordException ( "Record $this->mms_id is not linked to a network zone record." ) ; } return $ nz_mms_id ; }
Get the MMS ID of the linked record in network zone .
59,927
protected function configureArrayProperty ( $ property , OptionsResolver $ resolver ) { $ resolver -> setAllowedTypes ( $ property , [ 'array' , 'string' ] ) -> setNormalizer ( $ property , function ( Options $ options , $ value ) { return is_array ( $ value ) ? $ value : explode ( ',' , str_replace ( ' ' , '' , $ valu...
Configures an array property for OptionsResolver .
59,928
protected function configureEnvironmentProperty ( OptionsResolver $ resolver ) { $ resolver -> setDefined ( 'environment' ) -> setAllowedTypes ( 'environment' , [ 'array' , 'string' ] ) -> setNormalizer ( 'environment' , function ( Options $ options , $ value ) { if ( is_array ( $ value ) ) { $ normalized = [ ] ; forea...
Configures an environment property for OptionsResolver .
59,929
protected function configureByteProperty ( $ property , OptionsResolver $ resolver ) { $ resolver -> setAllowedTypes ( $ property , 'byte' ) -> setNormalizer ( $ property , function ( Options $ options , $ value ) { return is_numeric ( $ value ) ? intval ( $ value ) : $ value ; } ) ; }
Configures a byte property for OptionsResolver .
59,930
protected function buildUrl ( $ url , $ query = [ ] ) { $ url = explode ( '?' , $ url , 2 ) ; if ( count ( $ url ) == 2 ) { parse_str ( $ url [ 1 ] , $ query0 ) ; $ query = array_merge ( $ query0 , $ query ) ; } $ query [ 'apikey' ] = $ this -> key ; $ url = $ url [ 0 ] ; if ( strpos ( $ url , $ this -> baseUrl ) === f...
Extend an URL with query string parameters and return an UriInterface object .
59,931
public function getJSON ( $ url , $ query = [ ] ) { $ responseBody = $ this -> get ( $ url , $ query , 'application/json' ) ; return json_decode ( $ responseBody ) ; }
Make a GET request accepting JSON .
59,932
public function getXML ( $ url , $ query = [ ] ) { $ responseBody = $ this -> get ( $ url , $ query , 'application/xml' ) ; return new QuiteSimpleXMLElement ( $ responseBody ) ; }
Make a GET request accepting XML .
59,933
public function putJSON ( $ url , $ data ) { $ responseBody = $ this -> put ( $ url , json_encode ( $ data ) , 'application/json' ) ; return json_decode ( $ responseBody ) ; }
Make a PUT request sending JSON data .
59,934
public function putXML ( $ url , $ data ) { $ responseBody = $ this -> put ( $ url , $ data , 'application/xml' ) ; return new QuiteSimpleXMLElement ( $ responseBody ) ; }
Make a PUT request sending XML data .
59,935
public function post ( $ url , $ data , $ contentType = 'application/json' ) { $ uri = $ this -> buildUrl ( $ url ) ; $ request = $ this -> requestFactory -> createRequest ( 'POST' , $ uri ) ; if ( ! is_null ( $ contentType ) ) { $ request = $ request -> withHeader ( 'Content-Type' , $ contentType ) ; $ request = $ req...
Make a POST request .
59,936
public function postJSON ( $ url , $ data = null ) { $ responseBody = $ this -> post ( $ url , json_encode ( $ data ) , 'application/json' ) ; return json_decode ( $ responseBody ) ; }
Make a POST request sending JSON data .
59,937
public function postXML ( $ url , $ data = null ) { $ responseBody = $ this -> post ( $ url , $ data , 'application/xml' ) ; return new QuiteSimpleXMLElement ( $ responseBody ) ; }
Make a POST request sending XML data .
59,938
public function getRedirectLocation ( $ url , $ query = [ ] ) { $ url = $ this -> buildUrl ( $ url , $ query ) ; $ request = $ this -> requestFactory -> createRequest ( 'GET' , $ url ) ; try { $ response = $ this -> request ( $ request ) ; } catch ( ResourceNotFound $ e ) { return ; } $ locations = $ response -> getHea...
Get the redirect target location of an URL or null if not a redirect .
59,939
protected function parseClientError ( HttpException $ exception ) { $ contentType = explode ( ';' , $ exception -> getResponse ( ) -> getHeaderLine ( 'Content-Type' ) ) [ 0 ] ; $ responseBody = ( string ) $ exception -> getResponse ( ) -> getBody ( ) ; switch ( $ contentType ) { case 'application/json' : $ res = json_d...
Generate a client exception .
59,940
protected function setHeaders ( array $ headers ) { $ before = $ this -> headers ; try { foreach ( $ headers as $ name => $ value ) { $ this -> setHeader ( $ name , $ value ) ; } } catch ( \ Throwable $ e ) { $ this -> headers = $ before ; throw $ e ; } }
Sets the headers from the given array .
59,941
private function isValueValid ( array $ values ) : bool { foreach ( $ values as $ value ) { if ( \ preg_match ( "/[^\t\r\n\x20-\x7e\x80-\xfe]|\r\n/" , $ value ) ) { return false ; } } return true ; }
Determines if the given value is a valid header value .
59,942
public static function parseHeaders ( string $ rawHeaders ) : array { \ assert ( \ substr ( $ rawHeaders , - 2 ) === "\r\n" , "Argument 1 must end with CRLF" ) ; $ count = \ preg_match_all ( self :: HEADER_REGEX , $ rawHeaders , $ matches , \ PREG_SET_ORDER ) ; if ( $ count !== \ substr_count ( $ rawHeaders , "\n" ) ) ...
Parses headers according to RFC 7230 and 2616 .
59,943
public static function formatHeaders ( array $ headers ) : string { $ buffer = "" ; $ lines = 0 ; foreach ( $ headers as $ name => $ values ) { $ name = ( string ) $ name ; if ( $ name [ 0 ] === ":" ) { continue ; } foreach ( $ values as $ value ) { $ buffer .= "{$name}: {$value}\r\n" ; $ lines ++ ; } } $ count = \ pre...
Format headers in to their on - the - wire format .
59,944
protected function loadRoutes ( ) : RouteCollection { $ builder = $ this -> getRouteCollectionBuilder ( ) ; if ( \ is_callable ( $ this -> routeCallback ) ) { call_user_func ( $ this -> routeCallback , $ builder ) ; } return $ builder -> build ( ) ; }
Returns routes for request handling .
59,945
public function handle ( Request $ request ) : Response { try { $ matcher = $ this -> getUrlMatcher ( $ request ) ; $ parameters = $ matcher -> match ( $ request -> getPathInfo ( ) ) ; if ( empty ( $ parameters [ '_controller' ] ) ) { throw new InvalidRouteException ( 'Route requires a _controller callable' ) ; } if ( ...
Handles HTTP request and returns response .
59,946
protected function getControllerParameters ( Request $ request , array $ parameters ) : array { $ result = [ $ request ] ; foreach ( $ parameters as $ key => $ value ) { if ( strpos ( $ key , '_' ) !== 0 ) { $ result [ $ key ] = $ value ; } } return $ result ; }
Returns arguments for controller callback .
59,947
public function options ( string $ pattern , $ callback , array $ requirements = [ ] ) { return $ this -> match ( $ pattern , $ callback , $ requirements , [ Request :: METHOD_OPTIONS ] ) ; }
Maps an OPTIONS request to a callable .
59,948
public function compare ( \ DateInterval $ first , \ DateInterval $ second ) { if ( $ this -> safe ) { $ this -> safecheck ( $ first ) ; $ this -> safecheck ( $ second ) ; } if ( $ first -> y > $ second -> y ) { return 1 ; } if ( $ first -> y < $ second -> y ) { return - 1 ; } if ( $ first -> m > $ second -> m ) { retu...
COmpare the two date intervals .
59,949
protected function replaceEndpoint ( string & $ stub , string $ endpoint ) { if ( strlen ( $ endpoint ) > 0 ) $ stub = str_replace ( '/dummy/endpoint/' , $ endpoint , $ stub ) ; return $ this ; }
Replace the endpoint for the given stub .
59,950
protected function replaceVersion ( string & $ stub , string $ version ) { if ( strlen ( $ version ) > 0 ) $ stub = str_replace ( 'v1' , $ version , $ stub ) ; return $ this ; }
Replace the endpoint version for the given stub .
59,951
protected function replaceScope ( string & $ stub , string $ scope ) { if ( strlen ( $ scope ) > 0 ) $ stub = str_replace ( "'public'" , "'$scope'" , $ stub ) ; return $ this ; }
Replace the scope for the given stub .
59,952
protected function generatePrivateKey ( $ path , $ passphrase ) { if ( $ passphrase ) { $ processArgs = sprintf ( 'genrsa -out %s/private.pem -aes256 -passout pass:%s 4096' , $ path , $ passphrase ) ; } else { $ processArgs = sprintf ( 'genrsa -out %s/private.pem 4096' , $ path ) ; } $ this -> generateKey ( $ processAr...
Generate a RSA private key .
59,953
protected function generatePublicKey ( $ path , $ passphrase ) { $ processArgs = sprintf ( 'rsa -pubout -in %s/private.pem -out %s/public.pem -passin pass:%s' , $ path , $ path , $ passphrase ) ; $ this -> generateKey ( $ processArgs ) ; }
Generate a RSA public key .
59,954
protected function generateKey ( $ processArgs ) { $ process = new Process ( sprintf ( 'openssl %s' , $ processArgs ) ) ; $ process -> setTimeout ( 3600 ) ; $ process -> run ( function ( $ type , $ buffer ) { $ this -> io -> write ( $ buffer ) ; } ) ; if ( ! $ process -> isSuccessful ( ) ) { throw new ProcessFailedExce...
Generate a RSA key .
59,955
public function addUniqueKey ( $ name , array $ fields ) { Argument :: i ( ) -> test ( 1 , 'string' ) ; $ this -> uniqueKeys [ $ name ] = $ fields ; return $ this ; }
Adds a unique key
59,956
public function registerAction ( ) { $ userIdentityField = $ this -> container -> getParameter ( 'rch_jwt_user.user_identity_field' ) ; $ userManager = $ this -> container -> get ( 'fos_user.user_manager' ) ; $ userClass = $ userManager -> getClass ( ) ; $ rules = [ $ userIdentityField => [ 'requirements' => [ 'email' ...
Register a new User and authenticate it .
59,957
public function loginFromOAuthResponseAction ( ) { $ userManager = $ this -> container -> get ( 'fos_user.user_manager' ) ; $ userIdentityField = $ this -> container -> get ( 'rch_jwt_user.user_identity_field' ) ; $ data = $ this -> get ( 'rch_jwt_user.credential_fetcher' ) -> create ( [ $ userIdentityField => [ 'requi...
Registers and authenticates User from a facebook OAuth Response .
59,958
protected function createUser ( array $ data , UserProviderInterface $ userManager ) { $ userIdentityfield = $ this -> container -> getParameter ( 'rch_jwt_user.user_identity_field' ) ; $ user = $ userManager -> createUser ( ) -> setUsername ( $ data [ $ userIdentityfield ] ) -> setEmail ( $ data [ $ userIdentityfield ...
Creates a new User .
59,959
protected function renderToken ( UserInterface $ user , $ statusCode = 200 ) { $ body = [ 'token' => $ this -> container -> get ( 'lexik_jwt_authentication.jwt_manager' ) -> create ( $ user ) , 'refresh_token' => $ this -> attachRefreshToken ( $ user ) , 'user' => $ user -> getUsername ( ) , ] ; return new JsonResponse...
Generates a JWT from given User .
59,960
protected function attachRefreshToken ( UserInterface $ user ) { $ refreshTokenManager = $ this -> container -> get ( 'gesdinet.jwtrefreshtoken.refresh_token_manager' ) ; $ refreshToken = $ refreshTokenManager -> getLastFromUsername ( $ user -> getUsername ( ) ) ; $ refreshTokenTtl = $ this -> container -> getParameter...
Provides a refresh token .
59,961
protected function createJsonResponseForException ( UserException $ exception ) { $ message = $ exception -> getMessage ( ) ; $ statusCode = $ exception -> getStatusCode ( ) ; $ content = [ 'error' => str_replace ( '"' , '\'' , $ message ) ] ; return new JsonResponse ( $ content , $ statusCode ) ; }
Create JsonResponse for Exception .
59,962
public function renameTable ( $ table , $ name ) { Argument :: i ( ) -> test ( 1 , 'string' ) -> argument ( 2 , 'string' ) ; $ this -> query = 'RENAME TABLE `' . $ table . '` TO `' . $ name . '`' ; return $ this ; }
Query for renaming a table
59,963
public function setRequirements ( ) { if ( ! isset ( $ this -> options [ 'requirements' ] ) || $ this -> options [ 'requirements' ] === null ) { return $ this ; } $ requirements = $ this -> options [ 'requirements' ] ; if ( ! is_array ( $ requirements ) ) { $ requirements = [ $ requirements ] ; } foreach ( $ requiremen...
Set requirements .
59,964
public function removeSection ( $ section ) { if ( $ has = $ this -> hasSection ( $ section ) ) { unset ( $ this -> sections [ $ section ] ) ; } return $ has ; }
Removes a section by name .
59,965
public function toArray ( ) { $ ini = [ ] ; foreach ( $ this -> sections as $ sectionName => $ section ) { $ ini [ $ sectionName ] = $ section -> getProperties ( ) ; } return $ ini ; }
Converts the configuration to array .
59,966
public function mapSection ( $ section , $ className ) { if ( false === class_exists ( $ className ) ) { throw new \ InvalidArgumentException ( 'This section class does not exist' ) ; } elseif ( false === is_a ( $ className , 'Supervisor\Configuration\Section' , true ) ) { throw new \ InvalidArgumentException ( 'This s...
Adds or overrides a default section mapping .
59,967
public function findSection ( $ section ) { if ( isset ( $ this -> sectionMap [ $ section ] ) ) { return $ this -> sectionMap [ $ section ] ; } return false ; }
Finds a section class by name .
59,968
public function fromBarcode ( $ barcode ) { $ destinationUrl = $ this -> client -> getRedirectLocation ( '/items' , [ 'item_barcode' => $ barcode ] ) ; if ( ! is_null ( $ destinationUrl ) && preg_match ( '$bibs/([0-9]+)/holdings/([0-9]+)/items/([0-9]+)$' , $ destinationUrl , $ matches ) ) { $ mms_id = $ matches [ 1 ] ;...
Get an Item object from a barcode .
59,969
public function subselect ( $ parentQuery , $ select = '*' ) { Argument :: i ( ) -> test ( 2 , 'string' ) ; return Subselect :: i ( $ parentQuery , $ select ) ; }
Returns the Subselect query builder
59,970
public function getSchema ( ) { $ backup = array ( ) ; $ tables = $ this -> getTables ( ) ; foreach ( $ tables as $ table ) { $ backup [ ] = $ this -> getBackup ( ) ; } return implode ( "\n\n" , $ backup ) ; }
Returns the whole enitre schema and rows of the current databse
59,971
public function attach ( Task $ task , $ task_name = null ) { if ( is_null ( $ task_name ) ) { $ task_name = count ( $ this -> tasks ) ; } $ this -> tasks [ $ task_name ] = $ task ; curl_multi_add_handle ( $ this -> curl , $ task -> createCurl ( ) ) ; $ deferred = new Deferred ( ) ; $ this -> deferred [ $ task_name ] =...
add new task and return a promise
59,972
public function get ( $ user_id , $ params = [ ] ) { return User :: make ( $ this -> client , $ user_id ) -> setParams ( $ params ) ; }
Get a User object by id .
59,973
public function search ( $ query , array $ options = [ ] ) { $ limit = array_key_exists ( 'limit' , $ options ) ? $ options [ 'limit' ] : 0 ; $ phrase = array_key_exists ( 'phrase' , $ options ) ? $ options [ 'phrase' ] : false ; $ expand = array_key_exists ( 'expand' , $ options ) ? $ options [ 'expand' ] : false ; $ ...
Iterates over all users matching the given query . Handles continuation .
59,974
public function get ( $ mms_id , $ expand = null ) { $ params = [ 'expand' => $ expand ] ; return Bib :: make ( $ this -> client , $ mms_id ) -> setParams ( $ params ) ; }
Get a Bib object .
59,975
public function fromBarcode ( $ barcode ) { $ destinationUrl = $ this -> client -> getRedirectLocation ( '/items' , [ 'item_barcode' => $ barcode ] ) ; if ( ! is_null ( $ destinationUrl ) && preg_match ( '$bibs/([0-9]+)/holdings/([0-9]+)/items/([0-9]+)$' , $ destinationUrl , $ matches ) ) { $ mmsId = $ matches [ 1 ] ; ...
Get a Bib object from a item barcode .
59,976
public function fromHoldingsId ( $ holdings_id ) { $ data = $ this -> client -> getXML ( '/bibs' , [ 'holdings_id' => $ holdings_id ] ) ; return $ this -> get ( $ data -> text ( 'bib/mms_id' ) ) -> init ( $ data -> first ( 'bib' ) ) ; }
Get a Bib object from a holdings ID .
59,977
public function getGuzzle ( ) { if ( $ this -> guzzle ) return $ this -> guzzle ; $ this -> guzzle = new Client ( ) ; return $ this -> guzzle ; }
Get an instance of Guzzle .
59,978
public function isStorageOk ( ) { $ storage = storage_path ( ) . '/sde/' . $ this -> json -> version . '/' ; $ this -> info ( 'Storage path is: ' . $ storage ) ; if ( File :: isWritable ( storage_path ( ) ) ) { if ( ! File :: exists ( $ storage ) ) File :: makeDirectory ( $ storage , 0755 , true ) ; $ this -> storage_p...
Check that the storage path is ok . I needed it will be automatically created .
59,979
public function getProgressBar ( $ iterations ) { $ bar = $ this -> output -> createProgressBar ( $ iterations ) ; $ bar -> setFormat ( ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s% %memory:6s%' ) ; return $ bar ; }
Get a new progress bar to display based on the amount of iterations we expect to use .
59,980
public function importSde ( ) { $ this -> line ( 'Importing...' ) ; $ bar = $ this -> getProgressBar ( count ( $ this -> json -> tables ) ) ; foreach ( $ this -> json -> tables as $ table ) { $ archive_path = $ this -> storage_path . $ table . $ this -> json -> format ; $ extracted_path = $ this -> storage_path . $ tab...
Extract the SDE files downloaded and run the MySQL command to import them into the database .
59,981
public function select ( $ select = 'ROWID,*' ) { Argument :: i ( ) -> test ( 1 , 'string' , 'array' ) ; return \ Eden \ Sql \ Select :: i ( $ select ) ; }
Returns the select query builder
59,982
public function all ( $ status = 'ACTIVE' ) { $ ids = [ $ this -> data -> primary_id ] ; foreach ( $ this -> data -> user_identifier as $ identifier ) { if ( is_null ( $ status ) || $ identifier -> status == $ status ) { $ ids [ ] = $ identifier -> value ; } } return $ ids ; }
Get a flat array of all the user IDs .
59,983
public function allOfType ( $ value , $ status = 'ACTIVE' ) { $ ids = [ ] ; foreach ( $ this -> data -> user_identifier as $ identifier ) { if ( $ identifier -> id_type -> value == $ value && ( is_null ( $ status ) || $ identifier -> status == $ status ) ) { $ ids [ ] = $ identifier -> value ; } } return $ ids ; }
Get all active user identifiers of a given type like BARCODE or UNIV_ID .
59,984
public function firstOfType ( $ value , $ status = 'ACTIVE' ) { foreach ( $ this -> data -> user_identifier as $ identifier ) { if ( $ identifier -> id_type -> value == $ value && ( is_null ( $ status ) || $ identifier -> status == $ status ) ) { return $ identifier -> value ; } } }
Get the first active user identifier of a given type like BARCODE or UNIV_ID .
59,985
protected function onData ( $ data ) { if ( is_null ( $ this -> totalRecordCount ) ) { $ this -> totalRecordCount = $ data -> total_record_count ; } if ( ! isset ( $ data -> { $ this -> responseKey } ) ) { return ; } foreach ( $ data -> { $ this -> responseKey } as $ result ) { $ this -> resources [ ] = $ this -> conve...
Called when data is available on the object . The resource classes can use this method to process the data .
59,986
public function digestAuth ( $ realm , array $ users ) { if ( $ this -> isCLIRequest ( ) ) { return ; } if ( empty ( $ _SERVER [ 'PHP_AUTH_DIGEST' ] ) ) { $ this -> sendAuthenticateHeader ( $ realm ) ; exit ( ) ; } if ( ! ( $ data = $ this -> httpDigestParse ( $ _SERVER [ 'PHP_AUTH_DIGEST' ] ) ) || ! isset ( $ users [ ...
Perform digest HTTP authentication
59,987
protected function isSSLRequest ( ) { if ( isset ( $ _SERVER [ 'HTTPS' ] ) ) { if ( 'on' == strtolower ( $ _SERVER [ 'HTTPS' ] ) ) { return true ; } if ( '1' == $ _SERVER [ 'HTTPS' ] ) { return true ; } } elseif ( isset ( $ _SERVER [ 'SERVER_PORT' ] ) && ( '443' == $ _SERVER [ 'SERVER_PORT' ] ) ) { return true ; } retu...
Checks if application is requested via secure SSL
59,988
public function clear_redis_cache ( ) { $ redis_host = config ( 'database.redis.default.host' ) ; $ redis_port = config ( 'database.redis.default.port' ) ; $ this -> info ( 'Clearing the Redis Cache at: ' . $ redis_host . ':' . $ redis_port ) ; try { $ redis = new Client ( [ 'host' => $ redis_host , 'port' => $ redis_p...
Flush all keys in Redis .
59,989
public function clear_eseye_cache ( ) { $ eseye_cache = config ( 'eveapi.config.eseye_cache' ) ; if ( File :: isWritable ( $ eseye_cache ) ) { $ this -> info ( 'Clearing the Eseye Cache at: ' . $ eseye_cache ) ; if ( ! File :: deleteDirectory ( $ eseye_cache , true ) ) $ this -> error ( 'Failed to clear the Eseye Cache...
Clear the Eseye Storage Cache .
59,990
protected function onData ( $ data ) { if ( isset ( $ this -> bib_data ) ) { $ this -> bib -> init ( $ this -> bib_data ) ; } if ( isset ( $ this -> holding_data ) ) { $ this -> holding -> init ( $ this -> holding_data ) ; } }
Called when data is available to be processed .
59,991
public function checkOut ( User $ user , Library $ library , $ circ_desk = 'DEFAULT_CIRC_DESK' ) { $ postData = [ 'library' => [ 'value' => $ library -> code ] , 'circ_desk' => [ 'value' => $ circ_desk ] , ] ; $ data = $ this -> client -> postJSON ( $ this -> url ( '/loans' , [ 'user_id' => $ user -> id ] ) , $ postDat...
Create a new loan .
59,992
public function scanIn ( Library $ library , $ circ_desk = 'DEFAULT_CIRC_DESK' , $ params = [ ] ) { $ params [ 'op' ] = 'scan' ; $ params [ 'library' ] = $ library -> code ; $ params [ 'circ_desk' ] = $ circ_desk ; $ data = $ this -> client -> postJSON ( $ this -> url ( '' , $ params ) ) ; return ScanInResponse :: make...
Perform scan - in on item .
59,993
public function getLoan ( ) { $ data = $ this -> client -> getJSON ( $ this -> url ( '/loans' ) ) ; if ( $ data -> total_record_count == 1 ) { return Loan :: make ( $ this -> client , User :: make ( $ this -> client , $ data -> item_loan [ 0 ] -> user_id ) , $ data -> item_loan [ 0 ] -> loan_id ) -> init ( $ data -> it...
Get the current loan as a Loan object or null if the item is not loaned out .
59,994
public function onAuthenticationSuccessResponse ( AuthenticationSuccessEvent $ event ) { $ data = $ event -> getData ( ) ; $ data [ 'user' ] = $ event -> getUser ( ) -> getUsername ( ) ; $ event -> setData ( $ data ) ; }
Add public data to the authentication response .
59,995
protected function readColumnHeaders ( QuiteSimpleXMLElement $ results ) { $ headers = array_map ( function ( QuiteSimpleXMLElement $ node ) { return $ node -> attr ( 'saw-sql:columnHeading' ) ; } , $ results -> all ( '//xsd:complexType[@name="Row"]/xsd:sequence/xsd:element[position()>1]' ) ) ; if ( ! count ( $ headers...
Read column headers from response and check that we got the right number of columns back .
59,996
public function getItem ( ) { $ bib = Bib :: make ( $ this -> client , $ this -> data -> bib_data -> mms_id ) ; $ holding = Holding :: make ( $ this -> client , $ bib , $ this -> data -> holding_data -> holding_id ) ; return Item :: make ( $ this -> client , $ bib , $ holding , $ this -> data -> item_data -> pid ) -> i...
Get the scanned - in item .
59,997
public function getHolding ( ) { $ bib = Bib :: make ( $ this -> client , $ this -> data -> bib_data -> mms_id ) ; return Holding :: make ( $ this -> client , $ bib , $ this -> data -> holding_data -> holding_id ) -> init ( $ this -> data -> holding_data ) ; }
Get the Holding object for the scanned - in item .
59,998
public function getBib ( ) { return Bib :: make ( $ this -> client , $ this -> data -> bib_data -> mms_id ) -> init ( $ this -> data -> bib_data ) ; }
Get the Bib object for the scanned - in item .
59,999
public function environment_info ( ) { $ this -> line ( ' * Getting environment information' ) ; $ user = posix_getpwuid ( posix_geteuid ( ) ) [ 'name' ] ; if ( $ user === 'root' ) { $ this -> error ( 'WARNING: This command is running as root!' ) ; $ this -> error ( 'WARNING: Running as root means that we will probably...
Print some information about the current environment .