idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
232,300 | public static function getDifferingMembers ( $ object1 , $ object2 , $ membersToConsider = array ( ) , $ recursive = false ) { if ( ! ( $ object1 instanceof SerialisableObject ) || ! ( $ object2 instanceof SerialisableObject ) ) { throw new Exception ( "You cannot compare for differing members of none serialisable obje... | Get differing members between two serialisable source objects - this will return a structured array detailing the differences . If the membersToConsider array is passed only members contained within the array will be considered otherwise all members will be considered by default . |
232,301 | public static function getDifferingMembersFormattedString ( $ object1 , $ object2 , $ formatString , $ separator , $ displayMemberKeys = array ( ) , $ recursive = false ) { $ differingMembers = ObjectUtils :: getDifferingMembers ( $ object1 , $ object2 , array_keys ( $ displayMemberKeys ) , $ recursive ) ; $ elements =... | Get a formatted string encoding the differing members . |
232,302 | public function getset ( $ property , $ args ) { if ( count ( $ args ) ) { $ this -> $ property = $ args [ 0 ] ; } return $ this -> $ property ; } | Get and optionally set the value for a property . |
232,303 | protected function resolveDefitions ( PropertyDefinitionCollectionInterface $ propertyDefinitionCollection = null ) { if ( $ propertyDefinitionCollection instanceof PropertyDefinitionCollectionInterface ) { return $ propertyDefinitionCollection -> import ( $ this -> propertiesAndTypes ( ) ) ; } $ className = $ this -> ... | Resolve and if necessary initialize the property definition collection . |
232,304 | public static function appendDataToFile ( $ filePath , $ data , $ newLine = false ) { if ( $ newLine ) { file_put_contents ( $ filePath , $ data . PHP_EOL , FILE_APPEND ) ; } else { file_put_contents ( $ filePath , $ data , FILE_APPEND ) ; } } | Add data to the end of a file . |
232,305 | public static function removeLineFromFile ( $ filePath , $ match ) { $ allLines = file ( $ filePath ) ; $ matches = preg_grep ( '/' . $ match . '/i' , $ allLines , PREG_GREP_INVERT ) ; $ cleanMatches = array_map ( function ( $ str ) { return str_replace ( PHP_EOL , '' , $ str ) ; } , $ matches ) ; file_put_contents ( $... | Find matching line of text from file and remove it . |
232,306 | public static function returnMatchingLinesFromFile ( $ filePath , $ textMatch ) { $ allLines = file ( $ filePath ) ; $ matches = preg_grep ( "/" . $ textMatch . "/i" , $ allLines ) ; $ cleanMatches = array_map ( function ( $ str ) { return str_replace ( PHP_EOL , '' , $ str ) ; } , $ matches ) ; return $ cleanMatches ;... | Return lines matching the text supplied . |
232,307 | public function createMenu ( string $ id , string $ class ) : string { $ output = $ this -> addOpeningNav ( $ id ) ; if ( $ this -> options [ 'brand' ] [ 'name' ] !== '' ) $ output .= $ this -> addBranding ( ) ; if ( $ this -> options [ 'mobile' ] ) $ output .= $ this -> addMobileButton ( ) ; $ output .= '<div class="c... | 1 . 0 Start of creating the bootstrap menu |
232,308 | private function addOpeningNav ( string $ id ) : string { $ output = '<nav ' ; if ( $ id !== '' ) $ output .= 'id="' . $ id . '" ' ; $ output .= 'class="navbar navbar-' . $ this -> options [ 'theme' ] [ 'fore' ] ; if ( ! empty ( $ this -> options [ 'theme' ] [ 'back' ] ) ) $ output .= " bg-" . $ this -> options [ 'them... | 1 . 1 Creating opening tag navigation |
232,309 | private function addBranding ( ) : string { $ output = '<a class="navbar-brand" href="' . BASE_URL . '/">' ; if ( $ this -> options [ 'brand' ] [ 'image' ] [ 'link' ] !== 'none' ) $ output .= '<img src="' . BASE_URL . $ this -> options [ 'brand' ] [ 'image' ] [ 'link' ] . '" height="' . $ this -> options [ 'brand' ] [ ... | 1 . 2 Adding the brand of the website to the menu |
232,310 | private function createLeftMenu ( ) : string { $ argsCount = 0 ; $ arrayKey = $ this -> getArrayKey ( $ this -> menuData ) ; $ output = '<ul class="navbar navbar-nav mr-auto">' ; foreach ( $ arrayKey as $ menuItem ) { list ( $ url , $ text , $ place , $ id , $ class ) = $ this -> getLinkInformation ( [ $ menuItem ] ) ;... | 2 . 0 Creating Bootstrap s Left Menu |
232,311 | private function createSubmenu ( array $ arguments , array $ subMenu ) : string { $ argsCount = count ( $ arguments ) ; $ arrayKey = $ this -> getArrayKey ( $ subMenu ) ; list ( $ url , $ text , $ place , $ id , $ class ) = $ this -> getLinkInformation ( $ arguments ) ; $ output = '<a class="nav-link dropdown-toggle' ;... | 4 . 0 Create the drop down submenu |
232,312 | private function createDropDownItemSubUrl ( array $ args ) : string { list ( $ url , $ text , $ place , $ id , $ class ) = $ this -> getLinkInformation ( $ args ) ; $ output = '<a class="dropdown-item dropdown-toggle' ; $ output = ! empty ( $ class ) ? $ output . ' ' . $ class . '"' : $ output . '"' ; if ( ! empty ( $ ... | G . 2 Create the URL for the dropdown - item |
232,313 | private function getLinkInformation ( array $ args ) : array { $ arg = Menu :: getIndexes ( $ args ) ; $ url = $ this -> menuData [ $ arg [ 0 ] ] [ $ arg [ 1 ] ] [ $ arg [ 2 ] ] [ $ arg [ 3 ] ] [ $ arg [ 4 ] ] [ $ arg [ 5 ] ] [ $ arg [ 6 ] ] [ $ arg [ 7 ] ] [ $ arg [ 8 ] ] [ $ arg [ 9 ] ] [ 'url' ] ; $ text = $ this ->... | G . 3 Get the menu information |
232,314 | private function getArrayKey ( array $ menuData ) : array { $ arrayKey = array_keys ( $ menuData ) ; $ arrayKey = array_diff ( $ arrayKey , $ this -> remove ) ; $ arrayKey = array_values ( $ arrayKey ) ; return $ arrayKey ; } | G . 4 Get the keys of the current level in the menu |
232,315 | private function overviewUrl ( string $ url , string $ id , string $ class ) : string { $ output = '<li>' ; $ output .= '<a class="dropdown-item' ; $ output = ! empty ( $ class ) ? $ output . ' ' . $ class . '"' : $ output . '"' ; if ( ! empty ( $ id ) ) $ output .= ' id="' . $ id . '"' ; $ output .= ' href="' . $ url ... | G . 5 Add Overview Menu option |
232,316 | function var_dump ( $ message , $ data ) { try { $ export = trim ( str_replace ( "\n" , "\n\t" , var_export ( $ data , true ) ) , "\n\t " ) ; $ this -> log ( "$message\n\n\t$export\n" ) ; } catch ( Exception $ e ) { $ this -> failedLogging ( $ e , $ message ) ; } } | Save the data passed in as data . |
232,317 | protected function becloud ( $ clear ) { if ( $ this -> beclouding === null ) { return $ clear ; } else { $ to_hide = [ ] ; foreach ( $ this -> beclouding as $ key => $ str ) { $ to_hide [ $ str ] = $ key ; } return strtr ( $ clear , $ to_hide ) ; } } | This method is hook for implementation that can handle hiding or need hiding . |
232,318 | public function getText ( String $ text = null , String $ colour = 'green' , String $ backgroundColor = 'black' ) { $ colours = [ 'green' => Attributes :: COLOR_GREEN , 'red' => Attributes :: COLOR_RED , 'yellow' => Attributes :: COLOR_YELLOW , 'blue' => Attributes :: COLOR_BLUE , 'cyan' => Attributes :: COLOR_CYAN , '... | Returns text with option to set the text colour . |
232,319 | public function sendOutput ( String $ output , String $ colour = 'white' , String $ backgroundColor = 'black' ) { fwrite ( STDOUT , $ this -> getText ( $ output , $ colour , $ backgroundColor ) ) ; } | Sends output to the environment . |
232,320 | public function getAlternatesortstring1ByUserId ( $ userID ) { return DB :: table ( 'email_messages' ) -> join ( 'email_attachments' , 'email_messages.id' , '=' , 'email_attachments.email_messages_id' ) -> select ( 'email_attachments.alternate_sort_string1' ) -> where ( 'email_messages.user_id' , '=' , $ userID ) -> di... | Get a list of alternatesortstring1 field values by user ID |
232,321 | public static function convert ( int $ error_code ) { return isset ( self :: $ levels [ $ error_code ] ) ? self :: $ levels [ $ error_code ] : "GENERIC_ERROR" ; } | Convert a PHP error level to its name |
232,322 | public function errorInfo ( ) { if ( $ this -> getConnection ( ) instanceof PDO ) { $ message = isset ( $ this -> connection -> errorInfo ( ) [ 'message' ] ) ? $ this -> getConnection ( ) -> errorInfo ( ) [ 'message' ] : 'Something Went Wrong!' ; } elseif ( $ this -> getConnection ( ) instanceof mysqli ) { $ message = ... | return the last query error |
232,323 | public function dir ( $ path = null , $ create = false ) { if ( ! isset ( $ this -> _baseDir ) ) { throw new App \ Exception ( 'Base directory not set' ) ; } return isset ( $ path ) ? $ this -> _baseDir -> dir ( $ path , $ create ) : $ this -> _baseDir ; } | Get child directory . |
232,324 | public function file ( $ path ) { if ( ! isset ( $ this -> _baseDir ) ) { throw new App \ Exception ( 'Base directory not set' ) ; } return $ this -> _baseDir -> file ( $ path ) ; } | Get child file . |
232,325 | public function load ( $ file , array $ vars = array ( ) ) { $ file = ! $ file instanceof File ? new File ( "{$file}" ) : $ file ; $ file = $ file -> isRelative ( ) ? $ this -> file ( $ file ) : $ file ; return \ Coast \ load ( $ file , array_merge ( [ 'app' => $ this ] , $ vars ) ) ; } | Load a file without leaking variables include app object in vars . |
232,326 | public function lazy ( $ source , array $ vars = array ( ) ) { if ( is_string ( $ source ) ) { $ source = new File ( "{$source}" ) ; $ source = $ source -> isRelative ( ) ? $ this -> file ( $ source ) : $ source ; } return new Lazy ( $ source , array_merge ( [ 'app' => $ this ] , $ vars ) ) ; } | Lazy load a file without leaking variables include app object in vars . |
232,327 | public function executable ( $ executable , $ subpath = null ) { if ( ! $ executable instanceof Closure && ! $ executable instanceof Executable ) { throw new App \ Exception ( "Object is not a closure or instance of Coast\App\Executable" ) ; } if ( isset ( $ subpath ) ) { $ executable = new App \ Subpath ( $ executable... | Add executable to the stack . |
232,328 | public function execute ( Request $ req = null , Response $ res = null ) { $ auto = false ; if ( ! isset ( $ req ) ) { $ auto = true ; $ req = ( new Request ( ) ) -> fromGlobals ( ) ; $ res = ( new Response ( $ req ) ) ; } else if ( ! isset ( $ res ) ) { throw new App \ Exception ( 'You must pass a Response object when... | Execute the application running middleware in order . |
232,329 | public function addPostFilter ( FilterInterface $ filter , $ priority = 0 ) { $ this -> post_transformation -> add ( $ filter , $ priority ) ; return $ this ; } | add a post - processing filter to be always executed |
232,330 | static function create ( $ width , $ height = 0 , $ mode = ImageResizeDefinition :: MODE_MAX , $ upscale = false ) { return new static ( $ width , $ height , $ mode , $ upscale ) ; } | Create an ImageResizeDefinition instance |
232,331 | public function onBootstrap ( EventInterface $ e ) { $ serviceManager = $ e -> getApplication ( ) -> getServiceManager ( ) ; $ this -> initPluginManagerFactory ( $ serviceManager , __NAMESPACE__ . '\SupervisorManager' , 'supervisor_plugin_manager' ) ; $ this -> initPluginManagerFactory ( $ serviceManager , __NAMESPACE_... | Bootstrap the module |
232,332 | protected function get ( $ name ) { $ this -> load ( ) ; return isset ( $ this -> lng [ $ name ] ) ? $ this -> lng [ $ name ] : $ name ; } | get language Value |
232,333 | public function message ( $ message , $ level , $ level_name , $ channel , $ datetime ) { $ datetime -> setTimezone ( new \ DateTimeZone ( 'UTC' ) ) ; $ this -> request -> setData ( array ( 'message' => $ message , 'status_code' => $ level , 'status_name' => $ level_name , 'channel' => $ channel , 'created_utc' => $ da... | Build message to send to AtomLogger |
232,334 | public function getContext ( $ name = null ) { if ( is_null ( $ name ) ) { $ name = $ this -> context ; } return isset ( $ this -> contexts [ $ name ] ) ? $ this -> contexts [ $ name ] : null ; } | Get a context URI from the array . |
232,335 | public function getPrefix ( ) { $ prefix = null ; if ( ! is_null ( $ this -> getContext ( ) ) ) { $ prefix = $ this -> getContext ( ) ; } if ( ! is_string ( $ this -> prefix ) ) { return $ prefix ; } return $ prefix . $ this -> prefix ; } | Get the prefix for this route group . |
232,336 | protected function _overflowHandler ( ) { return $ this -> _getAdapter ( ) -> overflow ( $ this -> _cacheKey , $ this -> getUsage ( ) - $ this -> getSize ( ) + 1 , $ this -> getUsage ( ) ) ; } | Buffer overflow handler |
232,337 | public function add ( $ data ) { if ( empty ( $ data ) || ! $ this -> _getAdapter ( ) -> isClientConnected ( ) ) { return false ; } if ( ! $ this -> _getAdapter ( ) -> add ( $ this -> _cacheKey , json_encode ( $ data ) ) ) { return false ; } if ( $ this -> getUsage ( ) >= $ this -> getSize ( ) ) { if ( ! empty ( $ this... | Add data to buffer |
232,338 | public function read ( ) { $ data = $ this -> _getAdapter ( ) -> read ( $ this -> _cacheKey ) ; if ( ! empty ( $ data ) && is_array ( $ data ) ) { foreach ( $ data as & $ row ) { $ row = json_decode ( $ row , 1 ) ; } } return $ data ; } | Read data from buffer |
232,339 | public function clearEntityManager ( $ managerName = null ) { if ( null === $ this -> doctrine ) { throw new \ Exception ( 'Doctrine is required' ) ; } if ( null === $ managerName ) { $ managerName = $ this -> doctrine -> getDefaultConnectionName ( ) ; } if ( ! array_key_exists ( $ managerName , $ this -> snapshots ) )... | Detach all objects in EntityManager persisted since snapshot |
232,340 | public function onBootstrap ( MvcEvent $ event ) { $ sharedEventManager = $ event -> getApplication ( ) -> getEventManager ( ) -> getSharedManager ( ) ; $ sharedEventManager -> attach ( AbstractActionController :: class , MvcEvent :: EVENT_DISPATCH , [ $ this , 'onDispatchedListener' ] , self :: DISPATCH_PRIORITY ) ; } | Module bootstrap handler |
232,341 | public function getControllerPluginConfig ( ) { return [ 'factories' => [ Controller \ Plugin \ Config :: class => Controller \ Plugin \ Factory \ ConfigFactory :: class , Controller \ Plugin \ Env :: class => Controller \ Plugin \ Factory \ EnvFactory :: class , Controller \ Plugin \ Server :: class => Controller \ Pl... | Configuration controller plugin |
232,342 | public function getViewHelperConfig ( ) { return [ 'factories' => [ View \ Helper \ Params :: class => View \ Helper \ Factory \ ParamsFactory :: class , View \ Helper \ Config :: class => View \ Helper \ Factory \ ConfigFactory :: class , View \ Helper \ Env :: class => View \ Helper \ Factory \ EnvFactory :: class , ... | Configuration view helper |
232,343 | protected function morphResponseIfNeeded ( $ response ) { $ contentType = $ this -> detectContentType ( $ response ) ; if ( $ newResponse = $ this -> getFromListeners ( $ contentType , $ response ) ) { return $ newResponse ; } } | Does the actual work . Looks if a morpher is set and call it if needed |
232,344 | protected function detectContentType ( $ response ) { if ( ! $ this -> contentTypeDetector ) { return $ this -> defaultContentType ; } if ( $ contentType = call_user_func ( $ this -> contentTypeDetector , $ response , $ this ) ) { return $ contentType ; } return $ this -> defaultContentType ; } | Detects the content type |
232,345 | protected function getFromListeners ( $ contentType , $ response ) { foreach ( [ 'before' , 'after' ] as $ position ) { foreach ( $ this -> getAfterOrBeforeListeners ( 'handle' , $ position ) as $ listener ) { if ( $ result = $ listener ( $ contentType , $ response , $ this ) ) { return $ result ; } } } return null ; } | Fires the event and returns the result if there were some |
232,346 | public function findByPath ( $ path ) { $ qb = $ this -> createQueryBuilder ( 'r' ) ; $ query = $ qb -> andWhere ( $ qb -> expr ( ) -> eq ( 'r.fromPath' , ':path' ) ) -> andWhere ( $ qb -> expr ( ) -> eq ( 'r.enabled' , ':enabled' ) ) -> getQuery ( ) -> setMaxResults ( 1 ) ; return $ query -> setParameters ( [ 'path' =... | Finds the redirection by from path . |
232,347 | public function send ( Request $ request ) { $ headers = array ( 'Content-Type' => $ request -> getContentType ( ) ) ; $ content = $ request -> formatData ( ) ; if ( $ this -> hasSiteKey ( ) ) { $ headers = array_merge ( $ headers , array ( 'x-atom-log-id' => $ this -> getSiteKey ( ) ) ) ; } try { $ response = $ this -... | Send the Request |
232,348 | static public function resolve ( $ callback , \ Lollipop \ HTTP \ Request $ req , \ Lollipop \ HTTP \ Response $ res , array $ args = [ ] ) { if ( is_string ( $ callback ) ) { $ ctoks = explode ( '.' , $ callback ) ; $ output = '' ; switch ( count ( $ ctoks ) ) { case 1 : if ( ! function_exists ( $ action = $ ctoks [ 0... | Call callback and return data |
232,349 | public function addAssets ( array $ assets ) { foreach ( $ assets as $ asset ) { if ( ! is_array ( $ asset ) ) { throw new \ InvalidArgumentException ( 'Each element needs to be an array.' ) ; } $ this -> addAsset ( $ asset ) ; } } | Adds a list of assets to be processed by the asset writer . |
232,350 | public function addAsset ( array $ asset ) { if ( ! isset ( $ asset [ 'input' ] ) ) { throw new \ InvalidArgumentException ( 'Asset needs an input.' ) ; } if ( ! isset ( $ asset [ 'name' ] ) ) { $ asset [ 'name' ] = uniqid ( ) ; } if ( ! isset ( $ asset [ 'filter' ] ) ) { $ asset [ 'filter' ] = array ( ) ; } if ( ! is_... | Adds an asset to be processed by the asset writer . |
232,351 | public function offsetGet ( $ key ) { if ( ( $ index = $ this -> keysIndices [ self :: keyString ( $ key ) ] ?? null ) === null ) { return null ; } return $ this -> values [ $ index ] ; } | Retrieve a value with the given key . |
232,352 | public function offsetSet ( $ key , $ value ) { if ( $ key === null ) { $ intKeys = array_filter ( $ this -> keys , 'is_int' ) ; $ this -> keys [ ] = $ i = empty ( $ intKeys ) ? 0 : max ( max ( $ intKeys ) + 1 , 0 ) ; $ this -> values [ ] = $ value ; $ this -> keysIndices [ $ i ] = count ( $ this -> values ) - 1 ; } el... | Insert the given value with the given key . |
232,353 | public function offsetUnset ( $ key ) { $ keyString = self :: keyString ( $ key ) ; if ( ( $ index = $ this -> keysIndices [ $ keyString ] ?? null ) !== null ) { unset ( $ this -> keys [ $ index ] , $ this -> values [ $ index ] , $ this -> keysIndices [ $ keyString ] ) ; } } | Remove a value with the given key from the map . |
232,354 | public function getIterator ( ) : Traversable { foreach ( $ this -> values as $ index => & $ value ) { yield $ this -> keys [ $ index ] => $ value ; } } | Get the map iterator . |
232,355 | public function reset ( ) { $ uri = $ this -> createBaseUri ( ) -> withPath ( self :: API_RESET_URL ) ; $ request = ( new PsrRequest ( ) ) -> withUri ( $ uri ) -> withMethod ( 'post' ) ; $ this -> ensureIsNotErrorResponse ( $ this -> connection -> send ( $ request ) ) ; } | Restores pre - defined expectations and resets scenarios and requests counter . |
232,356 | public function resetScenarios ( ) { $ uri = $ this -> createBaseUri ( ) -> withPath ( self :: API_SCENARIOS_URL ) ; $ request = ( new PsrRequest ( ) ) -> withUri ( $ uri ) -> withMethod ( 'delete' ) ; $ this -> ensureIsNotErrorResponse ( $ this -> connection -> send ( $ request ) ) ; } | Resets all the scenarios to start state . |
232,357 | public function resetRequestsCounter ( ) { $ uri = $ this -> createBaseUri ( ) -> withPath ( self :: API_EXECUTIONS_URL ) ; $ request = ( new PsrRequest ( ) ) -> withUri ( $ uri ) -> withMethod ( 'delete' ) ; $ this -> ensureIsNotErrorResponse ( $ this -> connection -> send ( $ request ) ) ; } | Resets all the requests counters to 0 . |
232,358 | public function keep ( $ key ) { if ( isset ( $ this -> data [ static :: EXPIRE_DATA_KEY ] [ $ key ] ) ) { $ this -> data [ static :: EXPIRE_DATA_KEY ] [ $ key ] [ 1 ] = static :: EXPIRE_STATE_NEW ; return true ; } return false ; } | Reset the expiry state on the given key |
232,359 | public function expiration ( $ key ) { if ( isset ( $ this -> data [ static :: EXPIRE_DATA_KEY ] [ $ key ] ) ) { $ expiration = array ( $ this -> data [ static :: EXPIRE_DATA_KEY ] [ $ key ] [ 0 ] == EXPIRE_ON_REQUEST ? 'EXPIRE_ON_REQUEST' : 'EXPIRE_ON_GET' , $ this -> data [ static :: EXPIRE_DATA_KEY ] [ $ key ] [ 1 ]... | Returns the expiry state on the given key |
232,360 | public function get ( $ key , $ default = null ) { if ( parent :: has ( $ this -> prefixKey ( $ key ) ) ) { if ( ! isset ( $ this -> data [ static :: EXPIRE_DATA_KEY ] [ $ key ] ) ) { return parent :: get ( $ this -> prefixKey ( $ key ) , $ default ) ; } if ( $ this -> data [ static :: EXPIRE_DATA_KEY ] [ $ key ] [ 1 ]... | Returns a key s value from this bag s data |
232,361 | public function delete ( $ key ) { unset ( $ this -> data [ static :: EXPIRE_DATA_KEY ] [ $ key ] ) ; return parent :: delete ( $ this -> prefixKey ( $ key ) ) ; } | Deletes data from the container |
232,362 | public function setContents ( array $ data ) { if ( isset ( $ data [ static :: EXPIRE_DATA_KEY ] ) ) { foreach ( $ data [ static :: EXPIRE_DATA_KEY ] as $ key => $ expiration ) { if ( $ expiration [ 1 ] === static :: EXPIRE_STATE_NEW ) { $ data [ static :: EXPIRE_DATA_KEY ] [ $ key ] [ 1 ] = static :: EXPIRE_STATE_LOAD... | Replaces the container s data |
232,363 | public function getContents ( ) { $ data = $ this -> data ; foreach ( $ data [ static :: EXPIRE_DATA_KEY ] as $ key => $ expiration ) { if ( $ expiration [ 1 ] === static :: EXPIRE_STATE_EXPIRED ) { unset ( $ data [ static :: EXPIRE_DATA_KEY ] [ $ key ] ) ; \ Arr :: delete ( $ data , $ this -> prefixKey ( $ key ) ) ; }... | Returns the container s data |
232,364 | public function cmdGetLibrary ( ) { $ list = $ this -> getListLibrary ( ) ; $ this -> outputFormat ( $ list ) ; $ this -> outputFormatTableLibrary ( $ list ) ; $ this -> output ( ) ; } | Callback for library - get command |
232,365 | public static function doesClassExtendClass ( $ childClassName , $ parentClassName ) { $ reflectionClass = new \ ReflectionClass ( $ childClassName ) ; do { if ( $ reflectionClass -> getName ( ) == $ parentClassName ) return true ; $ reflectionClass = $ reflectionClass -> getParentClass ( ) ; } while ( $ reflectionClas... | Check to see whether or not a given child class extends a given parent class |
232,366 | protected function _setPlaceholderTemplate ( $ template ) { if ( ! is_null ( $ template ) ) { $ template = $ this -> _normalizeStringable ( $ template ) ; } $ this -> placeholderTemplate = $ template ; } | Assigns the placeholder template to this instance . |
232,367 | public function run ( array $ args ) { $ command = ( string ) $ args [ 1 ] ; $ this -> router -> match ( $ command ) ; $ args = array_slice ( $ args , 2 ) ; return $ this -> router -> executeCommand ( $ args ) ; } | run run the command and return exit code . |
232,368 | protected function config ( $ data = [ ] ) { if ( null === $ data ) { $ data = [ ] ; } if ( false === is_array ( $ data ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type array, "%s" given' , __METHOD__ , gettype ( $ data ) ) , E_USER_ERROR ) ; } $ module = Router :: getRoute ( ) -> g... | Returns the config for the current module |
232,369 | public function aroundGetProductPrice ( \ Magento \ Catalog \ Block \ Product \ ListProduct $ subject , \ Closure $ proceed , \ Magento \ Catalog \ Model \ Product $ product ) { $ result = $ proceed ( $ product ) ; $ canSeePv = $ this -> hlpCust -> canSeePv ( ) ; if ( $ canSeePv ) { $ domId = "prxgt_pv_" . $ product ->... | Insert PV HTML before product price HTML . |
232,370 | public function drawByBlock ( array $ text ) { $ maxWidth = 0 ; foreach ( $ text as $ line ) { $ this -> drawByLine ( $ line , true ) ; $ lineWidth = $ this -> _getActualLength ( $ line ) ; if ( $ lineWidth > $ maxWidth ) { $ maxWidth = $ lineWidth ; } } $ this -> _canvasSize [ 0 ] += $ maxWidth ; echo $ this -> _curso... | Draw by block |
232,371 | public function drawByLine ( $ text , $ insertLineFeeds = true ) { $ convertedText = $ this -> _convertTagsToEscapeSequences ( $ text ) ; echo $ convertedText ; if ( $ insertLineFeeds === true ) { $ width = $ this -> _getActualLength ( $ text ) ; echo $ this -> _cursor -> insertLineFeeds ( $ width ) -> getEscapeSequenc... | Draw by line |
232,372 | public function finishDrawingByBlock ( ) { $ canvasHeight = $ this -> _canvasSize [ 1 ] ; echo str_repeat ( "\n" , $ canvasHeight ) ; $ this -> _cursor -> moveHome ( ) -> move ( 0 , $ canvasHeight ) ; return $ this ; } | Finish drawing by block |
232,373 | public static function getWindowSize ( ) { $ terminal = exec ( 'echo $TERM_PROGRAM' ) ; if ( $ terminal === 'Apple_Terminal' ) { $ windowWidth = exec ( 'tput cols' ) ; $ windowHeight = exec ( 'tput lines' ) ; } $ windowWidth = ( $ windowWidth > 0 ) ? $ windowWidth : self :: DEFAULT_WINDOW_WIDTH ; $ windowHeight = ( $ w... | Get terminal window size |
232,374 | private function _convertTagsToEscapeSequences ( $ text ) { list ( $ patterns , $ replacements ) = $ this -> _getConvertingDictionary ( ) ; $ convertedText = preg_replace ( $ patterns , $ replacements , $ text ) ; return $ convertedText ; } | Convert tags to escape sequences |
232,375 | private function _getActualLength ( $ text ) { $ convertedText = $ this -> _convertTagsToEscapeSequences ( $ text ) ; $ strippedText = $ this -> _stripEscapeSequences ( $ convertedText ) ; $ length = mb_strlen ( $ strippedText , 'utf-8' ) ; return $ length ; } | Get actual length |
232,376 | private function _getConvertingDictionary ( ) { $ definedColors = DecorationsObject :: getDefinedColors ( ) ; foreach ( $ definedColors as $ colorName => $ escapeSequences ) { list ( $ textColorEscapeSequence , $ backgroundColorEscapeSequence ) = $ escapeSequences ; $ patterns [ ] = "|<tc:$colorName>|" ; $ replacements... | Get converting dictionary |
232,377 | public static function back ( ) { $ referer = $ _SERVER [ 'HTTP_REFERER' ] ; if ( ! empty ( $ referer ) ) { return self :: redirect ( $ referer ) ; } return self :: redirect ( '/' ) ; } | Redirect to HTTP referer . |
232,378 | public function index ( $ trashed = false ) { $ this -> authorize ( PostsPolicy :: PERMISSION_LIST ) ; $ posts = $ this -> post -> with ( [ 'author' , 'category' ] ) -> when ( $ trashed , function ( $ query ) { return $ query -> onlyTrashed ( ) ; } ) -> paginate ( 30 ) ; $ title = trans ( 'blog::posts.titles.posts-list... | List the posts . |
232,379 | public function store ( CreatePostRequest $ request ) { $ this -> authorize ( PostsPolicy :: PERMISSION_CREATE ) ; $ post = Post :: createOne ( $ request -> getValidatedData ( ) ) ; $ this -> transNotification ( 'created' , [ 'title' => $ post -> title ] , $ post -> toArray ( ) ) ; return redirect ( ) -> route ( 'admin... | Store the post . |
232,380 | public function show ( Post $ post ) { $ this -> authorize ( PostsPolicy :: PERMISSION_SHOW ) ; $ post = $ post -> load ( [ 'author' , 'category' , 'tags' , 'seo' ] ) ; $ this -> setTitle ( trans ( 'blog::posts.titles.post-details' ) ) ; $ this -> addBreadcrumb ( $ post -> title ) ; return $ this -> view ( 'admin.posts... | Show a post . |
232,381 | public function edit ( Post $ post ) { $ this -> authorize ( PostsPolicy :: PERMISSION_UPDATE ) ; $ this -> setTitle ( $ title = trans ( 'blog::posts.titles.edit-post' ) ) ; $ this -> addBreadcrumb ( $ title ) ; $ categories = Category :: getSelectData ( ) ; $ tags = Tag :: getSelectData ( ) ; $ statuses = Post :: getS... | Edit a post . |
232,382 | public function update ( Post $ post , UpdatePostRequest $ request ) { $ this -> authorize ( PostsPolicy :: PERMISSION_UPDATE ) ; $ post -> updateOne ( $ request -> getValidatedData ( ) ) ; $ this -> transNotification ( 'updated' , [ 'title' => $ post -> title ] , $ post -> toArray ( ) ) ; return redirect ( ) -> route ... | Update the post . |
232,383 | public function restore ( Post $ post ) { $ this -> authorize ( PostsPolicy :: PERMISSION_UPDATE ) ; try { $ post -> restore ( ) ; return $ this -> jsonResponseSuccess ( [ 'message' => $ this -> transNotification ( 'restored' , [ 'title' => $ post -> title ] , $ post -> toArray ( ) ) ] ) ; } catch ( \ Exception $ e ) {... | Restore a trashed post . |
232,384 | protected function executeDestroy ( ) { if ( $ this -> reallyDestroy ) { parent :: executeDestroy ( ) ; } else { $ this -> saveData ( [ $ this -> deletedAtColumn => date ( 'Y-m-d H:i:s' ) , $ this -> deletedByColumn => $ this -> curUser [ 'id' ] , ] ) ; } } | Overwrite original destroy logic . |
232,385 | public function getFloatMajor ( ) { if ( $ this -> startsWith ( $ this -> major , '0' ) ) return ( float ) ( '0.' . substr ( $ this -> major , 1 ) ) ; return ( float ) $ this -> major ; } | Get floated major |
232,386 | public function getFloatMinor ( ) { if ( $ this -> startsWith ( $ this -> minor , '0' ) ) return ( float ) ( '0.' . substr ( $ this -> minor , 1 ) ) ; return ( float ) $ this -> minor ; } | Get floated minor |
232,387 | public function getFloatPath ( ) { if ( $ this -> startsWith ( $ this -> path , '0' ) ) return ( float ) ( '0.' . substr ( $ this -> path , 1 ) ) ; return ( float ) $ this -> path ; } | Get floated path |
232,388 | public function isPartOf ( Version $ version ) { if ( is_null ( $ version -> getOperator ( ) ) ) { if ( $ this -> major == $ version -> getMajor ( ) && $ this -> minor == $ version -> getMinor ( ) && $ this -> path == $ version -> getPath ( ) ) return true ; return false ; } switch ( $ version -> getOperator ( ) ) { ca... | Is this version part of another version? |
232,389 | protected function detectOperator ( ) { if ( $ this -> startsWith ( $ this -> version , self :: GREATER_EQUAL ) ) { $ this -> operator = self :: GREATER_EQUAL ; $ this -> version = substr ( $ this -> version , 2 ) ; } else if ( $ this -> startsWith ( $ this -> version , self :: GREATER ) ) { $ this -> operator = self :... | Detect operator of version |
232,390 | public function getConfig ( $ prefix ) { $ siteConfigService = $ this -> getServiceLocator ( ) -> get ( EyeService :: class ) ; $ config = $ siteConfigService -> getAll ( ) ; $ prefixParts = explode ( '.' , $ prefix ) ; $ conf = $ config ; foreach ( $ prefixParts as $ prefix ) { if ( isset ( $ conf [ $ prefix ] ) ) { $... | Get config for specified prefix |
232,391 | public function setExpression ( $ value ) { $ this -> cronParts = preg_split ( '/\s/' , $ value , - 1 , PREG_SPLIT_NO_EMPTY ) ; if ( count ( $ this -> cronParts ) < 6 ) { throw new InvalidArgumentException ( $ value . ' is not a valid CRON expression' ) ; } foreach ( $ this -> cronParts as $ position => $ part ) { $ th... | Set or change the CRON expression |
232,392 | public function setPart ( $ position , $ value ) { if ( ! $ this -> fieldFactory -> getField ( $ position ) -> validate ( $ value ) ) { throw new InvalidArgumentException ( 'Invalid CRON field value ' . $ value . ' as position ' . $ position ) ; } $ this -> cronParts [ $ position ] = $ value ; return $ this ; } | Set part of the CRON expression |
232,393 | public function isDue ( $ currentTime = null ) { if ( null === $ currentTime || 'now' === $ currentTime ) { $ currentDate = date ( 'Y-m-d H:i:s' ) ; $ currentTime = strtotime ( $ currentDate ) ; } elseif ( $ currentTime instanceof DateTime ) { $ currentDate = $ currentTime -> format ( 'Y-m-d H:i:s' ) ; $ currentTime = ... | Deterime if the cron is due to run based on the current date or a specific date . This method assumes that the current number of seconds are irrelevant and should be called once per minute . |
232,394 | public function setProtocol ( $ protocol ) { switch ( strtoupper ( $ protocol ) ) { case 'HTTP/1.0' : case 'HTTP/1.1' : $ this -> protocol = strtoupper ( $ protocol ) ; break ; default : throw new \ OutOfRangeException ( sprintf ( 'Unsupported protocol: "%s"' , $ protocol ) ) ; } return $ this ; } | Set the HTTP protocol being used . |
232,395 | public function hasHeader ( $ header ) { if ( $ header instanceof HttpHeaderInterface ) { return ! empty ( $ this -> headers [ strtolower ( $ header -> getFieldName ( ) ) ] ) ; } return ! empty ( $ this -> headers [ strtolower ( $ header ) ] ) ; } | Check if an HTTP header with the given name is set . |
232,396 | public function getHeader ( $ header ) { $ n = ( $ header instanceof HttpHeaderInterface ) ? strtolower ( $ header -> getFieldName ( ) ) : strtolower ( $ header ) ; if ( ! empty ( $ this -> headers [ $ n ] ) ) { return $ this -> headers [ $ n ] [ 0 ] [ 1 ] ; } if ( func_num_args ( ) > 1 ) { return func_get_arg ( 1 ) ; ... | Get the first HTTP header of the given type . |
232,397 | public function addHeader ( $ header , $ value = NULL ) { if ( $ header instanceof HttpHeaderInterface ) { $ n = strtolower ( $ header -> getFieldName ( ) ) ; if ( empty ( $ this -> headers [ $ n ] ) ) { $ this -> headers [ $ n ] = [ [ ( string ) $ header -> getFieldName ( ) , trim ( $ header -> getFieldValue ( ) ) ] ]... | Add an HTTP header to the message . |
232,398 | public function removeHeader ( $ header ) { if ( $ header instanceof HttpHeaderInterface ) { unset ( $ this -> headers [ strtolower ( $ header -> getFieldName ( ) ) ] ) ; } else { unset ( $ this -> headers [ strtolower ( $ header ) ] ) ; } return $ this ; } | Remove all HTTP headers of the given type from the message . |
232,399 | public function getHeaders ( $ name = NULL ) { if ( $ name === NULL ) { return $ this -> headers ; } $ n = strtolower ( $ name ) ; if ( empty ( $ this -> headers [ $ n ] ) ) { return [ ] ; } $ headers = [ ] ; foreach ( $ this -> headers [ $ n ] as $ data ) { $ headers [ ] = $ data ; } return $ headers ; } | Get all HTTP headers of this message . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.