idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
229,600
public function prefix ( $ path ) { $ path = $ this -> cleanPath ( $ path ) ; return preg_match ( '|^(?P<prefix>([a-zA-Z]+:)?//?)|' , $ path , $ matches ) ? $ matches [ 'prefix' ] : null ; }
Get path prefix .
229,601
public function remove ( $ fromSource , $ paths ) : bool { $ paths = ( array ) $ paths ; $ fromSource = $ this -> cleanSource ( $ fromSource ) ; list ( $ alias ) = $ this -> parse ( $ fromSource ) ; $ return = false ; foreach ( $ paths as $ origPath ) { $ path = $ this -> cleanPathInternal ( $ this -> cleanPath ( $ ori...
Remove path from registered paths for source
229,602
public function setRoot ( $ dir ) { if ( ! is_dir ( $ dir ) ) { throw new Exception ( sprintf ( 'Not found directory: %s' , $ dir ) ) ; } $ this -> root = $ this -> cleanPath ( $ dir ) ; }
Setup root directory .
229,603
public function rel ( $ source ) { $ fullpath = ( string ) $ this -> get ( $ source ) ; return FS :: getRelative ( $ fullpath , $ this -> root , '/' ) ; }
Get relative path to file or directory
229,604
public function relGlob ( $ source ) { $ list = ( array ) $ this -> glob ( $ source ) ; foreach ( $ list as $ key => $ item ) { $ list [ $ key ] = FS :: getRelative ( $ item , $ this -> root , '/' ) ; } return $ list ; }
Get list of relative path to file or directory
229,605
protected function addNewPath ( $ path , $ alias , $ mode ) { if ( $ cleanPath = $ this -> cleanPathInternal ( $ path ) ) { if ( $ mode === self :: MOD_PREPEND ) { array_unshift ( $ this -> paths [ $ alias ] , $ cleanPath ) ; } if ( $ mode === self :: MOD_APPEND ) { $ this -> paths [ $ alias ] [ ] = $ cleanPath ; } } }
Add path to hold .
229,606
protected function find ( $ paths , $ file , $ isGlob = false ) { $ paths = ( array ) $ paths ; $ file = ltrim ( $ file , "\\/" ) ; foreach ( $ paths as $ path ) { $ fullPath = $ this -> clean ( $ path . '/' . $ file ) ; if ( $ isGlob ) { $ paths = glob ( $ fullPath , GLOB_BRACE ) ; $ paths = array_filter ( ( array ) $...
Find actual file or directory in the paths .
229,607
protected function cleanPathInternal ( $ path ) { if ( $ this -> isVirtual ( $ path ) ) { return $ this -> cleanPath ( $ path ) ; } if ( $ this -> hasCDBack ( $ path ) ) { $ realpath = $ this -> cleanPath ( realpath ( $ path ) ) ; return $ realpath ? : null ; } return $ this -> cleanPath ( $ path ) ; }
Get add path .
229,608
protected function getUrlPath ( $ path , $ exitsFile = false ) : string { $ this -> checkRoot ( ) ; $ path = $ this -> cleanPathInternal ( $ path ) ; if ( $ this -> isVirtual ( $ path ) ) { $ path = $ this -> get ( $ path ) ; } $ subject = $ path ; $ pattern = '/^' . preg_quote ( $ this -> root , '/' ) . '/i' ; if ( $ ...
Get url path .
229,609
protected function parse ( $ source ) : array { $ path = null ; list ( $ alias , $ path ) = explode ( ':' , $ source , 2 ) ; $ path = ltrim ( $ path , "\\/" ) ; $ paths = $ this -> resolvePaths ( $ alias ) ; return [ $ alias , $ paths , $ path ] ; }
Parse source string .
229,610
protected function Init ( ) { $ this -> container = new Container ( Request :: GetData ( 'container' ) ) ; $ this -> containerRights = new ContainerRights ( $ this -> container -> GetUserGroupRights ( ) ) ; $ this -> AddNameField ( ) ; $ this -> AddUserGroupField ( ) ; $ this -> AddSubmit ( ) ; return parent :: Init ( ...
Initializes the container form
229,611
protected function OnSuccess ( ) { $ action = Action :: Update ( ) ; if ( ! $ this -> container -> Exists ( ) ) { $ action = Action :: Create ( ) ; $ this -> container -> SetUser ( self :: Guard ( ) -> GetUser ( ) ) ; } $ this -> container -> SetName ( $ this -> Value ( 'Name' ) ) ; $ this -> container -> Save ( ) ; $ ...
Saves the container
229,612
private function SaveRights ( ) { $ groupID = $ this -> Value ( 'UserGroup' ) ; $ userGroup = Usergroup :: Schema ( ) -> ByID ( $ groupID ) ; $ this -> container -> SetUserGroup ( $ userGroup ) ; if ( ! $ userGroup ) { $ oldRights = $ this -> container -> GetUserGroupRights ( ) ; if ( $ oldRights ) { $ oldRights -> Get...
Saves group and rights
229,613
public function mergeCopyWith ( $ other , $ notNull = true ) { $ copy = clone $ this ; if ( $ other === $ this ) { return $ copy ; } if ( $ other instanceof self ) { foreach ( $ other -> toArray ( $ notNull ) as $ key => $ value ) { if ( property_exists ( $ copy , $ key ) ) { $ copy -> $ key = $ value ; } } } elseif ( ...
Create copy of this configuration with merged other data .
229,614
public final function setWidth ( int $ width ) : Size { $ this -> triggerFixedErrorByNeed ( 'width-change' ) ; $ this -> _width = \ max ( $ width , 0 ) ; return $ this ; }
Sets the width .
229,615
public final function setHeight ( int $ height ) : Size { $ this -> triggerFixedErrorByNeed ( 'height-change' ) ; $ this -> _height = \ max ( $ height , 0 ) ; return $ this ; }
Sets the height .
229,616
public final function contains ( Size $ size ) : bool { return ( ( $ size -> _width <= $ this -> _width ) && ( $ size -> _height <= $ this -> _height ) ) ; }
Returns if the current size can contain the size dimensions of the defined size .
229,617
public final function isNearQuadratic ( float $ maxDifference = 0.15 ) : bool { if ( $ this -> isQuadratic ( ) ) { return true ; } if ( $ maxDifference >= 0.01 && $ maxDifference <= 0.3 ) { $ diff = 1.0 + $ maxDifference ; } else { $ diff = 1.15 ; } if ( $ this -> isPortrait ( ) ) { return ( ( 0.0 + $ this -> _height )...
Returns if the current size uses a near quadratic format . It means if width and height difference is lower or equal to ?? percent .
229,618
public final function reduceToMaxSize ( Size $ maxSize ) : bool { $ this -> triggerFixedErrorByNeed ( 'reduceToMaxSize' ) ; if ( ( $ this -> _width < $ maxSize -> _width ) && ( $ this -> _height < $ maxSize -> _height ) ) { return false ; } if ( ( $ this -> _width === $ maxSize -> _width ) && ( $ this -> _height === $ ...
Decrease the current size to fit the defined Size by holding its proportions .
229,619
public final function reduceMinSideTo ( int $ newShortSideLength ) : bool { $ this -> triggerFixedErrorByNeed ( 'reduceMinSideTo' ) ; if ( $ this -> isPortrait ( ) ) { if ( $ newShortSideLength >= $ this -> _width ) { return false ; } $ resultPercent = ( 100 * $ newShortSideLength ) / $ this -> _width ; $ this -> _heig...
Decrease the shortest side to the defined length and also contracts the longer side to hold the proportion of this size . If the current size defines a quadratic size it is also decreased but with searching the longer side .
229,620
public final function reduceMinSideTo2 ( int $ newLandscapeMaxHeight , int $ newPortraitMaxWidth ) : bool { $ this -> triggerFixedErrorByNeed ( 'reduceMinSideTo2' ) ; if ( $ this -> isPortrait ( ) ) { if ( $ newPortraitMaxWidth >= $ this -> _width ) { return false ; } $ resultPercent = ( 100 * $ newPortraitMaxWidth ) /...
Decrease the shortest side to the defined length and also contracts the longer side to hold the proportion of this size . The value used as max side length is depending to the current size format .
229,621
public final function expandMaxSideTo ( int $ newMaxSideLength ) : bool { $ this -> triggerFixedErrorByNeed ( 'expandMaxSideTo' ) ; if ( $ this -> isPortrait ( ) ) { if ( $ newMaxSideLength < $ this -> _height ) { return false ; } $ resultPercent = ( 100 * $ newMaxSideLength ) / $ this -> _height ; $ this -> _width = \...
Expands the longest side to the defined length and also expands the shorter side to hold the proportion of this size . If the current size defines a quadratic size its also expanded but without searching the longer side .
229,622
public final function expandMaxSideTo2 ( int $ newLandscapeMaxWidth , int $ newPortraitMaxHeight ) : bool { $ this -> triggerFixedErrorByNeed ( 'expandMaxSideTo2' ) ; if ( $ this -> isPortrait ( ) ) { if ( $ newPortraitMaxHeight <= $ this -> _height ) { return false ; } $ resultPercent = ( 100 * $ newPortraitMaxHeight ...
Expands the longest side to the defined length and also expands the shorter side to hold the proportion of this size . The value used as max side length is depending to the current size format .
229,623
public final function resizeMaxSideTo2 ( int $ newLandscapeWidth , int $ newPortraitHeight ) : bool { if ( $ this -> isPortrait ( ) ) { if ( $ newPortraitHeight == $ this -> _height ) { return false ; } if ( $ newPortraitHeight < $ this -> _height ) { return $ this -> reduceMaxSideTo2 ( $ newLandscapeWidth , $ newPortr...
Resize the longest side to the defined length and also resize the shorter side to hold the proportion of this size . The value used as max side length is depending to the current size format .
229,624
public static function TryParse ( $ value , & $ size , bool $ fixed = false ) : bool { $ size = null ; if ( \ is_int ( $ value ) ) { $ size = new Size ( $ value , $ value , $ fixed ) ; return true ; } if ( \ is_double ( $ value ) ) { $ size = new Size ( ( int ) $ value , ( int ) $ value , $ fixed ) ; return true ; } if...
Tries to parse the the defined values as a size and returns the success state .
229,625
public static function Empty ( bool $ fixed = false ) : Size { if ( $ fixed ) { return \ is_null ( static :: $ emptyFixed ) ? ( static :: $ emptyFixed = new Size ( 0 , 0 , true ) ) : static :: $ emptyFixed ; } return new Size ( 0 , 0 , $ fixed ) ; }
Gets a empty Size instance .
229,626
public function getAllSections ( ) { $ sections = array ( ) ; $ section = $ this -> section ; do { $ sections [ ] = $ section ; } while ( $ section = $ section -> getSectionConfig ( ) -> getParentSection ( ) ) ; return array_reverse ( $ sections ) ; }
Recursively gets all the sections
229,627
public function xml2array ( ) : void { $ this -> xml2json ( ) ; $ this -> arrayData = json_decode ( $ this -> jsonData , TRUE ) ; }
Convert XML to Array
229,628
public function array2xml ( string $ xmlField = '' , ? string $ dataField = null ) : void { $ xml = new SimpleXMLElement ( '<?xml version="1.0" encoding="UTF-8"?><' . $ xmlField . '/>' ) ; $ this -> createXml ( $ xml , $ this -> arrayData , $ dataField ) ; $ this -> xmlData = $ xml -> asXML ( ) ; }
Convert Array to XML
229,629
private function createXml ( SimpleXMLElement $ obj , array $ array , ? string $ prevKey = 'data' ) : void { foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) ) { if ( is_numeric ( $ key ) ) { $ node = $ obj -> addChild ( $ prevKey ) ; $ this -> createXml ( $ node , $ value ) ; } elseif ( $ key == '@a...
Private method to create XML output
229,630
public function xml2json ( ) : void { $ xml = simplexml_load_string ( $ this -> xmlData , NULL , LIBXML_NOCDATA ) ; $ this -> jsonData = json_encode ( $ xml ) ; }
Convert XML to JSON
229,631
public function indexAction ( ) { $ em = $ this -> getDoctrineManager ( ) ; $ entities = $ em -> getRepository ( 'BisonLabSakonninBundle:MessageType' ) -> findAll ( ) ; $ parents = $ em -> createQueryBuilder ( ) -> select ( 'mt' ) -> from ( 'BisonLab\SakonninBundle\Entity\MessageType' , 'mt' ) -> where ( 'mt.parent is ...
Lists all MessageType entities .
229,632
public function createAction ( Request $ request ) { $ entity = new MessageType ( ) ; $ form = $ this -> createCreateForm ( $ entity ) ; $ form -> handleRequest ( $ request ) ; $ data = $ form -> getData ( ) ; if ( ! $ data -> getParent ( ) && ! isset ( $ request -> request -> get ( $ form -> getName ( ) ) [ 'create_gr...
Creates a new MessageType entity .
229,633
private function createCreateForm ( MessageType $ entity ) { $ form = $ this -> createForm ( MessageTypeType :: class , $ entity , array ( 'action' => $ this -> generateUrl ( 'messagetype_create' ) , 'method' => 'POST' , ) ) ; $ this -> _addFunctionsToForm ( $ form ) ; $ form -> add ( 'create_group' , CheckboxType :: c...
Creates a form to create a MessageType entity .
229,634
public function newAction ( ) { $ entity = new MessageType ( ) ; $ form = $ this -> createCreateForm ( $ entity ) ; return $ this -> render ( 'BisonLabSakonninBundle:MessageType:edit.html.twig' , array ( 'entity' => $ entity , 'edit_form' => $ form -> createView ( ) , ) ) ; }
Displays a form to create a new MessageType entity .
229,635
private function createEditForm ( MessageType $ entity ) { $ form = $ this -> createForm ( MessageTypeType :: class , $ entity , array ( 'action' => $ this -> generateUrl ( 'messagetype_update' , array ( 'id' => $ entity -> getId ( ) ) ) , 'method' => 'PUT' , ) ) ; $ this -> _addFunctionsToForm ( $ form ) ; $ form -> a...
Creates a form to edit a MessageType entity .
229,636
public function updateAction ( Request $ request , $ id ) { $ em = $ this -> getDoctrineManager ( ) ; $ entity = $ em -> getRepository ( 'BisonLabSakonninBundle:MessageType' ) -> find ( $ id ) ; if ( ! $ entity ) { throw $ this -> createNotFoundException ( 'Unable to find MessageType entity.' ) ; } $ deleteForm = $ thi...
Edits an existing MessageType entity .
229,637
public function deleteAction ( Request $ request , $ id ) { $ form = $ this -> createDeleteForm ( $ id ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { $ em = $ this -> getDoctrineManager ( ) ; $ entity = $ em -> getRepository ( 'BisonLabSakonninBundle:MessageType' ) -> find ( $ id ) ; if ( ! ...
Deletes a MessageType entity .
229,638
public function register ( $ event , callable $ listener , $ priority = null ) { foreach ( ( array ) $ event as $ e ) { $ this -> registerListener ( $ e , $ listener , $ priority ) ; } return $ this ; }
Adds listener to single event or array of events
229,639
protected function resolvePseudoCallable ( $ callableOrArray ) { if ( is_array ( $ callableOrArray ) ) { $ this -> dereferenceArray ( $ callableOrArray ) ; } if ( is_callable ( $ callableOrArray ) ) { return $ callableOrArray ; } else { throw new LogicException ( Message :: get ( Message :: CALLABLE_INVALID , $ callabl...
Resolve a fake callable to a real one
229,640
protected function resolveCallableArguments ( callable $ callable , array $ providedArguments ) { if ( is_object ( $ callable ) && ! $ callable instanceof \ Closure ) { $ reflector = new \ ReflectionClass ( $ callable ) ; $ method = $ reflector -> getMethod ( '__invoke' ) ; } elseif ( is_array ( $ callable ) ) { $ refl...
Resolve arguments for a callable
229,641
protected function getObjectByClassname ( $ classname ) { if ( isset ( $ this -> mappings [ $ classname ] ) ) { $ classname = $ this -> mappings [ $ classname ] ; if ( false !== ( $ ref = $ this -> isReference ( $ classname ) ) ) { $ classname = $ this -> getReferenceValue ( $ ref ) ; if ( is_object ( $ classname ) ) {...
Get an object base on provided classname
229,642
protected function createServiceObject ( $ id , array $ arguments ) { $ def = & $ this -> services [ $ id ] [ 'class' ] ; $ class = $ def [ 0 ] ; $ args = empty ( $ arguments ) ? ( isset ( $ def [ 1 ] ) ? $ def [ 1 ] : [ ] ) : $ arguments ; try { if ( is_object ( $ class ) ) { if ( $ class instanceof \ Closure ) { retu...
Create service object from service definition
229,643
protected function runDefinedMethods ( $ id , $ service ) { try { if ( isset ( $ this -> services [ $ id ] [ 'methods' ] ) ) { $ methods = $ this -> services [ $ id ] [ 'methods' ] ; foreach ( $ methods as $ method ) { if ( ! is_array ( $ method ) || ! isset ( $ method [ 0 ] ) || ! is_string ( $ method [ 0 ] ) ) { thro...
Initialize service object by runing its defined methods
229,644
public function addMember ( GroupMemberInterface $ member ) { if ( $ this -> members -> contains ( $ member ) ) { throw new \ InvalidArgumentException ( 'This entity is already a member of this group' ) ; } $ this -> members -> add ( $ member ) ; }
Add a member to the collection .
229,645
public function removeMember ( GroupMemberInterface $ member ) { if ( ! $ this -> hasMember ( $ member ) ) { throw new \ InvalidArgumentException ( 'Trying to remove a member that is not in that group' ) ; } $ this -> members -> removeElement ( $ member ) ; }
Remove a member from the collection .
229,646
public function addChild ( GroupInterface $ child ) { if ( $ this -> children -> contains ( $ child ) ) { throw new \ InvalidArgumentException ( 'This entity is already a child of this group' ) ; } $ this -> children -> add ( $ child ) ; }
Add a child group to the collection .
229,647
public function removeChild ( GroupInterface $ child ) { if ( ! $ this -> hasChild ( $ child ) ) { throw new \ InvalidArgumentException ( 'Trying to remove a non existing child group' ) ; } $ this -> children -> removeElement ( $ child ) ; }
Remove a child group from the collection .
229,648
public function find ( Request $ request , array $ routes ) { foreach ( $ routes as $ route ) { if ( ! $ this -> matchMethod ( $ request , $ route ) ) { continue ; } if ( ! $ this -> matchContentType ( $ request , $ route ) ) { continue ; } if ( ! $ this -> matchFilters ( $ route ) ) { continue ; } $ routeMatches = $ t...
Finds a route in matching its pattern with a uri .
229,649
public function getName ( ) { if ( ! $ this -> name ) { $ this -> name = $ this -> utils ( ) -> whichModule ( $ this ) ; } return $ this -> name ; }
Retrieve module name for setup service
229,650
public function install ( $ version = null , array $ options = array ( ) ) { $ module = $ this -> utils ( ) -> whichModule ( $ this ) ; if ( $ version === null ) { $ version = $ this -> utils ( ) -> getModuleVersion ( $ module ) ; if ( ! $ version ) { throw new MissingParameterException ( 'Parameter version is missing ...
Install module and its dependencies
229,651
public function update ( array $ options = array ( ) ) { $ module = $ this -> utils ( ) -> whichModule ( $ this ) ; return $ this -> utils ( ) -> update ( $ module , $ options ) ; }
Update module and its dependencies
229,652
public function upgrade ( $ from , array $ options = array ( ) ) { $ to = $ this -> utils ( ) -> getModuleVersion ( $ this -> getName ( ) ) ; if ( SoftwareVersion :: compare ( $ to , $ from ) <= 0 ) { throw new Exception \ IllegalVersionException ( sprintf ( 'Unable to upgrade %s to version %s' , $ this -> getName ( ) ...
Upgrade module from previous version
229,653
protected function utils ( ) { if ( ! $ this -> utils ) { $ this -> utils = $ this -> getServiceLocator ( ) -> get ( 'valu_setup.setup_utils' ) ; } return $ this -> utils ; }
Direct access to service utilities
229,654
public function listen ( $ channels ) { $ channels = is_array ( $ channels ) ? $ channels : array ( $ channels ) ; foreach ( $ channels as $ channel ) { $ channel = preg_replace ( "/[^a-zA-Z\._:]/" , '' , $ channel ) ; $ this -> query ( new Raw ( "LISTEN {$channel}" ) ) ; } }
Subscribe to a postgres channel
229,655
public function quote ( $ value , array $ modifiers = [ ] ) { if ( is_null ( $ value ) ) { $ value = 'NULL' ; } elseif ( is_bool ( $ value ) ) { $ value = $ value ? 'TRUE' : 'FALSE' ; } elseif ( is_int ( $ value ) ) { $ value = ( string ) $ value ; } elseif ( $ value instanceof SqlInterface ) { $ value = $ value -> par...
Return a value made safe for insertion into a database
229,656
public function getParameter ( $ parameter ) { self :: isParameterAllowed ( $ parameter ) ; $ value = $ this -> query ( new Raw ( "SHOW {$parameter}" ) ) -> fetch ( Result :: FETCH_SINGLE ) ; return ( $ value === 'true' or $ value === 'false' ) ? \ Bond \ boolval ( $ value ) : $ value ; }
Get a postgres runtime parameter
229,657
public function setParameter ( $ parameter , $ value , $ restorePoint = self :: PREVIOUS , $ type = self :: SESSION ) { if ( ! is_scalar ( $ value ) ) { throw new BadTypeException ( $ value , 'scalar' ) ; } self :: isParameterAllowed ( $ parameter ) ; if ( ! in_array ( $ type , array ( self :: SESSION , self :: LOCAL )...
Set a postgres runtime parameter
229,658
public static function factory ( array $ record ) { if ( ! array_key_exists ( 'fields' , $ record ) ) { throw new InvalidArgumentException ( "Missing 'fields' index in record array" ) ; } $ fields = array_map ( array ( 'HAB\Pica\Record\Field' , 'factory' ) , $ record [ 'fields' ] ) ; $ type = null ; $ typePredicate = F...
Return a new record based on its array representation .
229,659
public function append ( Field $ field ) { if ( in_array ( $ field , $ this -> _fields , true ) ) { throw new InvalidArgumentException ( "{$this} already contains {$field}" ) ; } $ this -> _fields [ ] = $ field ; }
Append a field to the record .
229,660
public function sort ( ) { usort ( $ this -> _fields , function ( Field $ fieldA , Field $ fieldB ) { return strcmp ( $ fieldA -> getShorthand ( ) , $ fieldB -> getShorthand ( ) ) ; } ) ; }
Sort the fields of the record .
229,661
public function setFields ( array $ fields ) { $ this -> _fields = array ( ) ; foreach ( $ fields as $ field ) { $ this -> append ( $ field ) ; } }
Set the record fields .
229,662
public function getMaximumOccurrenceOf ( $ tag ) { if ( ! preg_match ( Field :: TAG_RE , $ tag ) ) { throw new InvalidArgumentException ( "Invalid field tag: {$tag}" ) ; } return array_reduce ( $ this -> getFields ( $ tag ) , function ( $ maxOccurrence , Field $ field ) { if ( $ field -> getOccurrence ( ) > $ maxOccurr...
Return the maximum occurrence value of a field .
229,663
public function getFirstMatchingField ( $ selector ) { $ fields = $ this -> getFields ( $ selector ) ; if ( empty ( $ fields ) ) { return null ; } else { return reset ( $ fields ) ; } }
Return the first field that matches a selector .
229,664
public function load ( $ helperName , $ directory = null ) : bool { $ helperName = strtolower ( str_replace ( array ( '_helper' , '.php' ) , '' , $ helperName ) . '_helper' ) ; $ directories = ( is_null ( $ directory ) ? $ this -> helperPaths : array ( $ directory ) ) ; if ( isset ( $ this -> helpers [ $ helperName ] )...
Load a helper .
229,665
public function removeHelperPath ( $ directory ) { if ( ( $ key = array_search ( $ directory , $ this -> helperPaths ) ) !== false ) { unset ( $ this -> helperPaths [ $ key ] ) ; } }
Remove a path where helpers can be found
229,666
public function setType ( $ type ) { if ( ! in_array ( $ type , array ( self :: AUTO , self :: ISBN10 , self :: ISBN13 ) ) ) { throw new Zend_Validate_Exception ( 'Invalid ISBN type' ) ; } $ this -> _type = $ type ; return $ this ; }
Set allowed ISBN type .
229,667
public function setBootstrapBrandImage ( string $ link , int $ size = 30 ) : void { $ this -> bootstrapOptions [ 'brand' ] [ 'image' ] [ 'link' ] = $ link ; $ this -> bootstrapOptions [ 'brand' ] [ 'image' ] [ 'size' ] = $ size ; }
Set Bootstrap brand image
229,668
public function getReflectionClass ( $ class , $ throw = true ) { if ( ! $ class = $ this -> getParameterBag ( ) -> resolveValue ( $ class ) ) { return ; } if ( isset ( self :: $ internalTypes [ $ class ] ) ) { return null ; } $ resource = null ; try { if ( isset ( $ this -> classReflectors [ $ class ] ) ) { $ classRef...
Retrieves the requested reflection class and registers it for resource tracking .
229,669
public function fileExists ( $ path , $ trackContents = true ) { $ exists = file_exists ( $ path ) ; if ( ! $ this -> trackResources || $ this -> inVendors ( $ path ) ) { return $ exists ; } if ( ! $ exists ) { $ this -> addResource ( new FileExistenceResource ( $ path ) ) ; return $ exists ; } if ( is_dir ( $ path ) )...
Checks whether the requested file or directory exists and registers the result for resource tracking .
229,670
public static function getServiceConditionals ( $ value ) { $ services = array ( ) ; if ( is_array ( $ value ) ) { foreach ( $ value as $ v ) { $ services = array_unique ( array_merge ( $ services , self :: getServiceConditionals ( $ v ) ) ) ; } } elseif ( $ value instanceof Reference && ContainerInterface :: IGNORE_ON...
Returns the Service Conditionals .
229,671
public static function getInitializedConditionals ( $ value ) { $ services = array ( ) ; if ( is_array ( $ value ) ) { foreach ( $ value as $ v ) { $ services = array_unique ( array_merge ( $ services , self :: getInitializedConditionals ( $ v ) ) ) ; } } elseif ( $ value instanceof Reference && ContainerInterface :: I...
Returns the initialized conditionals .
229,672
public static function hash ( $ value ) { $ hash = substr ( base64_encode ( hash ( 'sha256' , serialize ( $ value ) , true ) ) , 0 , 7 ) ; return str_replace ( array ( '/' , '+' ) , array ( '.' , '_' ) , strtolower ( $ hash ) ) ; }
Computes a reasonably unique hash of a value .
229,673
public function getExceptions ( \ Throwable $ exception ) : array { $ exc = $ exception ; do { $ exc_data = [ 'value' => $ this -> serializer -> serialize ( $ exc -> getMessage ( ) ) , 'type' => get_class ( $ exc ) , ] ; $ trace = $ exc -> getTrace ( ) ; $ frame_where_exception_thrown = [ 'file' => $ exc -> getFile ( )...
Generate exceptions data for Sentry
229,674
public function getStackTraceFrames ( array $ trace ) : array { return \ Raven_Stacktrace :: get_stack_info ( $ trace , $ this -> client -> trace , [ ] , $ this -> client -> message_limit , $ this -> client -> getPrefixes ( ) , $ this -> client -> getAppPath ( ) , $ this -> client -> getExcludedAppPaths ( ) , $ this ->...
Generate StackTrace frames for Sentry
229,675
public function cleanBacktrace ( array $ trace ) : array { $ firstNotRemovable = 0 ; foreach ( $ trace as $ index => $ item ) { if ( ! $ this -> shouldRemoveStack ( $ item ) ) { $ firstNotRemovable = $ index ; break ; } } $ trace = array_slice ( $ trace , $ firstNotRemovable ? : 0 ) ; return $ trace ; }
Remove stacks until the stack is from outside the logging context based on namespaces to ignore .
229,676
private function shouldRemoveStack ( array $ stack ) : bool { if ( empty ( $ stack [ 'class' ] ) ) { return false ; } foreach ( $ this -> ignoreBacktraceNamespaces as $ namespace ) { if ( 0 === strpos ( $ stack [ 'class' ] , $ namespace ) ) { return true ; } } return false ; }
Should the stack be removed?
229,677
function post ( $ url , $ parameters = array ( ) , $ multi = false ) { $ response = $ this -> oAuthRequest ( $ url , 'POST' , $ parameters , $ multi ) ; if ( $ this -> format === 'json' && $ this -> decode_json ) { return json_decode ( $ response , true ) ; } return $ response ; }
POST wreapper for oAuthRequest .
229,678
function delete ( $ url , $ parameters = array ( ) ) { $ response = $ this -> oAuthRequest ( $ url , 'DELETE' , $ parameters ) ; if ( $ this -> format === 'json' && $ this -> decode_json ) { return json_decode ( $ response , true ) ; } return $ response ; }
DELTE wrapper for oAuthReqeust .
229,679
public static function has ( string $ name , ? string $ syntax = null ) { if ( isset ( $ _SESSION [ 'application' ] [ 'with' ] [ $ name ] ) ) { $ _SESSION [ 'application' ] [ 'flash' ] [ 'used' ] = true ; $ name = $ _SESSION [ 'application' ] [ 'with' ] [ $ name ] ; return $ syntax ? str_replace ( ':message' , $ name ,...
Check if variables exists
229,680
public function getService ( $ service ) { if ( ! isset ( $ this -> services [ $ service ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Service %s not found' , $ service ) ) ; } return $ this -> services [ $ service ] ; }
Getter of a service
229,681
public function consume ( $ queueAlias , $ timeout = 0 ) { $ queues = is_array ( $ queueAlias ) ? $ this -> queueAliasResolver -> getQueues ( $ queueAlias ) : $ this -> queueAliasResolver -> getQueue ( $ queueAlias ) ; $ payloadArray = $ this -> redis -> blPop ( $ queues , $ timeout ) ; if ( empty ( $ payloadArray ) ) ...
Retrieve queue value with a defined timeout .
229,682
protected function isSelected ( ) : bool { $ key = $ this -> choices [ $ this -> line ] [ 'key' ] ; return array_key_exists ( $ key , $ this -> selections ) ; }
Check for current line
229,683
protected function checkMissingParentsDependencies ( array $ choice ) : array { $ missing = [ ] ; $ depends = ( array ) $ choice [ 'depends' ] ; foreach ( $ depends as $ dependency ) { if ( ! isset ( $ this -> selections [ $ dependency ] ) ) { foreach ( $ this -> choices as $ choice ) { if ( is_array ( $ choice ) && $ ...
Make sure all dependencies are already selected
229,684
public static function addPsr4 ( $ prefix , $ base_dir , $ prepend = false ) { $ prefix = trim ( $ prefix , '\\' ) . '\\' ; $ base_dir = rtrim ( $ base_dir , DIRECTORY_SEPARATOR ) . '/' ; if ( false === isset ( static :: $ psr4 [ $ prefix ] ) ) { static :: $ psr4 [ $ prefix ] = [ ] ; } if ( true === $ prepend ) { array...
Adds a base directory for a namespace prefix using the PSR - 4 standard .
229,685
public static function add ( $ prefix , $ base_dir , $ prepend = false ) { $ prefix = trim ( $ prefix , '\\' ) . '\\' ; $ base_dir = rtrim ( $ base_dir , DIRECTORY_SEPARATOR ) . '/' ; if ( false === isset ( static :: $ psr0 [ $ prefix ] ) ) { static :: $ psr0 [ $ prefix ] = [ ] ; } if ( true === $ prepend ) { array_uns...
Adds a base directory for a namespace prefix using the PSR - 0 standard .
229,686
public function getFirstBy ( $ key , $ value , array $ with = array ( ) ) { return $ this -> make ( $ with ) -> where ( $ key , '=' , $ value ) -> first ( ) ; }
Find an item by a key value
229,687
public function getManyBy ( $ key , $ value , array $ with = array ( ) ) { return $ this -> make ( $ with ) -> where ( $ key , '=' , $ value ) -> get ( ) ; }
Return many items by a key value
229,688
public function has ( $ relation , array $ with = array ( ) ) { $ query = $ this -> make ( $ with ) ; return $ query -> has ( $ relation ) -> get ( ) ; }
Return items that have a defined relation
229,689
public function get ( int $ timeout = 30 , $ version = HttpVersion :: HTTP_1_1 ) : HttpResponse { $ socket = $ this -> httpUri -> openSocket ( $ timeout ) ; $ this -> processHeader ( $ socket , Http :: GET , $ version ) ; return HttpResponse :: create ( $ socket ) ; }
initializes a get request
229,690
public function head ( int $ timeout = 30 , $ version = HttpVersion :: HTTP_1_1 ) : HttpResponse { $ socket = $ this -> httpUri -> openSocket ( $ timeout ) ; $ this -> headers -> put ( 'Connection' , 'close' ) ; $ this -> processHeader ( $ socket , Http :: HEAD , $ version ) ; return HttpResponse :: create ( $ socket )...
initializes a head request
229,691
public function post ( $ body , int $ timeout = 30 , $ version = HttpVersion :: HTTP_1_1 ) : HttpResponse { if ( is_array ( $ body ) ) { $ body = $ this -> transformPostValues ( $ body ) ; $ this -> headers -> put ( 'Content-Type' , 'application/x-www-form-urlencoded' ) ; } $ this -> headers -> put ( 'Content-Length' ,...
initializes a post request
229,692
private function transformPostValues ( array $ postValues ) : string { $ body = '' ; foreach ( $ postValues as $ key => $ value ) { $ body .= urlencode ( $ key ) . '=' . urlencode ( $ value ) . '&' ; } return $ body ; }
transforms post values to post body
229,693
private function processHeader ( Stream $ socket , string $ method , $ version ) { $ version = HttpVersion :: castFrom ( $ version ) ; if ( ! $ version -> equals ( HttpVersion :: HTTP_1_0 ) && ! $ version -> equals ( HttpVersion :: HTTP_1_1 ) ) { throw new \ InvalidArgumentException ( 'Invalid HTTP version ' . $ versio...
helper method to send the headers
229,694
private function methodAllowsQueryString ( string $ method ) : bool { return ( Http :: GET === $ method || Http :: HEAD === $ method ) ; }
checks if given method allows a query string
229,695
public function matchPath ( $ regexp ) { if ( substr ( $ regexp , 0 , 1 ) == '@' ) { $ this -> route_name = substr ( $ regexp , 1 ) ; } else { parent :: matchPath ( $ regexp ) ; } }
Adds a check for the route name .
229,696
private function initializeFromHardcodedObject ( $ object ) { if ( is_array ( $ object ) ) $ object = ( object ) $ object ; if ( ! empty ( $ object -> path ) ) { $ this -> path = $ object -> path ; } if ( ! empty ( $ object -> name ) ) { $ this -> name = $ object -> name ; } if ( ! empty ( $ object -> class ) ) { $ thi...
Allow programmatic initialization of a route
229,697
private function initializeFromSimpleXML ( $ xmlObject ) { $ this -> path = ! empty ( $ xmlObject -> path ) ? trim ( $ xmlObject -> path ) : '/' ; $ this -> name = ! empty ( $ xmlObject -> name ) ? trim ( $ xmlObject -> name ) : '' ; $ this -> class = ! empty ( $ xmlObject -> class ) ? trim ( $ xmlObject -> class ) : '...
Initialize from a simple XML object
229,698
private function validateRoute ( $ logReference ) { $ valid = true ; if ( empty ( $ this -> name ) ) { if ( $ logReference ) $ logReference -> error ( 'Route does not specify a name. Path(' . $ this -> path . ') Class(' . $ this -> class . ')' ) ; $ valid = false ; } if ( empty ( $ this -> path ) ) { if ( $ logReferenc...
Validates the route
229,699
public function getRoutingPath ( ) { $ tempPath = substr ( $ this -> path , 1 ) ; if ( strpos ( $ tempPath , '/' ) !== false ) { $ pathPieces = explode ( '/' , $ tempPath ) ; return $ pathPieces ; } else if ( $ tempPath ) { return array ( $ tempPath ) ; } else { return array ( ) ; } }
Returns an array of the routing path