idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
57,300 | private function injectRenderer ( array $ config , Mustache $ mustache , ContainerInterface $ container ) { if ( isset ( $ config [ 'renderer' ] ) ) { if ( is_string ( $ config [ 'renderer' ] ) && $ container -> has ( $ config [ 'renderer' ] ) ) { $ mustache -> setRenderer ( $ container -> get ( $ config [ 'renderer' ]... | Inject the renderer if needed and potentially the escaper . |
57,301 | private function injectUriHelper ( MustacheTemplate $ renderer , ContainerInterface $ container ) { if ( ! $ container -> has ( UrlHelper :: class ) ) { return ; } $ renderer -> addDefaultParam ( $ renderer :: TEMPLATE_ALL , 'uri' , new UriHelper ( $ container -> get ( UrlHelper :: class ) ) ) ; } | Inject the renderer instance with a UriHelper helper if possible . |
57,302 | public function setServiceList ( $ serviceList = [ ] ) { if ( ! $ serviceList ) return ; foreach ( $ serviceList as $ key => $ closure ) { $ this -> set ( $ key , $ closure ) ; } } | sets services to the closure factory |
57,303 | protected function workout ( FormInterface $ form ) { foreach ( self :: $ workers as $ worker ) { call_user_func_array ( [ $ worker , 'execute' ] , [ $ form , $ this -> parsedData ] ) ; } } | Updates the form with definitions from parsed data |
57,304 | protected function createForm ( ) { $ class = self :: DEFAULT_FORM_CLASS ; if ( array_key_exists ( 'class' , $ this -> parsedData ) ) { $ class = $ this -> checkClass ( $ this -> parsedData [ 'class' ] ) ; } return new $ class ; } | Creates the form class |
57,305 | static public function htmlClassTr ( $ html , $ css_tr ) { $ html = preg_replace_callback ( '@<(?<tag>[a-z]+)(?<other>\s+[^>]*)class="(?<class>[^"]+)"@s' , function ( $ attrs ) use ( $ css_tr ) { $ class = ' ' . strtr ( $ attrs [ 'class' ] , array ( "\n" => ' ' , "\r" => ' ' , "\t" => ' ' , ) ) . ' ' ; $ class = strtr ... | Translate css classes . |
57,306 | public function handle ( ) { if ( \ Skeleton \ Core \ Hook :: exists ( 'handle_error' , [ $ this -> exception ] ) ) { $ this -> last_handler = true ; \ Skeleton \ Core \ Hook :: call ( 'handle_error' , [ $ this -> exception ] ) ; } } | Handle the exception with a hook in the current application |
57,307 | public function can_run ( ) { if ( class_exists ( '\\Skeleton\\Core\\Application' ) === false ) { return false ; } try { \ Skeleton \ Core \ Application :: get ( ) ; return true ; } catch ( \ Exception $ e ) { } ; return false ; } | Can this handler run? |
57,308 | public function compose ( $ name = null , $ options = array ( ) ) { $ menu = app ( 'antares.widget' ) -> make ( 'menu.translations.pane' ) ; $ areas = config ( 'areas.areas' ) ; $ area = request ( ) -> segment ( 4 ) ; foreach ( $ areas as $ name => $ title ) { $ menu -> add ( $ name ) -> link ( handles ( 'antares::tran... | panel left for translations |
57,309 | public function setInsideTemplateDirectory ( $ inside ) { $ this -> insideTemplateDirectory = $ inside ; $ this -> getPathManager ( ) -> getGenerator ( ) -> setInsideTemplateDirectory ( $ inside ) ; } | Sets whether or not the engine is running inside a _template directory . |
57,310 | public function generateContent ( $ destination ) { $ pathsWrittenTo = [ ] ; $ packageStructure = $ this -> pathManager -> emitStructure ( $ destination ) ; $ this -> getRenderer ( ) -> addCollector ( $ this -> getPathManager ( ) -> getCollector ( ) ) ; $ this -> getRenderer ( ) -> addCollector ( app ( InputCollector :... | Generates files and contents in the provided destination directory . |
57,311 | private function isExcludedFromVerbatim ( $ file ) { foreach ( $ this -> copyVerbatimExcludePatterns as $ pattern ) { if ( Str :: is ( $ pattern , $ file ) ) { return true ; } } return false ; } | Determines if a file should be excluded copying . |
57,312 | private function shouldCopyFileInstead ( $ file ) { if ( $ this -> isExcludedFromVerbatim ( $ file ) ) { return false ; } foreach ( $ this -> copyVerbatimPatterns as $ pattern ) { if ( Str :: is ( $ pattern , $ file ) ) { return true ; } } return false ; } | Determines if a file should simply be copied . |
57,313 | protected static function requireValue ( $ data , $ key ) { if ( isset ( $ data [ $ key ] ) ) { return $ data [ $ key ] ; } else { throw new Exception \ InvalidDataException ( "Required value for '$key' is missing" ) ; } } | Requires a value from the given array or throws InvalidDataException |
57,314 | public function loadView ( ezcMvcRoutingInformation $ routeInfo , ezcMvcRequest $ request , ezcMvcResult $ result ) { if ( $ routeInfo -> controllerClass === 'ezpRestAtomController' ) { return new ezpRestAtomView ( $ request , $ result ) ; } return new ezpRestJsonView ( $ request , $ result ) ; } | Creates a view required by controller s result |
57,315 | protected function end ( ) : void { if ( ( $ this -> options & self :: OUTPUT_LINES ) === 0 ) { fwrite ( $ this -> stream , ( isset ( $ this -> delimiter ) ? "\n" : '' ) . ']' ) ; } } | End writing to the stream . |
57,316 | protected function jsonEncode ( $ element ) : string { $ json = json_encode ( $ element , $ this -> options ) ; if ( $ json === false ) { trigger_error ( "JSON encode failed; " . json_last_error_msg ( ) , E_USER_WARNING ) ; return json_encode ( null ) ; } if ( ( $ this -> options & \ JSON_PRETTY_PRINT ) > 0 && ( ~ $ th... | JSON encode an element with error checking |
57,317 | public function getChanContents ( int $ channel = 1 ) : string { if ( ! isset ( $ this -> pipes [ $ channel ] ) ) throw new \ InvalidArgumentException ( "No channel '$channel' defined." ) ; return $ this -> pipes [ $ channel ] ; } | Get the contents of a channel |
57,318 | private function loadConfig ( $ config ) { if ( isset ( $ config [ 'moduleConf' ] [ 'API_USERNAME' ] ) && isset ( $ config [ 'moduleConf' ] [ 'API_PASSWORD' ] ) && isset ( $ config [ 'moduleConf' ] [ 'API_SIGNATURE' ] ) && isset ( $ config [ 'moduleConf' ] [ 'API_ENDPOINT' ] ) && isset ( $ config [ 'moduleConf' ] [ 've... | Reads parsed config file and sets needed attributes |
57,319 | function deformatNVP ( $ nvpstr ) { $ intial = 0 ; $ nvpArray = array ( ) ; while ( strlen ( $ nvpstr ) ) { $ keypos = strpos ( $ nvpstr , '=' ) ; $ valuepos = strpos ( $ nvpstr , '&' ) ? strpos ( $ nvpstr , '&' ) : strlen ( $ nvpstr ) ; $ keyval = substr ( $ nvpstr , $ intial , $ keypos ) ; $ valval = substr ( $ nvpst... | This function will take NVPString and convert it to an Associative Array and it will decode the response . It is usefull to search for a particular key and displaying arrays . |
57,320 | protected function _make ( $ config ) { try { $ data = $ this -> _containerGet ( $ config , MapFactoryInterface :: K_DATA ) ; } catch ( ContainerExceptionInterface $ e ) { throw $ this -> _createRuntimeException ( $ this -> __ ( 'Could not retrieve data from factory config' ) , null , $ e ) ; } try { $ data = $ this ->... | Creates a map with the given data . |
57,321 | public static function alternator ( ) { $ args = func_get_args ( ) ; return function ( $ next = true ) use ( $ args ) { static $ i = 0 ; return $ args [ ( $ next ? $ i ++ : $ i ) % count ( $ args ) ] ; } ; } | Returns a closure that will alternate between the args which to return . If you call the closure with false as the arg it will return the value without alternating the next time . |
57,322 | public static function is_xml ( $ string ) { if ( ! defined ( 'LIBXML_COMPACT' ) ) { throw new \ Exception ( 'libxml is required to use Str::is_xml()' ) ; } $ internal_errors = libxml_use_internal_errors ( ) ; libxml_use_internal_errors ( true ) ; $ result = simplexml_load_string ( $ string ) !== false ; libxml_use_int... | Check if a string is a valid XML |
57,323 | public function clear ( ) { foreach ( array_keys ( $ this -> instances ) as $ key ) { $ this -> instances [ $ key ] = null ; unset ( $ this -> instances [ $ key ] ) ; } $ this -> instances = [ ] ; } | Unsets and removes all cached Hydrator instances |
57,324 | public function createSideMenu ( ) { $ this -> pool -> prepare ( ) ; $ menu = $ this -> factory -> createItem ( 'root' , [ 'childrenAttributes' => [ 'id' => 'sidebar-menu' ] ] ) ; $ menu -> addChild ( 'dashboard' , [ 'route' => 'ekyna_admin_dashboard' , 'labelAttributes' => [ 'icon' => 'dashboard' ] , ] ) -> setLabel (... | Builds backend sidebar menu . |
57,325 | private function appendChildren ( ItemInterface $ menu ) { foreach ( $ this -> pool -> getGroups ( ) as $ group ) { $ groupOptions = [ 'labelAttributes' => [ 'icon' => $ group -> getIcon ( ) ] , 'childrenAttributes' => [ 'class' => 'submenu' ] ] ; if ( $ group -> hasEntries ( ) ) { $ groupOptions [ 'labelAttributes' ] ... | Fills the menu with menu pool s groups and entries . |
57,326 | private function entrySecurityCheck ( MenuEntry $ entry ) { if ( null !== $ resource = $ entry -> getResource ( ) ) { return $ this -> aclOperator -> isAccessGranted ( $ resource , 'VIEW' ) ; } return true ; } | Returns whether the user has access granted for the given entry . |
57,327 | public function breadcrumbAppend ( $ name , $ label , $ route = null , array $ parameters = [ ] ) { $ this -> createBreadcrumb ( ) ; $ this -> breadcrumb -> addChild ( $ name , [ 'route' => $ route , 'routeParameters' => $ parameters ] ) -> setLabel ( $ label ) ; } | Appends a breadcrumb element . |
57,328 | public function setImmutable ( $ immutable = true ) { if ( $ immutable ) { $ this -> headers -> addCacheControlDirective ( 'immutable' ) ; } else { $ this -> headers -> removeCacheControlDirective ( 'immutable' ) ; } return $ this ; } | Marks the response as immutable . |
57,329 | public function run ( ) { if ( $ this -> binding instanceof \ Closure ) { return call_user_func_array ( $ this -> binding , $ this -> parameters ) ; } if ( is_object ( $ this -> binding ) ) { return $ this -> binding ; } if ( is_string ( $ this -> binding ) ) { return null ; } return $ this -> binding ; } | Run the builder create the binding s instance and return it |
57,330 | protected function mx_query ( $ domain ) { $ hosts = array ( ) ; $ weight = array ( ) ; if ( function_exists ( 'getmxrr' ) ) { getmxrr ( $ domain , $ hosts , $ weight ) ; } else { $ this -> getmxrr ( $ domain , $ hosts , $ weight ) ; } return array ( $ hosts , $ weight ) ; } | Queries the DNS server for MX entries of a certain domain . |
57,331 | protected function getmxrr ( $ hostname , & $ mxhosts , & $ mxweights ) { if ( ! Arrays :: is ( $ mxhosts ) ) { $ mxhosts = array ( ) ; } if ( ! Arrays :: is ( $ mxweights ) ) { $ mxweights = array ( ) ; } if ( empty ( $ hostname ) ) { return ; } $ cmd = 'nslookup -type=MX ' . escapeshellarg ( $ hostname ) ; if ( ! emp... | Provides a windows replacement for the getmxrr function . Params and behaviour is that of the regular getmxrr function . |
57,332 | public function add ( $ key , $ value ) { if ( empty ( $ key ) ) return false ; if ( empty ( $ this -> engineVarList -> $ key ) ) { $ this -> engineVarList -> $ key = $ value ; return $ this ; } if ( is_array ( $ this -> engineVarList -> $ key ) ) { array_merge ( $ this -> engineVarList -> $ key , $ value ) ; } return ... | just adds a variable to the others |
57,333 | public function initialize ( $ dataSource ) { $ this -> position = 0 ; $ this -> count = null ; if ( is_array ( $ dataSource ) ) { reset ( $ dataSource ) ; $ this -> dataSource = new ArrayIterator ( $ dataSource ) ; } elseif ( $ dataSource instanceof IteratorAggregate ) { $ this -> dataSource = $ dataSource -> getItera... | Set the data source for the result set |
57,334 | protected function itemToArray ( $ item ) { if ( is_array ( $ item ) ) { return $ item ; } elseif ( method_exists ( $ item , 'toArray' ) ) { return $ item -> toArray ( ) ; } elseif ( method_exists ( $ item , 'getArrayCopy' ) ) { return $ item -> getArrayCopy ( ) ; } throw new Exception \ RuntimeException ( sprintf ( 'I... | Cast an item to array |
57,335 | public function getConfigs ( $ className ) { if ( \ is_object ( $ className ) ) { $ className = ClassUtils :: getClass ( $ className ) ; } if ( ! array_key_exists ( $ className , $ this -> configs ) ) { $ this -> configs [ $ className ] = [ [ ] , [ ] ] ; $ meta = $ this -> om -> getClassMetadata ( $ className ) ; $ thi... | Get the object configs . |
57,336 | public function injectFieldOptions ( InputDefinition $ definition , $ className ) { list ( $ fields , $ associations ) = $ this -> getConfigs ( $ className ) ; ObjectFieldUtil :: addOptions ( $ definition , $ fields , 'The <comment>"%s"</comment> field' ) ; ObjectFieldUtil :: addOptions ( $ definition , $ associations ... | Inject the fields options in command definition . |
57,337 | public function injectNewValues ( InputInterface $ input , $ instance , $ targetId = 'id' ) { list ( $ fields , $ associations ) = $ this -> getConfigs ( $ instance ) ; $ fieldNames = array_keys ( array_merge ( $ fields , $ associations ) ) ; foreach ( $ fieldNames as $ fieldName ) { $ value = ObjectFieldUtil :: getFie... | Inject the field values in the object instance . |
57,338 | private function setAssociationValue ( $ instance , $ fieldName , $ value , $ target , $ id ) { $ targetRepo = $ this -> om -> getRepository ( $ target ) ; $ target = $ targetRepo -> findBy ( [ $ id => $ value ] ) ; if ( null === $ target ) { throw new \ InvalidArgumentException ( sprintf ( 'The specified mapped field ... | Set the association field value . |
57,339 | private function addConfigFields ( ClassMetadata $ metadata , $ className ) { foreach ( $ metadata -> getFieldNames ( ) as $ field ) { if ( ! $ metadata -> isIdentifier ( $ field ) ) { $ this -> configs [ $ className ] [ 0 ] [ $ field ] = $ metadata -> getTypeOfField ( $ field ) ; } } } | Add the config of fields . |
57,340 | private function addConfigAssociations ( ClassMetadata $ metadata , $ className ) { foreach ( $ metadata -> getAssociationNames ( ) as $ association ) { if ( ! $ metadata -> isAssociationInverseSide ( $ association ) && $ metadata -> isSingleValuedAssociation ( $ association ) ) { $ this -> configs [ $ className ] [ 1 ... | Add the config of associations . |
57,341 | public function Run ( $ displayView = TRUE ) { if ( ! $ this -> urlProcessor ) { $ this -> urlProcessor = new Resource \ Controller \ URL \ Route ; } $ this -> urlProcessor -> Process ( ) ; $ controllerPaths = is_array ( $ this -> controllerPath ) ? $ this -> controllerPath : [ $ this -> controllerPath ] ; foreach ( $ ... | Determine the controller and run the action |
57,342 | public static function failedToDecodeResponse ( ResponseInterface $ response , $ error ) { $ response -> getBody ( ) -> rewind ( ) ; return new static ( sprintf ( "Failed to decode response '%s' with error '%s'" , $ response -> getBody ( ) -> getContents ( ) , $ error ) ) ; } | Thrown when an response could not be JSON decoded . |
57,343 | public static function invalidResponseBody ( ResponseInterface $ response , $ expectedPath ) { $ response -> getBody ( ) -> rewind ( ) ; return new static ( sprintf ( "Response body '%s' is missing the expected JSON path '%s'" , $ response -> getBody ( ) -> getContents ( ) , $ expectedPath ) ) ; } | Thrown when the response body is missing an expected JSON path . |
57,344 | public function getIndexEntries ( ContentItem $ entry ) { return $ this -> getEntityManager ( ) -> createQuery ( 'SELECT e FROM Skimpy\CMS\ContentItem e WHERE e.uri LIKE :uri AND e.isIndex = 0' ) -> setParameter ( 'uri' , $ entry -> getUri ( ) . '%' ) -> getResult ( ) ; } | Returns all entries in a subdirectory of Entry |
57,345 | public function assertIsStringAndNonEmpty ( $ value , $ message = '%s must be a string and not empty' , $ exception = 'Asserts' ) { if ( is_string ( $ value ) === false || strlen ( $ value ) < 1 ) { $ this -> throwException ( $ exception , $ message , $ value ) ; } } | Verifies that the specified condition is string and non empty . The assertion fails if the condition is not string or empty string . |
57,346 | public static function initializeConfigs ( string $ configPath = '.env' , bool $ absolutePath = true , string $ separator = '=' ) : void { self :: $ path = ( $ absolutePath ? $ _SERVER [ 'DOCUMENT_ROOT' ] : '' ) . $ configPath ; self :: $ separator = $ separator ; if ( ! file_exists ( self :: $ path ) ) { return ; } $ ... | Parse File to Config Array |
57,347 | public static function read ( string $ key ) { if ( ! self :: $ initialized ) { self :: initialize ( ) ; } return self :: $ configs [ $ key ] ; } | Read Config Value with Key |
57,348 | private static function parseContent ( string $ line ) : array { $ separatePosition = strpos ( $ line , self :: $ separator ) ; $ configName = trim ( substr ( $ line , 0 , $ separatePosition ) ) ; $ configValue = trim ( rtrim ( substr ( $ line , $ separatePosition + strlen ( self :: $ separator ) ) , "\n" ) ) ; if ( is... | Parse a Line to Key and Value |
57,349 | private static function convertConfigsToFile ( ) : string { $ content = '' ; $ separator = self :: $ separator ; foreach ( self :: $ configs as $ configName => $ configValue ) { $ content .= $ configName . $ separator . $ configValue . "\n" ; } return $ content ; } | Convert current configs to one string |
57,350 | public function getRequestCurrent ( $ optional = false ) { $ requestStack = $ this -> getRequestStack ( $ optional ) ; if ( null === $ requestStack ) { return null ; } return $ this -> getRequestStack ( $ optional ) -> getCurrentRequest ( ) ; } | Get current Request |
57,351 | public function processUrl ( $ url ) { $ splittedUrl = explode ( '/' , $ url ) ; $ langCodes = $ this -> getCodes ( ) ; if ( isset ( $ langCodes [ $ splittedUrl [ 0 ] ] ) ) { if ( $ this -> _accepted_languages !== null && is_array ( $ this -> _accepted_languages ) ) { if ( in_array ( $ splittedUrl [ 0 ] , $ this -> _ac... | Processes the url to find a language |
57,352 | private function saveLanguage ( ) { if ( $ this -> _saveOnCookies ) { $ this -> getRequiredModules ( 'cookies' ) -> setCookie ( $ this -> _cookieName , $ this -> _selectedLanguage , 30 * 24 ) ; } if ( $ this -> _saveOnSession ) { $ _SESSION [ $ this -> _sessionKeyName ] = $ this -> _selectedLanguage ; $ _SESSION [ 'def... | Saves the choosen language preference |
57,353 | public function chooseLanguage ( ) { if ( $ this -> _saveOnCookies && $ tmpLng = $ this -> getRequiredModules ( 'cookies' ) -> getCookie ( $ this -> _cookieName ) ) { $ this -> _selectedLanguage = $ tmpLng ; } elseif ( isset ( $ this -> _app ) ) { try { $ this -> _selectedLanguage = $ this -> _app -> getConfig ( ) -> g... | Chooses a default language . First check for cookies then user configuration then module configuration |
57,354 | public function validate ( $ xmlString , $ schemaFile = null ) { $ doc = $ this -> _loadXmlDoc ( $ xmlString ) ; $ originalUseErrors = $ this -> _setupValidationErrorHandling ( ) ; $ isValid = $ doc -> schemaValidate ( $ schemaFile ) ; $ errors = $ this -> _retrieveErrors ( ) ; $ this -> _teardownValidationErrorHandlin... | Validate the serialized string as XML against a provided XSD schema . |
57,355 | protected function _formatErrors ( array $ libxmlErrors = array ( ) ) { return 'XSD validation failed with following messages:' . PHP_EOL . implode ( '' , array_map ( function ( \ libXMLError $ xmlError ) { return sprintf ( '[%s:%d] %s' , $ xmlError -> file , $ xmlError -> line , $ xmlError -> message ) ; } , $ libxmlE... | Format the array of validation errors . |
57,356 | public function useTwigTemplate ( $ template , array $ data = array ( ) ) { $ html = $ this -> renderer -> render ( $ template , $ data ) ; $ this -> setHtml ( $ html ) ; return $ this ; } | Renders and set as html the template with the given context |
57,357 | public function generate ( ) { if ( ! $ this -> mpdf ) { $ this -> init ( ) ; } $ output = $ this -> mpdf -> Output ( '' , 'S' ) ; $ time = microtime ( true ) - $ this -> start_time ; $ this -> logger -> debug ( "sasedev_mpdf: pdf generation took " . $ time . " seconds" ) ; return $ output ; } | Generate pdf document and return it as string |
57,358 | protected static function _renderImage ( $ src , $ className , array $ attributes = array ( ) ) { if ( is_array ( $ attributes [ 'class' ] ) ) { $ attributes [ 'class' ] [ ] = $ className ; } else { $ attributes [ 'class' ] .= ' ' . $ className ; } return sprintf ( '<img src="%s"%s />' , Html :: escape ( $ src ) , Html... | Renders the image tag |
57,359 | public function getSubscribedEvents ( ) { $ secret = $ this -> getSecret ( ) ; if ( true === empty ( $ secret ) ) { return [ ] ; } return [ Events :: postLoad , Events :: onFlush , ] ; } | Get Subscribed Events |
57,360 | public function registerRoute ( ) { if ( ! is_null ( $ services = $ this -> services ) ) { foreach ( $ services as $ service ) { $ routes = $ this -> app -> make ( $ service ) -> registerRoute ( ) ; $ this -> requiredRoute ( $ routes ) ; } } } | Register service provider routes |
57,361 | public function get ( $ key , $ default = null , $ separator = '.' ) { $ key = array_filter ( explode ( $ separator , $ key ) ) ; $ tmp = $ this -> data ; foreach ( $ key as $ k ) { if ( ! isset ( $ tmp [ $ k ] ) ) { return $ default ; } $ tmp = $ tmp [ $ k ] ; } return $ tmp ; } | Get a key from the storage by using a string locator . |
57,362 | public function set ( $ key , $ value , $ separator = '.' ) { $ key = array_filter ( explode ( $ separator , $ key ) ) ; $ tmp = & $ this -> data ; foreach ( $ key as $ k ) { if ( ! isset ( $ tmp [ $ k ] ) ) { $ tmp [ $ k ] = [ ] ; } $ tmp = & $ tmp [ $ k ] ; } return $ tmp = is_array ( $ tmp ) && is_array ( $ value ) ... | Set an element in the storage to a specified value . |
57,363 | public function del ( $ key , $ separator = '.' ) { $ key = explode ( $ separator , $ key ) ; $ lst = array_pop ( $ key ) ; $ tmp = & $ this -> data ; foreach ( $ key as $ k ) { if ( ! isset ( $ tmp [ $ k ] ) ) { return null ; } $ tmp = & $ tmp [ $ k ] ; } if ( ! isset ( $ tmp [ $ lst ] ) ) { return null ; } $ val = $ ... | Delete an element from the storage . |
57,364 | public static function hashEquals ( $ safe , $ user ) { if ( function_exists ( 'hash_equals' ) ) { return hash_equals ( $ safe , $ user ) ; } return self :: timingSafeEquals ( $ safe , $ user ) ; } | Wrapper to compare two hashes in a timing safe way . |
57,365 | public function resizeTo ( int $ width , int $ height , bool $ maintain_aspect = true , array $ canvas_color = array ( 'r' => 255 , 'g' => 255 , 'b' => 255 ) ) : ImageResize { if ( $ this -> resizer !== null ) { try { $ this -> resizer -> setOptions ( $ width , $ height , $ this -> quality , $ maintain_aspect , $ canva... | Set the resize to options |
57,366 | public function source ( string $ file , string $ path = '' ) : ImageResize { if ( $ this -> resizer !== null ) { try { $ this -> resizer -> loadImage ( $ file , $ path ) ; $ this -> loaded = true ; } catch ( \ Exception $ e ) { echo $ e -> getMessage ( ) ; } } return $ this ; } | Set the source image |
57,367 | public function target ( string $ file , string $ path = '' ) : array { if ( $ this -> resizer !== null && $ this -> loaded === true ) { try { $ this -> resizer -> resizeSource ( ) -> createCopy ( ) -> setFileName ( $ file ) -> setPath ( $ path ) -> save ( ) ; return $ this -> resizer -> getInfo ( ) ; } catch ( \ Excep... | Set the file name and path for the target this will be your newly resized image |
57,368 | public function calculateViewValue ( $ id , $ view , & $ properties_cache = null , & $ view_cache = null , & $ persistent_view_cache = null ) { switch ( $ view ) { case 'user_login' : if ( $ this -> getState ( $ id ) ) { $ user = $ this -> getView ( $ id , 'user' , $ properties_cache , $ view_cache , $ persistent_view_... | Resolve specific views |
57,369 | public static function createBlueDark ( ) { $ config = new DataSetConfig ( ) ; $ config -> setLineTension ( 0 ) -> setBorderWidth ( 2 ) -> setPointRadius ( 1 ) -> setPointHitRadius ( 5 ) -> setPointBorderColor ( 'rgb(94, 115, 139)' ) -> setBorderColor ( 'rgb(94, 115, 139)' ) -> setBackgroundColor ( 'rgba(94, 115, 139, ... | Get Config Blue Dark |
57,370 | static function register ( iWrapperStream $ wrapper , $ label = null ) { if ( $ label == null ) $ label = $ wrapper -> getLabel ( ) ; if ( $ pos = strpos ( $ label , ':' ) !== false ) throw new \ Exception ( sprintf ( '(%s) Is Invalid Label Provided For Stream Wrapper.' . ' It must include just a name like "http".' , $... | Register Stream Wrapper |
57,371 | static function isRegistered ( $ wrapper ) { if ( $ wrapper instanceof iWrapperStream ) $ wrapper = $ wrapper -> getLabel ( ) ; return in_array ( $ wrapper , self :: listWrappers ( ) ) ; } | Has Registered Wrapper With Name? |
57,372 | public static function build ( $ data = [ ] ) { $ text = '<?xml version="1.0" encoding="UTF-8" ?>' . PHP_EOL ; foreach ( $ data as $ tg => $ ct ) { if ( is_array ( $ ct ) && isset ( $ ct [ 'content' ] ) && isset ( $ ct [ 'attribute' ] ) ) $ text .= self :: generateTag ( $ tg , $ ct [ 'content' ] , $ ct [ 'attribute' ] ... | Building the XML Only |
57,373 | public static function buildRSS ( $ data = [ ] ) { $ text = '<?xml version="1.0" encoding="UTF-8" ?>' . PHP_EOL ; $ text .= '<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"... | Building the rss tag |
57,374 | protected static function generateTag ( $ tag , $ content , $ attributes = [ ] ) { $ text = '' ; $ attribute = self :: attribute ( $ attributes ) ; if ( is_string ( $ tag ) ) $ text .= "<{$tag}{$attribute}>" . PHP_EOL ; if ( is_array ( $ content ) ) { if ( isset ( $ content [ 'type' ] ) and $ content [ 'type' ] = 'cdat... | XML Tag Generator |
57,375 | protected static function attribute ( $ attributes = [ ] ) { $ text = '' ; foreach ( $ attributes as $ option => $ value ) { $ text = ' ' . $ option . '="' . $ value . '"' ; } return $ text ; } | Generate Attribute tag |
57,376 | public function load ( array $ routesConfig ) { foreach ( $ routesConfig as $ route ) { $ pattern = $ route [ 0 ] ; $ handler = $ route [ 1 ] ?? null ; $ methods = $ route [ 2 ] ?? '*' ; $ this -> map ( $ pattern , $ handler , $ methods ) ; } return $ this -> routes ; } | Load routes config . |
57,377 | public function listAction ( Request $ request ) { return $ this -> render ( 'SynapsePageBundle:Admin/Page:list.html.twig' , array ( 'pages' => $ this -> container -> get ( 'synapse.page.loader' ) -> retrieveAll ( ) , 'page_rendering_route' => $ this -> container -> getParameter ( 'synapse.page.rendering_route' ) , ) )... | Page list action . |
57,378 | public static function createProtocolMessage ( Message $ msg ) { $ version = $ msg -> shift ( ) ; if ( ! self :: hasProtocolVersion ( ( $ version ) ) ) { throw new UnknownProtocolVersionException ( ) ; } $ type = $ msg -> shift ( ) ; $ class = self :: getClassByType ( $ type ) ; return $ class :: fromMessage ( $ msg ) ... | Create a Message with the given Type . |
57,379 | private static function getClassByType ( $ type ) { if ( ! isset ( self :: $ types [ $ type ] ) ) { throw new UnknownMessageException ( 'Unable to parse message because type (' . $ type . ')' . ' is not mapped.' ) ; } return self :: $ types [ $ type ] ; } | Returns the Message class for the given Message type number . |
57,380 | public static function getTypeIdByClass ( $ className ) { if ( null === self :: $ typesByClass ) { self :: $ typesByClass = array_flip ( self :: $ types ) ; } if ( ! isset ( self :: $ typesByClass [ $ className ] ) ) { throw new UnknownMessageException ( 'Class not registered: ' . $ className . '.' ) ; } return self ::... | Get the Type ID for the given class . |
57,381 | public function actionStop ( $ trys = 3 ) { $ pid = $ this -> getMasterPid ( ) ; Console :: stdout ( "stopping $pid ..." ) ; while ( $ trys > 0 ) { if ( ! posix_kill ( $ pid , SIGTERM ) ) { Console :: stdout ( " success.\r\n" ) ; exit ( 0 ) ; } $ trys -- ; usleep ( 300000 ) ; } if ( $ trys <= 0 ) { Console :: error ( "... | stop the server . |
57,382 | public function actionReload ( ) { $ pid = $ this -> getMasterPid ( ) ; if ( ! extension_loaded ( 'posix' ) ) { Console :: error ( "posix extension is not loaded" ) ; exit ( 6 ) ; } Console :: stdout ( "reloading beyod($pid) ..." ) ; Yii :: debug ( "send SIGUSR1 to $pid " , 'beyod' ) ; $ res = posix_kill ( $ pid , SIGU... | reload the server s worker process graced . |
57,383 | public function actionStatus ( ) { $ pid = $ this -> getMasterPid ( ) ; Console :: stdout ( "beyod($pid) is running ...\r\n" ) ; Console :: stdout ( "php ini: " . php_ini_loaded_file ( ) . "\r\n" ) ; Console :: stdout ( "php version: " . phpversion ( ) . "\r\n" ) ; Console :: stdout ( "necessary extensions status:\r\n"... | output the server s status |
57,384 | private function prepareRoleCollection ( array $ roleConfiguration ) { $ preparedRoles = [ ] ; foreach ( $ roleConfiguration as $ roleKey => $ configuration ) { $ preparedRoles [ $ roleKey ] = Role :: createFromConfiguration ( $ roleKey , $ configuration ) ; } foreach ( $ roleConfiguration as $ roleKey => $ configurati... | Prepares the role collection by transforming the config array to an object structure |
57,385 | public function getAllIncludedRoles ( array $ roles ) { $ allIncludedRoles = [ ] ; foreach ( $ this -> normalizeRoleList ( $ roles ) as $ role ) { $ includedRoleCollection = [ ] ; $ this -> findIncludedRoles ( $ role , $ includedRoleCollection ) ; $ allIncludedRoles = array_replace ( $ allIncludedRoles , $ includedRole... | Finds all included roles of a set of base roles |
57,386 | private function normalizeRoleList ( array $ roles ) { $ normalized = [ ] ; foreach ( $ roles as $ role ) { $ roleKey = ( is_object ( $ role ) && ( $ role instanceof BaseRole ) ) ? $ role -> getRole ( ) : ( string ) $ role ; if ( isset ( $ this -> roleCollection [ $ roleKey ] ) ) { $ normalized [ ] = $ this -> roleColl... | Normalizes the role list |
57,387 | public function getAllAvailableRoles ( ) { return array_filter ( $ this -> roleCollection , function ( BaseRole $ role ) { if ( $ role instanceof Role ) { return ! $ role -> isHidden ( ) ; } return false ; } ) ; } | Returns a list of all roles |
57,388 | public function getRoleByKey ( $ roleKey ) { return array_key_exists ( $ roleKey , $ this -> roleCollection ) ? $ this -> roleCollection [ $ roleKey ] : null ; } | Returns a Role by key |
57,389 | public function parse ( ) { $ annotations = [ ] ; preg_match_all ( self :: ANNOTATION_PATTERN , $ this -> rawDocComment , $ found ) ; foreach ( $ found [ 1 ] as $ key => $ value ) { $ arg = null ; if ( ! empty ( $ found [ 2 ] [ $ key ] ) ) { $ arg = substr ( trim ( $ found [ 2 ] [ $ key ] ) , 1 , - 1 ) ; } $ annotation... | Obtains the list of annotations in a doc comment |
57,390 | public static function reset ( ) { self :: $ loader = null ; self :: $ builder = null ; self :: $ fixtures = null ; self :: $ triggers = null ; self :: $ hasOneRelationshipClass = '\Phactory\HasOneRelationship' ; self :: $ dependencyClass = '\Phactory\Dependency' ; } | Reset all Phactory settings to default |
57,391 | public static function hasOne ( $ name , $ arguments = array ( ) ) { $ arguments = func_get_args ( ) ; array_shift ( $ arguments ) ; list ( $ type , $ override ) = self :: resolveArgs ( $ arguments ) ; return new self :: $ hasOneRelationshipClass ( $ name , $ type , $ override ) ; } | Define an attribute that requires another factory generated object |
57,392 | public static function createBlueprint ( $ name , $ type , $ override = array ( ) , $ persisted = true ) { if ( self :: fixtures ( ) -> hasFixture ( $ name , $ type ) ) { return self :: fixtures ( ) -> getFixture ( $ name , $ type ) ; } $ blueprint = self :: getBlueprint ( $ name , $ type , $ override , $ persisted ) ;... | Loads prepare persist and return a factory generated object |
57,393 | public static function getBlueprint ( $ name , $ type , $ override = array ( ) , $ persisted = true ) { $ factory = self :: loader ( ) -> load ( $ name ) ; return $ factory -> create ( $ type , $ override , $ persisted ) ; } | Returns an object blueprint |
57,394 | public static function loader ( $ loader = null ) { if ( is_object ( $ loader ) ) { self :: $ loader = $ loader ; } return isset ( self :: $ loader ) ? self :: $ loader : self :: $ loader = new Loader ; } | Get factory loader . If it is not defined it will be set . |
57,395 | public static function builder ( $ builder = null ) { if ( is_object ( $ builder ) ) { self :: $ builder = $ builder ; } return isset ( self :: $ builder ) ? self :: $ builder : self :: $ builder = new Builder ; } | Get object builder . If it is not defined it will be set . |
57,396 | public static function triggers ( $ triggers = null ) { if ( is_object ( $ triggers ) ) { self :: $ triggers = new Triggers ( $ triggers ) ; } return isset ( self :: $ triggers ) ? self :: $ triggers : self :: $ triggers = new Triggers ; } | Get triggers events caller . If it is not defined it will be set . |
57,397 | public static function toFile ( Stringset $ set , $ file ) { if ( ! file_exists ( $ file ) || is_writable ( $ file ) ) { file_put_contents ( $ file , self :: toString ( $ set ) ) ; } else { throw new Exception ( "Could not write output to file." ) ; } } | Write the given Stringset to a mo file . |
57,398 | private static function makeHashTable ( Stringset $ set , $ size ) { $ table = array ( ) ; for ( $ i = 0 ; $ i < $ size ; $ i += 1 ) { $ table [ $ i ] = 0 ; } for ( $ i = 0 ; $ i < $ set -> size ( ) ; $ i += 1 ) { $ item = $ set -> item ( $ i ) ; $ hash = self :: hash ( $ item [ 'id' ] ) ; $ index = $ hash % $ size ; $... | Generate the hashtable . Uses an array which is ... a hashtable . Clearly this is a case of hashtableception . |
57,399 | private static function hash ( $ str ) { $ hash = 0 ; $ str = str_split ( $ str , 1 ) ; foreach ( $ str as $ char ) { $ hash = ( $ hash << 4 ) + ord ( $ char ) ; $ g = $ hash & ( 0xf << ( self :: INT_SIZE - 4 ) ) ; if ( $ g !== 0 ) { $ hash = $ hash ^ ( $ g >> self :: INT_SIZE - 8 ) ; $ hash = $ hash ^ $ g ; } } return... | Generates a hash from a given string . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.