idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
13,900 | protected function getRequest ( $ method , $ url ) { $ this -> queryParams = array ( ) ; $ request = \ Httpful \ Request :: $ method ( $ url ) ; $ request -> sendsJson ( ) ; $ request -> expectsJson ( ) ; $ request -> addHeader ( 'User-Agent' , $ this -> identity ) ; $ ip = $ this -> getClientIp ( ) ; if ( $ ip ) $ req... | Create \ Httpful \ Request instance . |
13,901 | protected function sendRequest ( $ request , $ action = null , $ params = array ( ) ) { $ this -> queryParams += $ this -> authProvider -> queryParameters ( ) ; if ( $ action && $ this -> sendAsQueryParams ( $ action -> httpMethod ( ) ) ) { foreach ( $ params as $ ns => $ arr ) { foreach ( $ arr as $ k => $ v ) { $ thi... | Send \ Httpful \ Request . |
13,902 | protected function fetchDescription ( ) { $ url = $ this -> uri ; if ( $ this -> version ) $ url .= "/v" . $ this -> version . "/" ; $ request = $ this -> getRequest ( 'options' , $ url ) ; if ( ! $ this -> version ) $ this -> queryParams [ 'describe' ] = 'default' ; $ this -> authProvider -> authenticate ( $ request )... | Fetch the description . |
13,903 | public function getValue ( ) { try { return JsonValidator :: validate ( $ this -> value ) ? $ this -> value : '' ; } catch ( InvalidArgumentException $ e ) { return $ e -> getMessage ( ) ; } } | JSON string value |
13,904 | public function create ( $ appUserId , BankAccount $ bankAccount ) { $ url = sprintf ( 'users/%s/bankaccounts/' , $ appUserId ) ; return $ this -> createObject ( $ url , $ bankAccount ) ; } | Create new user bank account |
13,905 | public function update ( $ appUserId , BankAccount $ bankAccount ) { $ url = sprintf ( 'users/%s/bankaccounts/%s' , $ appUserId , $ bankAccount -> getId ( ) ) ; return $ this -> updateObject ( $ url , $ bankAccount ) ; } | Update existing user bank account |
13,906 | public function delete ( $ appUserId , $ id ) { $ url = sprintf ( 'users/%s/bankaccounts/%s' , $ appUserId , $ id ) ; return $ this -> deleteObject ( $ url ) ; } | Delete user bank account |
13,907 | public function route ( $ route = null , array $ params = array ( ) , array $ query = array ( ) ) { return $ this -> toRoute ( $ route , $ params , $ query ) ; } | Alias to toRoute |
13,908 | public function toRoute ( $ route = null , $ params = array ( ) , $ query = array ( ) ) { if ( ! $ route ) return $ this -> refresh ( ) ; $ url = $ this -> urlFactory -> create ( $ route , $ params , $ query ) ; return $ this -> to ( $ url ) ; } | Redirect by given route s name . |
13,909 | final public static function exceptionDriver ( int $ errorCode = NULL ) { switch ( $ errorCode ) { case self :: EMPTY_VALUE : throw new ErrorHandler ( "Empty Value." , ErrorCode :: EMPTY_VALUE ) ; break ; case self :: INVALID : throw new ErrorHandler ( "Value Not Valid." , ErrorCode :: INVALID ) ; break ; case self :: ... | Throws exception with error codes . |
13,910 | public function transform ( $ collection ) { if ( null === $ collection ) { return null ; } if ( ! ( $ collection instanceof Collection ) ) { throw new UnexpectedTypeException ( $ collection , 'Doctrine\Common\Collection\Collection' ) ; } $ results = array ( ) ; foreach ( $ collection as $ entity ) { $ results [ ] = $ ... | Transforms Entities Collection to ids |
13,911 | public function reverseTransform ( $ values ) { $ collection = new ArrayCollection ( ) ; if ( '' === $ values || null === $ values ) { return $ collection ; } if ( ! is_array ( $ values ) ) { throw new UnexpectedTypeException ( $ values , 'array' ) ; } $ values = Util :: filterScalarValues ( $ values ) ; if ( count ( $... | Transforms ids array to Collection entities |
13,912 | public function format ( $ my_number = '' , $ my_format = '' ) { if ( empty ( $ my_number ) ) { return NULL ; } try { $ phoneNumber = new PhoneNumber ( ) ; $ phoneNumber -> setDebugStatus ( $ this -> DEBUG ) ; $ phoneNumber -> setLoggerPath ( $ this -> loggerPath ) ; $ phoneNumber -> __construct ( ) ; $ result = $ phon... | Function format - Format Phone Number |
13,913 | public function detect_carrier ( $ my_number = '' , $ id = FALSE ) { $ my_number = trim ( $ my_number ) ; if ( empty ( $ my_number ) ) { return NULL ; } try { $ phoneNumber = new PhoneNumber ( ) ; $ phoneNumber -> setDebugStatus ( $ this -> DEBUG ) ; $ phoneNumber -> setLoggerPath ( $ this -> loggerPath ) ; $ phoneNumb... | Function detect_carrier - Detect Carrier |
13,914 | public function phone_number_convert ( $ my_number = '' , $ my_mode = NULL , $ my_format = NULL ) { $ my_number = trim ( $ my_number ) ; if ( empty ( $ my_number ) ) { return NULL ; } try { $ phoneNumber = new PhoneNumber ( ) ; $ phoneNumber -> setDebugStatus ( $ this -> DEBUG ) ; $ phoneNumber -> setLoggerPath ( $ thi... | Function phone_number_convert - Convert OLD Number OLD to NEW or NEW to OLD |
13,915 | public function phone_number_old_and_new ( $ my_number = '' , $ my_format = NULL ) { if ( empty ( $ my_number ) ) { return NULL ; } try { $ old_number = $ this -> phone_number_convert ( $ my_number , 'old' , $ my_format ) ; $ new_number = $ this -> phone_number_convert ( $ my_number , 'new' , $ my_format ) ; if ( $ old... | Function phone_number_old_and_new - Get Phone Number Old and New |
13,916 | public function createThumbnail ( $ width , $ height , $ prefix = 'thumb_' ) { return $ this -> imageProcessor -> createThumbnail ( $ width , $ height , $ prefix ) ; } | Create a thumbnail in same directory as original image . |
13,917 | public function init ( ) { if ( $ this -> model === null ) { throw new InvalidConfigException ( 'Please specify the "model" property.' ) ; } $ this -> dataProvider = new ArrayDataProvider ( [ 'allModels' => [ $ this -> model ] ] ) ; parent :: init ( ) ; } | Initializes dataProvider . |
13,918 | protected function renderColumn ( $ column , $ index ) { if ( is_string ( $ this -> template ) ) { return strtr ( $ this -> template , [ '{label}' => $ column -> renderHeaderCell ( ) , '{value}' => $ column -> renderDataCell ( $ this -> model , $ this -> model -> getPrimaryKey ( ) , 0 ) , ] ) ; } return call_user_func ... | Renders a single column . |
13,919 | public function generateActivationToken ( $ hours = null ) { $ token = app ( Token :: class ) -> generate ( Token :: TYPE_ACTIVATION , $ this , $ hours ) ; $ this -> notify ( new UserActivation ) ; return $ token ; } | Generate a new activation token for a user . |
13,920 | public function generateInvitationToken ( $ hours = null ) { $ token = app ( Token :: class ) -> generate ( Token :: TYPE_INVITATION , $ this , $ hours ) ; $ this -> notify ( new UserInvitation ) ; return $ token ; } | Generate a new invitation token for a user . |
13,921 | protected function checkRules ( $ object ) { $ this -> assertTrue ( property_exists ( $ object , 'rules' ) ) ; $ this -> assertInternalType ( 'array' , $ object -> rules ) ; foreach ( $ object -> rules as $ rule ) { $ this -> checkRule ( $ rule ) ; } } | Check the rules on the given object are valid . |
13,922 | protected function checkRule ( $ rule ) { $ this -> assertTrue ( is_array ( $ rule ) || is_string ( $ rule ) ) ; $ parts = is_array ( $ rule ) ? $ rule : explode ( '|' , $ rule ) ; $ this -> assertTrue ( isset ( $ parts [ 0 ] ) ) ; if ( $ this -> enforceRequiredOrNullable ( ) ) { $ this -> assertTrue ( $ parts [ 0 ] ==... | Check the given validation rule is valid . |
13,923 | public function addSocial ( AbstractUser $ socialUser , $ provider ) { $ refreshToken = isset ( $ socialUser -> refreshToken ) && $ socialUser -> refreshToken ? $ socialUser -> refreshToken : null ; $ token = is_null ( $ socialUser -> token ) ? $ provider : $ socialUser -> token ; $ this -> socials ( ) -> create ( [ 'p... | Add a social provider for a user . |
13,924 | public function generateSocialOnlyUser ( $ email , $ roles ) { $ user = static :: firstOrCreate ( compact ( 'email' ) ) ; $ user -> setStatus ( Status :: ACTIVE ) ; $ user -> assignRole ( $ roles ) ; $ user -> trackTime ( 'invited_at' ) ; Detail :: firstOrCreate ( [ 'user_id' => $ user -> id , 'display_name' => $ email... | Create a user to allow access . |
13,925 | public function setDeferredPath ( $ dir , $ url = null ) { $ dir = realpath ( $ dir ) ; if ( $ dir === false || ! is_writable ( $ dir ) ) { throw new InvalidPath ( 'The directory "' . $ dir . '" must exists and be a writable' ) ; } $ this -> deferredDir = $ dir ; if ( $ url === null ) { $ this -> deferredUrl = str_repl... | Set deffered temporary directory |
13,926 | public function addCollectors ( array $ collectors ) { foreach ( $ collectors as $ name => $ collector ) { if ( is_string ( $ name ) ) { $ this -> addCollector ( $ collector , $ name ) ; } else { $ this -> addCollector ( $ collector ) ; } } return $ this ; } | Add the collectors |
13,927 | public function addProfiler ( $ profiler , $ name = null ) { if ( $ profiler instanceof ProfileableInterface ) { if ( ! $ profiler -> isProfilerEnabled ( ) ) { $ profiler -> setProfilerStatus ( true ) ; } $ profiler = $ profiler -> getProfiler ( ) ; } if ( $ profiler instanceof ProfilerInterface ) { if ( $ name === nul... | Add the profiler |
13,928 | public function addCollector ( $ collector , $ name = null , array $ params = null ) { if ( $ collector instanceof CollectorInterface ) { if ( $ name === null ) { $ class = get_class ( $ collector ) ; $ name = substr ( $ class , strrpos ( $ class , '\\' ) + 1 ) ; } } else if ( is_string ( $ collector ) ) { if ( $ name ... | Add the collector |
13,929 | protected function loadCollector ( $ name , array $ params = null ) { $ locator = $ this -> getCollectorsLocator ( ) ; try { return $ locator -> get ( ucfirst ( $ name ) , $ params ) ; } catch ( Exception $ exception ) { $ this -> pushException ( $ exception ) ; } } | Load the collector |
13,930 | public function getCollectorsLocator ( ) { if ( $ this -> collectorsLocator === null ) { $ this -> collectorsLocator = new InitializerNamespace ( self :: NAMESPACE_COLLECTORS ) ; } return $ this -> collectorsLocator ; } | Get the collectors locator |
13,931 | protected function renderLoadingScript ( ) { $ url = $ this -> deferredUrl . 'profile_' . $ this -> token . '.html' ; $ script = $ this -> getAsset ( 'deferred.js' ) ; $ script = str_replace ( '$url' , $ url , $ script ) ; return ( new Script ( $ script ) ) -> render ( ) ; } | Render the loading script |
13,932 | protected function renderDebugBar ( ) { $ collectors = $ this -> getCollectors ( ) ; $ renderer = $ this -> getRenderer ( ) ; foreach ( $ collectors as $ name => $ collector ) { try { $ info = $ collector -> getInfo ( ) ; if ( $ info -> getName ( ) === null ) { $ info -> setName ( $ name ) ; } } catch ( Exception $ exc... | Render the debug bar |
13,933 | public function getRenderer ( ) { if ( $ this -> renderer === null ) { if ( php_sapi_name ( ) === 'cli' ) { $ this -> renderer = new RendererCli ( ) ; $ this -> renderer -> setHelpersBroker ( new CliHelperBrocker ( ) ) ; return $ this -> renderer ; } $ this -> renderer = new RendererHtml ( ) ; $ this -> renderer -> set... | Get the content renderer |
13,934 | protected function getAsset ( $ name ) { $ path = __DIR__ . DIRECTORY_SEPARATOR . 'Assets' . DIRECTORY_SEPARATOR . $ name ; $ asset = file_get_contents ( $ path ) ; if ( $ asset === false ) { throw new InvalidPath ( 'Unable to get asset "' . $ name . '" by path "' . $ path . '"' ) ; } return $ asset ; } | Get the path to the asset |
13,935 | protected function pushException ( Exception $ exception ) { $ info = new Infoset ( ) ; $ info -> setTitle ( 'Exception' ) -> setIcon ( 'alert' ) -> setLevel ( Infoset :: LEVEL_ALERT ) -> setContentType ( Infoset :: TYPE_DUMP ) -> pushContent ( $ exception ) ; $ this -> getRenderer ( ) -> addInfo ( $ info ) ; } | Push the exception into the debug bar |
13,936 | public function init ( $ type , $ identifier , $ callback , $ priority = 10 ) { $ this -> getModel ( ) -> setType ( $ type ) ; $ this -> getModel ( ) -> setIdentifier ( $ identifier ) ; $ this -> getModel ( ) -> setCallback ( $ callback ) ; $ this -> getModel ( ) -> setPriority ( $ priority ) ; } | Initialize all data . |
13,937 | public function listen ( $ args = null ) { if ( 'action' === $ this -> getModel ( ) -> getType ( ) ) { return do_action ( $ this -> getModel ( ) -> getIdentifier ( ) , $ args ) ; } return apply_filters ( $ this -> getModel ( ) -> getIdentifier ( ) , $ args ) ; } | Define hook . |
13,938 | public function isAncestor ( ItemInterface $ item , $ depth = null ) : bool { $ request = $ this -> request_stack -> getCurrentRequest ( ) ; return 0 === strpos ( $ request -> getPathInfo ( ) , $ item -> getUri ( ) ) ; } | Overrides parent isAncestor to determine based on path . |
13,939 | public function getDbTableName ( ) : string { if ( $ this -> db_table ) { return $ this -> db_table ; } $ db_table_from_class = mb_strtolower ( Converter :: fromCamelCase ( str_replace ( [ self :: CLASS_RELATION_NAME_ENTITY , self :: CLASS_RELATION_NAME_REPOSITORY ] , '' , $ this -> getUnqualifiedShortClassName ( ) ) )... | Return name in class or try to get from class name |
13,940 | public function setDatagate ( DatagateInterface $ datagate ) { $ this -> setSource ( $ datagate -> getTableName ( ) ) ; $ this -> _datagate = $ datagate ; } | Set the parent datagate |
13,941 | private function setNamespaceKey ( $ namespace ) { $ uId = UniqueId :: generate ( 64 ) ; return $ this -> getInstance ( ) -> set ( $ namespace , $ uId , 0 ) === false ? false : $ uId ; } | Set namespace key |
13,942 | public function sendEmail ( ) { $ this -> validate ( request ( ) , [ 'email' => 'required|email' ] ) ; $ this -> forgotPassword -> sendEmail ( request ( 'email' ) ) ; return redirect ( route ( 'auth.password.sent' ) ) ; } | Generate the token for the user to reset their password . |
13,943 | public function execute ( \ Template $ template ) { if ( ! Bootstrap :: isEnabled ( ) ) { return ; } foreach ( $ GLOBALS [ 'BOOTSTRAP' ] [ 'templates' ] [ 'modifiers' ] as $ config ) { if ( $ config [ 'disabled' ] || ! $ this -> isTemplateAffected ( $ template -> getName ( ) , $ config [ 'templates' ] ) ) { continue ; ... | execute all registered template modifiers |
13,944 | public static function ctag ( Event $ event ) { $ io = $ event -> getIO ( ) ; try { self :: confirmDevMode ( $ event ) ; $ ctagCommand = self :: getCtagCommand ( ) ; $ command = $ ctagCommand :: getCommand ( ) ; } catch ( \ Exception $ e ) { $ io -> write ( 'PhpCtagger: ' . $ e -> getMessage ( ) ) ; return ; } $ io -> ... | Generate ctag files for project library and Composer dependencies |
13,945 | public function createKernel ( $ kernelName , $ environment = 'dev' ) { if ( ! class_exists ( $ kernelName ) ) { $ appDir = $ this -> projectRoot . DIRECTORY_SEPARATOR . $ this -> appDir ; $ kernelFile = $ appDir . DIRECTORY_SEPARATOR . $ kernelName . '.php' ; if ( ! file_exists ( $ kernelFile ) ) { throw new \ Invalid... | Creates a given kernel |
13,946 | public function getBundlesForKernels ( array $ kernels ) { $ bundles = array ( ) ; foreach ( $ kernels as $ name => $ environments ) { $ environments = ( array ) $ environments ; foreach ( $ environments as $ environment ) { $ kernel = $ this -> createKernel ( $ name , $ environment ) ; $ registeredBundles = array ( ) ... | Collects all bundles |
13,947 | protected function getTokenizeCallback ( StdClass $ reference ) { return $ this -> bindCallback ( function ( $ node ) use ( $ reference ) { switch ( $ node [ 'type' ] ) { case HandlebarsTokenizer :: TYPE_TEXT : $ reference -> buffer .= $ this -> generateText ( $ node , $ reference -> open ) ; break ; case HandlebarsTok... | Returns the tokenizer callback |
13,948 | protected function generateClose ( array $ node , array & $ open ) { $ node [ 'value' ] = trim ( $ node [ 'value' ] ) ; if ( $ this -> findSection ( $ open , $ node [ 'value' ] ) === false ) { throw HandlebarsException :: forUnknownEnd ( $ node [ 'value' ] , $ node [ 'line' ] ) ; } $ buffer = '' ; $ i = $ this -> findS... | Partially renders the section close tokens |
13,949 | protected function generateHelpers ( ) { $ helpers = $ this -> handlebars -> getHelpers ( ) ; foreach ( $ helpers as $ name => $ helper ) { $ function = new ReflectionFunction ( $ this -> handlebars -> getHelper ( $ name ) ) ; $ path = $ function -> getFileName ( ) ; $ lines = file_get_contents ( $ path ) ; $ file = ne... | Generates helpers to add to the layout This is a placeholder incase we want to add in the future |
13,950 | protected function prettyPrint ( $ code , $ before = 0 , $ after = 0 ) { $ this -> offset += $ before ; if ( $ this -> offset < 0 ) { $ this -> offset = 0 ; } $ code = str_replace ( [ '\r' , '\n' , '\t' , '\1' , '\2' ] , [ "\n" , '"\n"' , str_repeat ( ' ' , $ this -> offset ) , str_repeat ( ' ' , 1 ) , str_repeat... | Makes code look nicely spaced |
13,951 | protected function findSection ( array $ open , $ name = self :: LAST_OPEN ) { foreach ( $ open as $ i => $ item ) { $ item = explode ( ' ' , $ item [ 'value' ] ) ; if ( $ item [ 0 ] === $ name ) { return $ i ; } } if ( $ name == self :: LAST_OPEN ) { return $ i ; } return false ; } | Finds a particular node in the open sections |
13,952 | public function set ( $ name , array $ data = [ ] ) { $ this -> setName ( $ name ) ; $ this -> setData ( $ data ) ; return $ this -> isValid ( ) ; } | Set command and optionally set data - return if set command is valid . |
13,953 | private function setData ( array $ data ) { $ this -> data = ( array ) $ data ; if ( isset ( $ this -> data [ self :: VAR_CONTROLLER ] ) ) { unset ( $ this -> data [ self :: VAR_CONTROLLER ] ) ; } return ! empty ( $ this -> data ) ; } | Set command data . |
13,954 | public function readyToPost ( array $ input ) : array { $ input [ \ Object \ Form \ Parent2 :: BUTTON_SUBMIT_SAVE ] = true ; $ input [ \ Object \ Form \ Parent2 :: BUTTON_SUBMIT_READY_TO_POST ] = true ; $ this -> form -> form_object -> addInput ( $ input ) ; $ this -> form -> form_object -> process ( ) ; return $ this ... | Ready to post |
13,955 | public function pagination ( $ args = [ ] ) { $ pagination = Container :: resolve ( Pagination :: class , [ 'args' => $ args , ] ) ; if ( isset ( $ args [ 'echo' ] ) && $ args [ 'echo' ] !== true ) { return $ pagination -> get ( ) ; } return $ pagination -> render ( ) ; } | Wrapper for outputting Pagination . |
13,956 | protected function extends ( $ layout ) { if ( $ this -> extends !== false ) { throw new Templating_Exception ( $ this -> current_view . ' is attempting to extend multiple layouts.' ) ; } $ this -> extends = $ this -> get_template_name ( $ layout ) ; } | Sets a layout to extend . |
13,957 | private function render_layout ( ) { $ snap_layout_path = \ locate_template ( Config :: get ( 'theme.templates_directory' ) . '/' . $ this -> extends ) ; if ( $ snap_layout_path === '' ) { throw new Templating_Exception ( 'Could not find layout: ' . $ this -> extends ) ; } include $ snap_layout_path ; } | Render a layout if the current view requires it . |
13,958 | public function throwException ( $ message = null ) { if ( $ message === null ) { $ message = 'The function [' . $ this -> name ( ) . '] does not exist.' ; } throw new BadFunctionCallException ( $ message ) ; } | Throw a BadFunctionCallException . The default exception message assumes that we throw the exception because it doesn t exist |
13,959 | public function getTranslations ( array $ domains = [ ] , array $ languages = [ ] , callable $ filter = null ) : array { return $ this -> repositoryCollection -> getTranslations ( $ domains , $ languages , $ filter ) ; } | Get Translations . |
13,960 | public function getTranslation ( string $ language , string $ key ) : Translation { $ languages = $ this -> repositoryCollection -> getTranslations ( [ ] , [ $ language ] , function ( Translation $ translation ) use ( $ key ) { return $ translation -> getKey ( ) === $ key ; } ) ; $ firstLanguage = reset ( $ languages )... | Get Translation given the language and the key . |
13,961 | public function getRandomMissingTranslation ( array $ domains = [ ] , array $ languages = [ ] ) : ? Translation { if ( in_array ( $ this -> masterLanguage , $ languages ) ) { throw new Exception ( 'You cannot search by master language missing translations' ) ; } $ candidates = [ ] ; $ masterKeys = $ this -> getKeys ( $... | Get random Translation . If no translations are available return null . |
13,962 | public static function create ( $ masterLanguage , array $ availableLanguages , array $ paths ) : Project { $ finder = new Finder ( ) ; $ finder -> files ( ) -> in ( $ paths ) -> name ( '*.yml' ) -> name ( '*.yaml' ) ; $ repositories = [ ] ; foreach ( $ finder as $ file ) { $ filepath = $ file -> getRealpath ( ) ; $ re... | Create a project from a list of paths . |
13,963 | public function add ( GroupObject $ object ) : Group { if ( count ( $ this -> objects ) < 2 ) { $ this -> objects [ ] = $ object ; } else { throw new Exception ( "An XORGroup may not contain more than two objects." ) ; } return $ this ; } | Add an object to the group |
13,964 | public function getPrintableName ( ) : string { $ printables = array ( ) ; foreach ( $ this -> objects as $ object ) { $ printables [ ] = $ object -> getPrintableName ( ) ; } return '{' . implode ( ' xor ' , $ printables ) . '}' ; } | Get the printable names of all members and return these delimited in a linguistically interpretable fashion enclosed between curly braces |
13,965 | protected function showInformation ( ) : void { $ swOpts = $ this -> swooleSettings ; $ settings = $ this -> serverSettings ; $ panelData = [ 'System Info' => [ 'PHP Version' => PHP_VERSION , 'Operate System' => PHP_OS , ] , 'Swoole Info' => [ 'version' => SWOOLE_VERSION , 'coroutine' => class_exists ( Coroutine :: cla... | Show server info |
13,966 | public function setRequired ( $ keys ) { if ( is_string ( $ keys ) ) { $ this -> setRequired ( explode ( "," , $ keys ) ) ; } else { foreach ( $ keys as $ key ) { if ( ! in_array ( $ key , $ this -> required ) ) $ this -> required [ ] = $ key ; } } return $ this ; } | Set required data for rendering . |
13,967 | protected function callbackResolve ( $ data ) { foreach ( $ data as $ key => $ val ) { if ( isset ( $ this -> callbacks [ $ key ] ) ) $ data [ $ key ] = $ this -> callbacks [ $ key ] ( $ val ) ; } return $ data ; } | Resolve callback in rendering |
13,968 | public function getContents ( ) { if ( ! $ this -> isReady ( ) ) return ; ob_start ( ) ; extract ( $ this -> callbackResolve ( $ this -> data ) ) ; require $ this -> path ; return ob_get_clean ( ) ; } | Get view content |
13,969 | protected function requirementCheck ( ) { if ( count ( $ this -> required ) > 0 ) { $ nonExist = array ( ) ; foreach ( $ this -> required as $ k ) { if ( ! isset ( $ this -> data [ $ k ] ) ) { $ nonExist [ ] = $ k ; } } if ( count ( $ nonExist ) > 0 ) return $ nonExist ; } return false ; } | Check required data for rendering use . |
13,970 | public function getIconByExtension ( string $ extension , bool $ include_full_path = false ) : string { $ data = $ this -> getData ( ) ; $ extension = strtolower ( $ extension ) ; $ res = $ data [ $ extension ] ?? '' ; if ( ! $ res ) { $ res = $ this -> unknown_extension_icon ; } if ( $ include_full_path ) { $ res = $ ... | Get icon for file by its extension |
13,971 | public function getData ( array $ image_extensions = [ 'gif' ] , array $ skip = [ 'unknown.gif' , 'recycle.bin.empty.gif' , 'recycle.bin.full.gif' ] ) : array { if ( isset ( self :: $ data [ $ this -> directory_with_icons ] ) ) { $ data = self :: $ data [ $ this -> directory_with_icons ] ; } else { $ data = [ ] ; $ ima... | Get all available icons list |
13,972 | public function move_page_link_above_posts ( $ menu_order ) { if ( ! $ menu_order ) { return true ; } $ pages = \ array_search ( 'edit.php?post_type=page' , $ menu_order ) ; if ( $ pages > 0 ) { $ posts = \ array_search ( 'edit.php' , $ menu_order ) ; if ( $ posts === false ) { $ posts = 2 ; } $ pages = \ array_splice ... | Move the page admin link above posts . |
13,973 | protected function getMetaFields ( $ objArticle ) { $ meta = deserialize ( $ this -> news_metaFields ) ; if ( ! is_array ( $ meta ) ) { return [ ] ; } $ return = [ ] ; foreach ( $ meta as $ field ) { switch ( $ field ) { case 'date' : $ dateAdapter = $ this -> framework -> getAdapter ( Date :: class ) ; $ return [ 'dat... | Return the meta fields of a news article as array . |
13,974 | protected function generateLink ( EventDispatcherInterface $ eventDispatcher , $ strLink , $ objArticle , $ blnAddArchive = false , $ blnIsReadMore = false ) { if ( $ objArticle -> source !== 'external' ) { return sprintf ( '<a href="%s" title="%s">%s%s</a>' , $ this -> generateNewsUrl ( $ eventDispatcher , $ objArticl... | Generate a link and return it as string . |
13,975 | public function encryptBinary ( string $ value , string $ key ) : string { $ key = $ this -> hashKey ( $ key ) ; $ opts = OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING ; $ iv = random_bytes ( $ this -> ivLength ) ; $ encrypted = openssl_encrypt ( $ value , $ this -> cipher , $ key , $ opts , $ iv ) ; if ( $ encrypted === fal... | Encrypt a value |
13,976 | public function decryptBinary ( string $ value , string $ key ) : string { $ iv = substr ( $ value , 0 , $ this -> ivLength ) ; $ encrypted = substr ( $ value , $ this -> ivLength ) ; $ key = $ this -> hashKey ( $ key ) ; $ opts = OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING ; $ ret = openssl_decrypt ( $ encrypted , $ this ... | Decrypt a value |
13,977 | public function encrypt ( $ value , string $ key , bool $ base64 = false ) : string { $ ret = $ this -> encryptBinary ( serialize ( $ value ) , $ key ) ; return ( $ base64 ) ? base64_encode ( $ ret ) : $ ret ; } | Serialize and encrypt a value |
13,978 | public function decrypt ( string $ value , string $ key , bool $ base64 = false ) { if ( $ base64 ) { $ value = base64_decode ( $ value ) ; } $ ret = $ this -> decryptBinary ( $ value , $ key ) ; return unserialize ( $ ret ) ; } | Decrypt a serialized value |
13,979 | private function hashKey ( string $ value ) : string { $ ret = openssl_digest ( $ value , $ this -> digestMethod , true ) ; if ( $ ret === false ) { throw new \ Exception ( "digest failed; " . openssl_error_string ( ) ) ; } return $ ret ; } | Compute a digest hash for a value |
13,980 | public function getFlagsAttribute ( ) : array { if ( $ this -> flagsArray !== null ) { return $ this -> flagsArray ; } return $ this -> flagsArray = json_decode ( $ this -> getAttributeFromArray ( 'flags' ) , true ) ; } | Get flags as array |
13,981 | public function register ( array $ registry ) { foreach ( $ registry as $ key => $ reg ) $ this -> data [ $ key ] = $ reg ; } | Register list of dependency |
13,982 | public function aroundCorrectItemsQty ( \ Magento \ CatalogInventory \ Model \ ResourceModel \ Stock $ subject , \ Closure $ proceed , array $ items , $ stockId , $ operator ) { if ( empty ( $ items ) ) { return $ subject ; } try { $ conn = $ subject -> getConnection ( ) ; $ conditions = [ ] ; foreach ( $ items as $ pr... | Update stock item in the stock . |
13,983 | public function aroundLockProductsStock ( \ Magento \ CatalogInventory \ Model \ ResourceModel \ Stock $ subject , \ Closure $ proceed , $ productIds , $ stockId ) { if ( empty ( $ productIds ) ) { return [ ] ; } $ conn = $ subject -> getConnection ( ) ; $ itemTable = $ subject -> getTable ( 'cataloginventory_stock_ite... | Filter locked items by stock ID . |
13,984 | public function handleAddEnclosureToTemplate ( AddEnclosureToTemplateEvent $ event ) { $ controllerAdapter = $ this -> framework -> getAdapter ( Controller :: class ) ; $ controllerAdapter -> addEnclosuresToTemplate ( $ event -> getTemplate ( ) , $ event -> getEnclosureData ( ) , $ event -> getKey ( ) ) ; } | Add an enclosure to a template . |
13,985 | public function handleGenerateFrontendUrl ( GenerateFrontendUrlEvent $ event ) { $ controllerAdapter = $ this -> framework -> getAdapter ( Controller :: class ) ; $ url = $ controllerAdapter -> generateFrontendUrl ( $ event -> getPageData ( ) , $ event -> getParameters ( ) , $ event -> getLanguage ( ) , $ event -> getF... | Generate a frontend url . |
13,986 | public function handleGetArticle ( GetArticleEvent $ event ) { $ controllerAdapter = $ this -> framework -> getAdapter ( Controller :: class ) ; $ article = $ controllerAdapter -> getArticle ( $ event -> getArticleId ( ) , $ event -> getTeaserOnly ( ) , true , $ event -> getColumn ( ) ) ; $ event -> setArticle ( $ arti... | Render an article . |
13,987 | public function handleGetContentElement ( GetContentElementEvent $ event ) { $ controllerAdapter = $ this -> framework -> getAdapter ( Controller :: class ) ; $ contentElement = $ controllerAdapter -> getContentElement ( $ event -> getContentElementId ( ) , $ event -> getColumn ( ) ) ; $ event -> setContentElementHtml ... | Render an content element . |
13,988 | public function handleGetPageDetails ( GetPageDetailsEvent $ event ) { $ pageModelAdapter = $ this -> framework -> getAdapter ( PageModel :: class ) ; $ page = $ pageModelAdapter -> findWithDetails ( $ event -> getPageId ( ) ) ; if ( $ page ) { $ event -> setPageDetails ( $ page -> row ( ) ) ; } } | Collect details for a page . |
13,989 | public function handleGetTemplateGroup ( GetTemplateGroupEvent $ event ) { $ controllerAdapter = $ this -> framework -> getAdapter ( Controller :: class ) ; $ templatesArray = $ controllerAdapter -> getTemplateGroup ( $ event -> getPrefix ( ) ) ; $ templates = $ event -> getTemplates ( ) ; foreach ( $ templatesArray as... | Collect a template group . |
13,990 | public function handleLoadDataContainer ( LoadDataContainerEvent $ event ) { $ controllerAdapter = $ this -> framework -> getAdapter ( Controller :: class ) ; $ controllerAdapter -> loadDataContainer ( $ event -> getName ( ) , $ event -> isCacheIgnored ( ) ) ; } | Load a data container . |
13,991 | public function handleRedirect ( RedirectEvent $ event ) { $ controllerAdapter = $ this -> framework -> getAdapter ( Controller :: class ) ; $ controllerAdapter -> redirect ( $ event -> getNewLocation ( ) , $ event -> getStatusCode ( ) ) ; } | Handle a redirect event . |
13,992 | public function handleReplaceInsertTags ( ReplaceInsertTagsEvent $ event ) { $ controllerAdapter = $ this -> framework -> getAdapter ( Controller :: class ) ; $ result = $ controllerAdapter -> replaceInsertTags ( $ event -> getBuffer ( ) , $ event -> isCachingAllowed ( ) ) ; $ event -> setBuffer ( $ result ) ; } | Replace insert tags . |
13,993 | public function work ( Job $ job ) { if ( ! $ this -> isFree ( ) ) { throw new Exceptions \ EmployeeNotFreeException ( ) ; } $ this -> workPid = pcntl_fork ( ) ; if ( $ this -> workPid == - 1 ) { throw new Exceptions \ ForkFailedException ( ) ; } $ this -> workState = self :: BUSY ; $ this -> job = $ job ; if ( $ this ... | Tell the Employee to work on the given job . |
13,994 | public function getWorkState ( $ wait = false ) { if ( ! is_null ( $ this -> workPid ) ) { if ( ! posix_kill ( $ this -> workPid , 0 ) ) { $ this -> workState = self :: FAILED ; $ this -> workPid = null ; } else { $ status = null ; if ( $ wait === true ) { $ args = null ; } else { $ args = \ WNOHANG ; } $ exitPid = pcn... | Get the Employee s work state . |
13,995 | public function stop ( ) { if ( $ this -> isBusy ( ) ) { posix_kill ( $ this -> workPid , \ SIGKILL ) ; $ this -> getWorkState ( true ) ; } } | Stop the job immediately . |
13,996 | public static function Serialize ( $ hash ) { if ( is_null ( $ hash ) ) return null ; $ res = Array ( ) ; $ keys = array_keys ( $ hash ) ; $ i = - 1 ; $ len = sizeof ( $ keys ) ; while ( ++ $ i < $ len ) $ res [ ] = new PhpWsdlHash ( $ keys [ $ i ] , $ hash [ $ keys [ $ i ] ] ) ; return $ res ; } | Serialize an hash array |
13,997 | public static function Deserialize ( $ arr ) { if ( is_null ( $ arr ) ) return null ; $ res = Array ( ) ; $ i = - 1 ; $ len = sizeof ( $ arr ) ; while ( ++ $ i < $ len ) $ res [ $ arr [ $ i ] -> Key ] = $ arr [ $ i ] -> Value ; return $ res ; } | Deserialize an hash array |
13,998 | public function onKernelRequest ( GetResponseEvent $ event ) { if ( $ event -> isMasterRequest ( ) && $ this -> getParameter ( 'nyroDev_utility.setLocale' ) ) { $ locale = $ event -> getRequest ( ) -> getLocale ( ) ; if ( 0 === strpos ( $ locale , 'change_' ) ) { $ tmp = explode ( 'change_' , $ locale ) ; $ locale = $ ... | Kernel request listener to setLocale if configured . |
13,999 | public function onKernelResponse ( FilterResponseEvent $ event ) { if ( $ this -> getParameter ( 'nyroDev_utility.setContentLanguageResponse' ) && $ event -> getResponse ( ) && $ event -> getResponse ( ) -> headers && $ event -> getRequest ( ) -> getLocale ( ) ) { $ event -> getResponse ( ) -> headers -> set ( 'Content... | Kernel response listener to add content - language if configured . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.