idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
1,900 | protected function rerun ( ) { $ rerunNextStep = empty ( $ this -> data [ 'rerunStep' ] ) ? 1 : intval ( $ this -> data [ 'rerunStep' ] ) + 1 ; if ( $ rerunNextStep <= $ this -> maxStepOfRerun ) { JobFabric :: getInstance ( ) -> createJob ( ( new TypedBuilder ( ) ) -> setType ( $ this -> type ) -> setData ( $ this -> d... | Rerun current job |
1,901 | public function queue ( $ item_id = null , $ action = null ) { if ( is_null ( $ item_id ) ) { throw new NoItemException ( "No item id was sent" ) ; } else if ( ! is_numeric ( $ item_id ) ) { throw new InvalidItemTypeException ( "The item id: $item_id is not valid it should be a number" ) ; } $ this -> actions [ ] = arr... | All single actions are routed through this method to wrap the request in the required format for the pocket API . |
1,902 | public function tags_queue ( $ tag_info = array ( ) , $ action = null ) { if ( ! isset ( $ tag_info [ 'item_id' ] ) ) { throw new NoItemException ( "No item id was sent" ) ; } else if ( ! is_numeric ( $ tag_info [ 'item_id' ] ) ) { throw new InvalidItemTypeException ( "The item id: {$tag_info['item_id']} is not valid i... | All double tag actions are routed through this method to wrap the request in the required format for the pocket API . |
1,903 | public function add ( $ link_info = array ( ) ) { if ( ! isset ( $ link_info [ 'url' ] ) ) { throw new NoItemException ( "The url is required when adding a link" ) ; } $ base_info = array ( 'action' => 'add' , 'time' => time ( ) ) ; $ link_info = array_merge ( $ base_info , $ link_info ) ; $ this -> actions [ ] = $ lin... | Add a particular bookmark |
1,904 | public function showAction ( Font $ font ) { $ deleteForm = $ this -> createDeleteForm ( $ font ) ; return array ( 'entity' => $ font , 'delete_form' => $ deleteForm -> createView ( ) , ) ; } | Finds and displays a Font entity . |
1,905 | private function createDeleteForm ( Font $ font ) { return $ this -> createFormBuilder ( ) -> setAction ( $ this -> generateUrl ( 'coreextra_font_delete' , array ( 'id' => $ font -> getId ( ) ) ) ) -> setMethod ( 'DELETE' ) -> getForm ( ) ; } | Creates a form to delete a Font entity . |
1,906 | public function sendEmail ( ) { if ( ( $ this -> owner -> type != Item :: TYPE_EMAIL ) || ( ! $ config = $ this -> owner -> getEmailConfig ( ) ) ) { return true ; } $ this -> setFromConfig ( $ config ) ; return \ Yii :: $ app -> mail -> compose ( ) -> setFrom ( \ Yii :: $ app -> params [ 'adminEmail' ] ) -> setTo ( $ t... | prepares and sends email content |
1,907 | public function setFromConfig ( EmailConfig $ config ) { foreach ( [ 'title' , 'content' , 'address' ] as $ attribute ) { $ this -> owner -> $ attribute = $ this -> prepareString ( $ config -> $ attribute ) ; } } | gets data from email config EmailConfig |
1,908 | private function prepareString ( $ string ) { return str_replace ( array_keys ( $ this -> owner -> variables ) , array_values ( $ this -> owner -> variables ) , $ string ) ; } | prepares email content before sending |
1,909 | public function getJob ( $ queues , $ timeoutMs = 200 ) { $ jobs = $ this -> getJobs ( $ queues , 1 , $ timeoutMs ) ; if ( empty ( $ jobs ) ) { return null ; } return $ jobs [ 0 ] ; } | Retrieve a single job from the given queues |
1,910 | public function ack ( Job $ job ) { assert ( $ job -> getId ( ) != null ) ; return ( int ) $ this -> send ( [ 'ACKJOB' , $ job -> getId ( ) ] ) ; } | Acknowledge a job execution . |
1,911 | public function show ( $ jobId ) { $ result = $ this -> send ( [ 'SHOW' , ( string ) $ jobId ] ) ; if ( ! $ result ) { return null ; } return Job :: create ( RespUtils :: toAssoc ( $ result ) ) ; } | Return the job with the given jobId . |
1,912 | public static function create ( int $ statusCode , ResourceInterface $ resource = null ) : PresentationInterface { return new Presentation ( $ statusCode , $ resource ) ; } | Create the presentation |
1,913 | function initResponse ( ) { if ( $ this -> action [ 0 ] == '_' ) { $ this -> response = new Response \ JSONResponse ( ) ; } else { $ this -> response = new Response \ XTPLResponse ( $ this ) ; $ this -> response -> setVariable ( 'MODULE' , $ this ) ; $ this -> response -> post = $ this -> post ; $ this -> response -> g... | initialize default responses . |
1,914 | public static function encrypt ( string $ data , string $ password ) : string { $ iv = self :: generateIv ( ) ; $ key = self :: hash ( $ iv , $ password ) ; $ cyphertext = openssl_encrypt ( $ data , self :: CIPHER , $ key , OPENSSL_RAW_DATA , $ iv ) ; if ( $ cyphertext === false ) { throw new RuntimeException ( 'Encryp... | Encrypt the given data . |
1,915 | public static function decrypt ( string $ data , string $ password ) : string { $ iv = self :: substr ( $ data , 0 , self :: IVSIZE ) ; $ checksum = self :: substr ( $ data , self :: IVSIZE , self :: CKSIZE ) ; $ cyphertext = self :: substr ( $ data , self :: IVSIZE + self :: CKSIZE , null ) ; $ key = self :: hash ( $ ... | Decrypt the given data . |
1,916 | private static function hash ( string $ data , string $ key ) : string { return hash_hmac ( self :: ALGO , $ data , $ key , true ) ; } | Perform a single hmac iteration . This adds an extra layer of safety because hash_hmac can return false if algo is not valid . Return type hint will throw an exception if this happens . |
1,917 | public function & getStorage ( $ storage_name ) : LanguageStorage { $ return = false ; if ( isset ( $ storage_name , $ this -> storage -> { $ storage_name } ) ) { $ return = $ this -> storage -> { $ storage_name } ; } return $ return ; } | Returns a reference to a specfic the language storage |
1,918 | public function createTextAdapter ( $ storage_name ) : TextInterface { $ adapter = new Text ( ) ; $ adapter -> setLanguage ( $ this ) ; $ adapter -> setStorageName ( $ storage_name ) ; return $ adapter ; } | Creates and return as Text object |
1,919 | protected function registerLockdownConfiguration ( ) { $ this -> publishes ( [ __DIR__ . $ this -> modelsConfigPath => config_path ( 'lockdown.php' ) , ] , 'config' ) ; $ this -> mergeConfigFrom ( __DIR__ . $ this -> modelsConfigPath , 'lockdown' ) ; } | Register Lockdown configuration |
1,920 | protected function registerCommands ( ) { $ namespace = __NAMESPACE__ . '\\Commands\\' ; $ keyPrefix = 'lockdown.commands.' ; $ commands = [ $ keyPrefix . 'assign-perm-user' => 'AssignPermissionToUser' , $ keyPrefix . 'assign-role-perm' => 'AssignPermissionToRole' , $ keyPrefix . 'assign-role-user' => 'AssignRoleToUser... | Register Artisan commands |
1,921 | protected function registerUserProvider ( ) { $ this -> app [ 'lockdown.user' ] = $ this -> app -> share ( function ( $ app ) { $ userModel = config ( 'lockdown.user' ) ; return new UserProvider ( $ userModel ) ; } ) ; $ this -> app [ 'auth' ] -> provider ( 'lockdown' , function ( $ app ) { return $ app [ 'lockdown.use... | Register user provider |
1,922 | protected function registerRoleProvider ( ) { $ this -> app [ 'lockdown.role' ] = $ this -> app -> share ( function ( $ app ) { $ roleModel = config ( 'lockdown.role' ) ; return new RoleProvider ( $ roleModel ) ; } ) ; } | Register role provider |
1,923 | protected function registerPermissionProvider ( ) { $ this -> app [ 'lockdown.permission' ] = $ this -> app -> share ( function ( $ app ) { $ permissionModel = config ( 'lockdown.permission' ) ; return new PermissionProvider ( $ permissionModel ) ; } ) ; } | Register permission provider |
1,924 | protected function registerLockdownFacade ( ) { $ this -> app -> booting ( function ( ) { $ loader = AliasLoader :: getInstance ( ) ; $ loader -> alias ( 'Lockdown' , __NAMESPACE__ . '\LockdownFacade' ) ; } ) ; } | Register the Lockdown Facade |
1,925 | public function hasTerm ( $ taxonomy , $ term ) { return isset ( $ this -> terms [ $ taxonomy ] ) && isset ( $ this -> terms [ $ taxonomy ] [ $ term ] ) ; } | Whether the post contains the term or not . |
1,926 | public function getImageAttribute ( ) { if ( $ this -> thumbnail and $ this -> thumbnail -> attachment ) { return $ this -> thumbnail -> attachment -> guid ; } } | Gets the featured image if any Looks in meta the _thumbnail_id field . |
1,927 | public function getMainCategoryAttribute ( ) { $ mainCategory = 'Uncategorized' ; if ( ! empty ( $ this -> terms ) ) { $ taxonomies = array_values ( $ this -> terms ) ; if ( ! empty ( $ taxonomies [ 0 ] ) ) { $ terms = array_values ( $ taxonomies [ 0 ] ) ; $ mainCategory = $ terms [ 0 ] ; } } return $ mainCategory ; } | Gets the first term of the first taxonomy found . |
1,928 | public function getKeywordsAttribute ( ) { return collect ( $ this -> terms ) -> map ( function ( $ taxonomy ) { return collect ( $ taxonomy ) -> values ( ) ; } ) -> collapse ( ) -> toArray ( ) ; } | Gets the keywords as array . |
1,929 | public function cash ( $ cash = null ) { if ( $ cash !== null ) { $ this -> update ( [ 'cash' => $ cash ] ) ; } else { return $ this -> getFirstAttribute ( ) [ 'cash' ] ; } } | return or set the cash amount |
1,930 | public function trailStarted ( $ started = null ) { if ( $ started === null ) { return $ this -> trail_started ; } else { $ this -> trail_started = $ started ; return $ this ; } } | return or set trail started time |
1,931 | public function trailEndsAt ( $ endDate = null ) { if ( $ endDate === null ) { return $ this -> trail_ends_at ; } else { $ this -> trail_ends_at = $ endDate ; return $ this ; } } | return or set trail end time |
1,932 | public function isSubscription ( ) { $ started = $ this -> subscriptionStarted ( ) ; $ status = $ this -> status ( ) ; $ time = time ( ) ; if ( $ started !== '' && is_numeric ( $ started ) && $ status !== '' && $ status !== 'canceled' && $ time < $ this -> subscriptionEndsAt ( ) ) { return true ; } else { return false ... | determine our subscription is a valid subscription |
1,933 | public function plan ( $ plan = null ) { if ( $ plan === null ) { return $ this -> subscription_plan ; } else { $ this -> subscription_plan = $ plan ; return $ this ; } } | set or return subscription plan |
1,934 | public function pause ( ) { $ this -> status ( 'paused' ) ; $ started = $ this -> subscriptionStarted ( ) ; if ( ! isset ( $ this -> subscriptionPlans [ $ plan = $ this -> plan ( ) ] ) ) { $ this -> delete ( ) ; throw new BillingSubscriptionPlanException ( sprintf ( 'Your %s plan is not exists in our website' ) ) ; } $... | pause the subscription |
1,935 | public function subscriptionEndsAt ( $ ends = null ) { if ( $ ends === null ) { return $ this -> subscription_ends_at ; } else { $ this -> subscription_ends_at = $ ends ; return $ this ; } } | return or set subscription ends time |
1,936 | public static function typed ( string $ type , iterable $ input = [ ] ) : PriorityQueue { $ resolver = Resolver :: typed ( $ type ) ; return new static ( $ input , $ resolver ) ; } | PriorityQueue named constructor . |
1,937 | public function json ( $ data , $ status = HttpMessage :: HTTP_OK , $ encodingOptions = 0 ) { $ json = json_encode ( $ data , $ encodingOptions ) ; $ this -> withStatusCode ( $ status ) -> withHeader ( 'content-type' , 'application/json' ) -> getBody ( ) -> write ( $ json ) ; return $ this ; } | Json response . |
1,938 | public function html ( $ data , $ status = HttpMessage :: HTTP_OK ) { $ this -> withStatusCode ( $ status ) -> withHeader ( 'content-type' , 'text/html' ) -> getBody ( ) -> write ( ( string ) $ data ) ; return $ this ; } | Html Response . |
1,939 | public function template ( $ path , $ data = [ ] , $ status = HttpMessage :: HTTP_OK ) { $ tempFile = $ path . '.php' ; if ( ! is_file ( $ tempFile ) ) { throw new \ RuntimeException ( 'Could not find the template file <' . $ path . '>' ) ; } ob_start ( ) ; extract ( $ data ) ; include ( $ path . '.php' ) ; $ content =... | Render a html template . |
1,940 | public function isEvaluableForTypes ( string ... $ types ) : bool { if ( ! $ this -> isValid ( ) ) { return false ; } if ( is_empty ( $ types ) ) { return true ; } return Data :: make ( $ this -> value ) -> isTypeOf ( ... $ types ) ; } | Indica si este input se debe evaluar para alguno de los tipos dados |
1,941 | public function next ( $ value ) : self { $ this -> ensureIsNotLocked ( ) ; $ this -> value = $ value ; $ this -> locked = true ; return $ this ; } | Aplica un nuevo valor al input para que sea recogido por la siguiente regla |
1,942 | private function makeException ( string $ format , ... $ arguments ) : InvalidArgumentException { $ reason = sprintf ( $ format , ... $ arguments ) ; $ exception = InvalidArgumentException :: make ( $ this -> value , $ reason ) ; return $ exception ; } | Devuelve un objeto excepcion generico |
1,943 | public function resolve ( $ response = null ) : self { if ( $ this -> exception instanceof \ Throwable ) { throw $ this -> exception ; } if ( $ this -> mustBeResolved ( $ response ) ) { $ this -> value = $ response ; } $ this -> locked = false ; return $ this ; } | Resuelve este input aplicando la respuesta de un callback |
1,944 | public function doBuild ( ) { $ output = parent :: build ( ) ; if ( $ this -> form && $ this -> form -> status [ 'submitted' ] && ! $ this -> props [ 'isValid' ] ) { $ noticeName = $ this -> attribs [ 'name' ] . '_notice' ; $ this -> debug -> warn ( 'buildControl' , $ this -> form -> buildControl ) ; $ output .= $ this... | Build field control |
1,945 | public function fill ( $ object , array $ data ) { if ( ! $ object instanceof ConversionInterface ) { throw new InvalidArgumentException ( sprintf ( 'Invalid object "%s" provided; must be an instance of "%s".' , is_object ( $ object ) ? get_class ( $ object ) : gettype ( $ object ) , ConversionInterface :: CLASS ) ) ; ... | Fills the object with specified data . |
1,946 | public function extract ( $ object ) { if ( ! $ object instanceof ConversionInterface ) { throw new InvalidArgumentException ( sprintf ( 'Invalid object "%s" provided; must be an instance of "%s".' , is_object ( $ object ) ? get_class ( $ object ) : gettype ( $ object ) , ConversionInterface :: CLASS ) ) ; } return $ o... | Extracts data from object . |
1,947 | protected function getCacheKey ( RequestInterface $ request ) : string { if ( $ this -> key === null ) { $ this -> key = $ request -> getMethod ( ) . md5 ( ( string ) $ request -> getUri ( ) ) ; } return ( string ) $ this -> key ; } | Returns the id used to cache a request . |
1,948 | public function hydrate ( $ value ) { if ( $ this -> nullable && $ value === null ) { return null ; } if ( $ value instanceof MongoBinData ) { return $ value -> bin ; } throw new Exception \ InvalidArgumentException ( sprintf ( 'Invalid value: must be an instance of MongoBinData, "%s" given' , is_object ( $ value ) ? g... | Convert a MongoBinData to binary string |
1,949 | public function extract ( $ value ) { if ( $ this -> nullable && $ value === null ) { return null ; } return new MongoBinData ( $ value , $ this -> type ) ; } | Ensure the value extracted is typed as MongoBinData or null |
1,950 | protected function injectScript ( Response $ response ) { if ( function_exists ( 'mb_stripos' ) ) { $ posrFunction = 'mb_strripos' ; $ substrFunction = 'mb_substr' ; } else { $ posrFunction = 'strripos' ; $ substrFunction = 'substr' ; } $ content = $ response -> getContent ( ) ; $ pos = $ posrFunction ( $ content , '</... | Injects the livereload script . |
1,951 | private function prepareTmpDir ( ) { $ tempDir = $ this -> file -> get ( self :: SETTING_DESTINATION_DIR ) . DIRECTORY_SEPARATOR . uniqid ( 'install-' ) ; if ( ! @ mkdir ( $ tempDir , 0700 ) ) { throw new \ RuntimeException ( 'Could not create the temporary directory' ) ; } $ this -> tempDir = $ tempDir ; } | Prepare a temporary directory . |
1,952 | private function moveFiles ( ) { clearstatcache ( ) ; $ destinationDir = $ this -> file -> get ( self :: SETTING_DESTINATION_DIR ) ; $ ioHandler = $ this -> getIO ( ) ; $ logging = $ ioHandler -> isVeryVerbose ( ) ; $ this -> folders = [ ] ; foreach ( Finder :: create ( ) -> in ( $ this -> tempDir ) -> ignoreDotFiles (... | Move the installed files to their intended destination . |
1,953 | private function moveFile ( SplFileInfo $ file , $ targetDir , $ logging , $ ioHandler ) { $ pathName = $ file -> getPathname ( ) ; $ destinationFile = str_replace ( $ this -> tempDir , $ targetDir , $ pathName ) ; if ( $ file -> isLink ( ) ) { $ target = $ file -> getLinkTarget ( ) ; if ( $ logging ) { $ ioHandler -> ... | Move a single file or folder . |
1,954 | private function mayInstall ( ) { $ destinationDir = $ this -> file -> get ( self :: SETTING_DESTINATION_DIR ) . DIRECTORY_SEPARATOR ; return ! ( file_exists ( $ destinationDir . 'composer.json' ) ) ; } | Check if we may install into the destination directory . |
1,955 | private function databases ( ) { if ( Configuration :: read ( 'database.config.enable' ) === true ) { $ databaseConfigPath = $ this -> configDir . DS . Configuration :: read ( 'database.config.file' ) ; if ( file_exists ( $ databaseConfigPath ) ) { require $ databaseConfigPath ; return true ; } } return false ; } | Load user defined databases |
1,956 | private function routes ( ) { if ( Configuration :: read ( 'routing.config.enable' ) === true ) { $ routingConfigPath = $ this -> configDir . DS . Configuration :: read ( 'routing.config.file' ) ; if ( file_exists ( $ routingConfigPath ) ) { require $ routingConfigPath ; return true ; } else { throw new \ Exception ( '... | Load user defined routes |
1,957 | public function run ( ) { $ this -> routes ( ) ; Router :: resolve ( ) ; $ this -> databases ( ) ; $ this -> bootstrap ( ) ; $ bodyContent = $ this -> controller ( ) ; echo $ bodyContent ; } | Run Pabana Framework |
1,958 | public static function createObfuscatedString ( int $ hex_length = 16 , bool $ b_crypto_strong = false ) { if ( $ hex_length < 4 || $ hex_length > 64 ) { throw new \ Exception ( 'Utility::createObfuscatedString - Inappropriate hex length' ) ; } $ crypto_strong = false ; $ bytes = openssl_random_pseudo_bytes ( $ hex_len... | Return a securely obfuscated string |
1,959 | public function setCells ( array $ configuration = [ ] ) { if ( is_array ( $ configuration ) ) { foreach ( $ configuration as $ cellAlias => $ cell ) { $ this -> appendCell ( $ cell , $ cellAlias ) ; } } return $ this ; } | Setting cells collection . |
1,960 | public function prependCell ( $ cell , $ name = null ) { $ cell = $ this -> buildCell ( $ cell ) ; if ( $ name == null && $ cell -> getName ( ) != '' ) { $ name = $ cell -> getName ( ) ; } if ( $ name == null ) { array_unshift ( $ this -> cells , $ cell ) ; } else { $ this -> cells = [ $ name => $ cell ] + $ this -> ce... | Add cell as first cell of collection . |
1,961 | public function appendCell ( $ cell , $ name = null ) { $ cell = $ this -> buildCell ( $ cell ) ; if ( $ name == null && $ cell -> getName ( ) != '' ) { $ name = $ cell -> getName ( ) ; } if ( $ name == null ) { $ this -> cells [ ] = $ cell ; } else { $ this -> cells [ $ name ] = $ cell ; } end ( $ this -> cells ) ; $ ... | Add cell as last cell of collection . |
1,962 | private function buildCell ( $ cell ) { if ( is_array ( $ cell ) ) { $ cell = $ this -> getServiceLocator ( ) -> get ( 'DataGrid\Factory\Cell' ) -> get ( $ cell ) ; } elseif ( ! ( $ cell instanceof CellInterface ) ) { throw new \ RuntimeException ( 'You must provide Correct cell definition or Cell instance implementing... | Building cell from provided config . |
1,963 | public function removeCell ( $ name ) { if ( ! array_key_exists ( $ name , $ this -> cells ) ) { throw new Exception ( 'Cell "' . $ name . '" is not set, so could not be removed' ) ; } unset ( $ this -> cells [ $ name ] ) ; return $ this ; } | Removing cell by name or offset . |
1,964 | public function getCells ( ) { foreach ( $ this -> cells as $ cell ) { $ cell -> setId ( $ this -> getId ( ) ) ; } return $ this -> cells ; } | Gets cells collection |
1,965 | public function setData ( & $ data ) { foreach ( $ this -> cells as $ cell ) { $ cell -> setData ( $ data ) ; } return $ this ; } | Sets a row data to cells set that will be used to render values . |
1,966 | public function getColumnsToHideIfUnavailable ( ) { $ out = [ ] ; foreach ( $ this -> getCells ( ) as $ key => $ cell ) { if ( $ cell -> getHideCellIfUnavailable ( ) ) { $ out [ ] = $ key ; } } return $ out ; } | Gets a list of columns that should be removed from rendered grid if does not contains values for any rows . |
1,967 | public static function set ( $ key , $ value ) { putenv ( vsprintf ( '%s=%s' , [ $ key , $ value ] ) ) ; $ _ENV [ $ key ] = $ value ; $ _SERVER [ $ key ] = $ value ; } | Set an environment variable with the provided value . |
1,968 | public function create ( BannerZoneInterface $ bannerZone ) { return $ this -> formFactory -> create ( 'silvestra_banner_zone' , $ bannerZone , array ( 'action' => $ this -> router -> getContext ( ) -> getPathInfo ( ) ) ) ; } | Create banner zone form . |
1,969 | public static function association ( $ catid , $ extension = 'com_content' ) { $ html = '' ; if ( $ associations = CategoriesHelper :: getAssociations ( $ catid , $ extension ) ) { $ associations = ArrayHelper :: toInteger ( $ associations ) ; $ db = JFactory :: getDbo ( ) ; $ query = $ db -> getQuery ( true ) -> selec... | Render the list of associated items |
1,970 | private function addProxyClasses ( ) { $ definitions = array_filter ( $ this -> container -> getDefinitions ( ) , array ( $ this -> getProxyDumper ( ) , 'isProxyCandidate' ) ) ; $ code = '' ; $ strip = '' === $ this -> docStar && method_exists ( 'Squire\Component\HttpKernel\Kernel' , 'stripComments' ) ; foreach ( $ def... | Generates code for the proxies to be attached after the container class . |
1,971 | private function isSimpleInstance ( $ id , Definition $ definition ) { foreach ( array_merge ( array ( $ definition ) , $ this -> getInlinedDefinitions ( $ definition ) ) as $ sDefinition ) { if ( $ definition !== $ sDefinition && ! $ this -> hasReference ( $ id , $ sDefinition -> getMethodCalls ( ) ) ) { continue ; } ... | Checks if the definition is a simple instance . |
1,972 | private function addFrozenConstructor ( ) { $ targetDirs = $ this -> exportTargetDirs ( ) ; $ code = <<<EOF /*{$this->docStar} * Constructor. */ public function __construct() {{$targetDirs}EOF ; if ( $ this -> container -> getParameterBag ( ) -> all ( ) ) { $ code .= "\n \$this->parameters = \$... | Adds the constructor for a frozen container . |
1,973 | private function getInlinedDefinitions ( Definition $ definition ) { if ( false === $ this -> inlinedDefinitions -> contains ( $ definition ) ) { $ definitions = array_merge ( $ this -> getDefinitionsFromArguments ( $ definition -> getArguments ( ) ) , $ this -> getDefinitionsFromArguments ( $ definition -> getMethodCa... | Returns the inline definition . |
1,974 | private function getDefinitionsFromArguments ( array $ arguments ) { $ definitions = array ( ) ; foreach ( $ arguments as $ argument ) { if ( is_array ( $ argument ) ) { $ definitions = array_merge ( $ definitions , $ this -> getDefinitionsFromArguments ( $ argument ) ) ; } elseif ( $ argument instanceof Definition ) {... | Gets the definition from arguments . |
1,975 | public function getInstance ( ) { if ( $ this -> isSingleton ( ) && $ this -> hasInstance ( ) ) { return $ this -> instance ; } if ( $ this -> path ) { require_once $ this -> path ; } if ( $ this -> isClosure ( ) ) { $ closure = $ this -> class ; $ instance = $ closure ( $ this -> container ) ; } else { $ class = $ thi... | get instance . |
1,976 | private function array2ArgsWithInjectDependency ( $ parent , array $ array = array ( ) ) { $ args = array ( ) ; foreach ( $ array as $ _key => $ _val ) { if ( is_string ( $ _val ) && preg_match ( '/^\$([\w_]+)$/' , $ _val , $ matches ) ) { $ args [ ] = sprintf ( '$this->container->get("%s")' , $ matches [ 1 ] ) ; } els... | convert to arguments string . |
1,977 | private function callInitMethod ( $ instance ) { $ args = [ ] ; foreach ( $ this -> init_method_args as $ arg ) { if ( is_string ( $ arg ) && preg_match ( '/^\$([\w_]+)$/' , $ arg , $ matches ) ) { $ arg = $ this -> container -> get ( $ matches [ 1 ] ) ; } $ args [ ] = $ arg ; } call_user_func_array ( array ( $ instanc... | call init method |
1,978 | public function readHex ( int $ length ) { $ value = Reader :: high ( $ this -> bytes , 0 , $ length * 2 ) ; $ this -> skip ( $ length ) ; return $ value ; } | Read N characters of bytes in hex with high nibble . |
1,979 | public function Image ( ) { if ( $ this -> ActionImage ( ) ) { return $ this -> ActionImage ( ) ; } if ( $ this -> Type == 'SiteTree' ) { return $ this -> SiteTree ( ) -> ActionImage ( ) ; } } | Return image from current object if available or fall back the sitetree image . |
1,980 | public function getSummary ( ) { if ( $ this -> ActionSummary ) { return $ this -> obj ( 'ActionSummary' ) ; } if ( $ this -> Type == 'SiteTree' ) { return $ this -> SiteTree ( ) -> obj ( 'ActionSummary' ) ; } } | Return summary from current object if available or fall back the sitetree summary . |
1,981 | public function getLabel ( ) { if ( $ this -> ActionLabel ) { return $ this -> obj ( 'ActionLabel' ) ; } if ( $ this -> Type == 'SiteTree' ) { return $ this -> SiteTree ( ) -> obj ( 'ActionLabel' ) ; } } | Return label from current object if available or fall back the sitetree label . |
1,982 | public function toggle ( $ id , $ status ) { $ this -> App -> toggleField ( $ this -> Extensions , $ id , $ status ) ; } | Toggle action . |
1,983 | public function execute ( Framework $ framework , RequestAbstract $ request , Response $ response ) { $ this -> templatesManager -> addRenderer ( $ this -> htmlRenderer ) ; } | Register the html renderer on the templates manager to render the templates . |
1,984 | public function findAllWithCategories ( ) { $ qb = $ this -> getQueryBuilder ( ) -> select ( 'f, c' ) -> innerJoin ( 'f.categories' , 'c' ) -> innerJoin ( 'c.subcategories' , 's' ) ; $ qb -> orderBy ( 'f.order' , 'asc' ) -> addOrderBy ( 'c.id' , 'asc' ) ; return $ qb -> getQuery ( ) -> getResult ( ) ; } | Find all rows with their related categories |
1,985 | private function createCreateForm ( ProductOrderItem $ entity ) { $ form = $ this -> createForm ( new ProductOrderItemType ( ) , $ entity , array ( 'action' => $ this -> generateUrl ( 'admin_orderitem_create' ) , 'method' => 'POST' , ) ) ; $ form -> add ( 'submit' , 'submit' , array ( 'label' => 'Create' ) ) ; return $... | Creates a form to create a ProductOrderItem entity . |
1,986 | public function newAction ( ) { $ entity = new ProductOrderItem ( ) ; $ form = $ this -> createCreateForm ( $ entity ) ; return array ( 'entity' => $ entity , 'form' => $ form -> createView ( ) , ) ; } | Displays a form to create a new ProductOrderItem entity . |
1,987 | private function createEditForm ( ProductOrderItem $ entity ) { $ form = $ this -> createForm ( new ProductOrderItemType ( ) , $ entity , array ( 'action' => $ this -> generateUrl ( 'admin_orderitem_update' , array ( 'id' => $ entity -> getId ( ) ) ) , 'method' => 'PUT' , ) ) ; $ form -> add ( 'submit' , 'submit' , arr... | Creates a form to edit a ProductOrderItem entity . |
1,988 | public function notifyListeners ( ) { foreach ( $ this -> listeners as $ listener ) { $ listenerClass = $ listener [ 'listener' ] ; $ handler = array ( $ listenerClass , 'on_' . $ this -> state ) ; if ( ! class_exists ( $ listenerClass ) ) { throw new \ Exception ( $ listenerClass . ' does not exist' ) ; } if ( $ this ... | traverses list of listeners and executes their calls |
1,989 | public function quote ( $ text , $ escape = true ) { return $ this -> db -> q ( ( $ escape ? $ this -> db -> escape ( $ text ) : $ text ) ) ; } | Quote and optionally escape a string to database requirements for insertion into the database . |
1,990 | protected function replace ( $ translation , $ replacement = [ ] ) { foreach ( $ replacement as $ key => $ value ) { $ translation = str_replace ( ':' . $ key , $ value , $ translation ) ; } return $ translation ; } | Make replacement . |
1,991 | protected function apiRequest ( $ url , $ params = array ( ) ) { if ( ! isset ( $ params [ 'api_key' ] ) && $ this -> hasAttribute ( 'api_key' ) ) $ params [ 'key' ] = $ this -> getAttribute ( 'api_key' ) ; $ query = http_build_query ( $ params , '&' ) ; $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ url .... | Make api request to specific url . |
1,992 | public function respond ( $ response = array ( ) , $ replaceResponse = false ) { $ this -> set ( $ response , $ replaceResponse ) ; if ( $ this -> hasResponded ( ) ) { return ; } $ this -> cleanBuffer ( ) ; if ( self :: $ code == 204 ) { $ this -> responseSent = true ; return ; } if ( ! empty ( $ this -> apiResponseCal... | Sending the response if it hasn t already been sent |
1,993 | protected function addListenersFromArray ( SharedEventManagerInterface $ manager , $ id , $ name ) { if ( ! isset ( $ this -> data [ $ id ] [ $ name ] ) || ( ! is_array ( $ this -> data [ $ id ] [ $ name ] ) && ! ( $ this -> data [ $ id ] [ $ name ] instanceof \ Traversable ) ) ) { return $ this ; } $ objectManager = $... | Add listeners from config array |
1,994 | public function configureEventManager ( SharedEventManagerInterface $ eventManager , $ id , $ eventName ) { $ quotedId = $ this -> xpathQuote ( $ id ) ; $ quotedEvent = $ this -> xpathQuote ( $ eventName ) ; $ objectManager = $ this -> getObjectManager ( ) ; $ this -> addListenersFromArray ( $ eventManager , $ id , $ e... | Configure the event manager |
1,995 | public function display ( $ alias ) { $ items = Nav :: getMenu ( $ alias , true ) ; $ this -> set ( 'menuItems' , $ this -> _processMenuItems ( $ items , $ this -> request -> params ) ) ; } | Prepares the menu items before rendering the cell . |
1,996 | protected function _processMenuItems ( $ items , $ requestParams , & $ subActiveFound = false ) { foreach ( $ items as & $ item ) { if ( isset ( $ item [ 'url' ] ) && $ item [ 'url' ] [ 'plugin' ] === $ requestParams [ 'plugin' ] && $ item [ 'url' ] [ 'controller' ] === $ requestParams [ 'controller' ] ) { if ( ! empty... | Process provided menu items and add classes active open depending on the provided request params . |
1,997 | public function setHtml ( $ html = null ) { $ html = trim ( $ html ) ; $ this -> html = 0 < strlen ( $ html ) ? $ html : null ; return $ this ; } | Sets the html . |
1,998 | private function commandBus ( ContainerBuilder $ container , $ user , $ isApi = false ) { $ apiPartName = $ isApi ? '_api' : '' ; $ busId = 'bengor.user.simple_bus_' . $ user . $ apiPartName . '_command_bus' ; $ middlewareTag = 'bengor_user_' . $ user . '_command_bus_middleware' ; $ handlerTag = 'bengor_user_' . $ user... | Registers the command bus for given user . |
1,999 | private function eventBus ( ContainerBuilder $ container , $ user ) { $ busId = 'bengor.user.simple_bus_' . $ user . '_event_bus' ; $ middlewareTag = 'bengor_user_' . $ user . '_event_bus_middleware' ; $ subscriberTag = 'bengor_user_' . $ user . '_event_subscriber' ; $ container -> setDefinition ( $ busId , ( new Defin... | Registers the event bus for given user . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.