idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
18,000 | private function myCombine ( PathTraitInterface $ other , ? bool & $ isAbsolute = null , ? int & $ aboveBaseLevel = null , ? array & $ directoryParts = null , ? string & $ filename = null , ? string & $ error = null ) : bool { if ( $ other -> isAbsolute ( ) ) { $ isAbsolute = $ other -> isAbsolute ( ) ; $ aboveBaseLeve... | Tries to combine this path with another path . |
18,001 | private function myCombineDirectoryPart ( string $ part , ? int & $ aboveBaseLevel = null , ? array & $ directoryParts = null , ? string & $ error = null ) : bool { if ( $ part === '..' ) { if ( count ( $ directoryParts ) === 0 ) { if ( $ this -> myIsAbsolute ) { $ error = 'Absolute path is above root level.' ; return ... | Tries to combine a directory part with another path . |
18,002 | private function myParentDirectory ( ? int & $ aboveBaseLevel = null , ? array & $ directoryParts = null ) : bool { if ( count ( $ this -> myDirectoryParts ) > 0 ) { $ aboveBaseLevel = $ this -> myAboveBaseLevel ; $ directoryParts = array_slice ( $ this -> myDirectoryParts , 0 , - 1 ) ; return true ; } if ( $ this -> m... | Tries to calculate the parent directory for this path and return the result . |
18,003 | private static function myParse ( string $ directorySeparator , string $ path , callable $ partValidator , ? callable $ stringDecoder = null , ? bool & $ isAbsolute = null , ? int & $ aboveBaseLevel = null , ? array & $ directoryParts = null , ? string & $ filename = null , ? string & $ error = null ) : bool { $ parts ... | Tries to parse a path and returns the result or error text . |
18,004 | private static function myParsePart ( string $ part , bool $ isLastPart , callable $ partValidator , ? callable $ stringDecoder , ? bool $ isAbsolute , ? int & $ aboveBaseLevel , ? array & $ directoryParts = null , ? string & $ filename = null , ? string & $ error = null ) : bool { if ( $ part === '' || $ part === '.' ... | Tries to parse a part of a path and returns the result or error text . |
18,005 | private static function myHandleParentDirectoryPart ( bool $ isAbsolute , int & $ aboveBaseLevel , array & $ directoryParts , ? string & $ error = null ) : bool { if ( count ( $ directoryParts ) > 0 ) { array_pop ( $ directoryParts ) ; return true ; } if ( $ isAbsolute ) { $ error = 'Absolute path is above root level.'... | Handles a parent directory part . |
18,006 | private static function myHandleFilenamePart ( string $ part , callable $ partValidator , ? callable $ stringDecoder = null , ? string & $ filename = null , ? string & $ error = null ) : bool { if ( ! $ partValidator ( $ part , false , $ error ) ) { return false ; } if ( $ stringDecoder !== null ) { $ part = $ stringDe... | Handles the file name part . |
18,007 | private static function myHandleDirectoryPart ( string $ part , callable $ partValidator , ? callable $ stringDecoder = null , ? array & $ directoryParts , ? string & $ error = null ) : bool { if ( ! $ partValidator ( $ part , true , $ error ) ) { return false ; } if ( $ stringDecoder !== null ) { $ part = $ stringDeco... | Handles the directory part . |
18,008 | public function create ( $ inputs ) { $ record = $ this -> model -> create ( $ inputs ) ; $ record -> save ( ) ; return $ record ; } | create a new record |
18,009 | public function all ( $ limit = null ) { if ( $ limit ) { return $ this -> model -> limit ( $ limit ) -> get ( ) ; } return $ this -> model -> all ( ) ; } | get all records in database |
18,010 | public function allWith ( $ with , $ limit = null ) { if ( $ limit ) { return $ this -> model -> with ( $ with ) -> limit ( $ limit ) -> get ( ) ; } return $ this -> model -> with ( $ with ) -> get ( ) ; } | get all records in database with withs |
18,011 | public function getForUser ( $ user_id = null ) { if ( $ user_id ) { return $ this -> model -> whereUserId ( $ user_id ) -> get ( ) -> first ( ) -> toArray ( ) ; } if ( auth ( ) -> user ( ) ) { return $ this -> model -> whereUserId ( auth ( ) -> user ( ) -> id ) -> first ( ) -> toArray ( ) ; } return null ; } | get the columns for a users |
18,012 | public function where ( $ key , $ value = null ) { if ( $ value ) return $ this -> model -> where ( $ key , $ value ) ; if ( is_array ( $ key ) ) return $ this -> model -> where ( $ key ) ; return null ; } | try to simulate the where of Eloquent |
18,013 | public function getPaginatedAndOrdered ( ) { $ direction = request ( ) -> get ( 'direction' ) ; $ orderBy = request ( ) -> get ( 'orderby' ) ; $ p = config ( 'admin.paginate' ) ; if ( $ orderBy ) return $ this -> orderBy ( $ orderBy , $ direction ) -> paginate ( $ p ) ; return $ this -> paginate ( ) ; } | get a record paginated and ordered |
18,014 | public function update ( $ id , $ key , $ value = null ) { $ model = $ this -> model -> find ( $ id ) ; if ( is_array ( $ key ) ) $ model -> update ( $ key ) ; else $ model -> { $ key } = $ value ; $ model -> save ( ) ; } | update the status of the model |
18,015 | public function init ( ) { $ options = $ this -> getServiceLocator ( ) -> getServiceLocator ( ) -> get ( MailOptions :: class ) ; $ emailAddresses = $ options -> getAddressList ( ) ; $ addressList = [ ] ; foreach ( $ emailAddresses as $ transport => $ address ) { $ addressList [ ] = [ 'label' => $ address [ 'name' ] . ... | Set up value options |
18,016 | public function indexAction ( $ page , $ sort , $ direction ) { $ breadcumbs = $ this -> container -> get ( 'bacon_breadcrumbs' ) ; $ breadcumbs -> addItem ( array ( 'title' => 'Language' , 'route' => '' , ) ) ; $ breadcumbs -> addItem ( array ( 'title' => 'List' , 'route' => '' , ) ) ; $ entity = new Language ( ) ; $ ... | Lists all Language entities . |
18,017 | public function searchAction ( Request $ request ) { $ this -> get ( 'session' ) -> remove ( 'language_search_session' ) ; if ( $ request -> getMethod ( ) === Request :: METHOD_POST ) { $ form = $ this -> createForm ( new LanguageFormType ( ) , new Language ( ) , array ( 'search' => true , ) ) ; $ form -> handleRequest... | Search filter Language entities . |
18,018 | public function newAction ( ) { $ breadcumbs = $ this -> container -> get ( 'bacon_breadcrumbs' ) ; $ breadcumbs -> addItem ( array ( 'title' => 'Language' , 'route' => 'admin_language' , ) ) ; $ breadcumbs -> addItem ( array ( 'title' => 'New' , 'route' => '' , ) ) ; $ form = $ this -> createForm ( new LanguageFormTyp... | Displays a form to create a new Language entity . |
18,019 | public function createAction ( Request $ request ) { $ breadcumbs = $ this -> container -> get ( 'bacon_breadcrumbs' ) ; $ breadcumbs -> addItem ( array ( 'title' => 'Language' , 'route' => 'admin_language' , ) ) ; $ breadcumbs -> addItem ( array ( 'title' => 'New' , 'route' => '' , ) ) ; $ form = $ this -> createForm ... | Creates a new Language entity . |
18,020 | public function editAction ( $ id ) { $ breadcumbs = $ this -> container -> get ( 'bacon_breadcrumbs' ) ; $ breadcumbs -> addItem ( array ( 'title' => 'Language' , 'route' => 'admin_language' , ) ) ; $ breadcumbs -> addItem ( array ( 'title' => 'Edit' , 'route' => '' , ) ) ; $ entity = $ this -> getDoctrine ( ) -> getR... | Displays a form to edit an existing Language entity . |
18,021 | public function updateAction ( Request $ request , $ id ) { $ breadcumbs = $ this -> container -> get ( 'bacon_breadcrumbs' ) ; $ breadcumbs -> addItem ( array ( 'title' => 'Language' , 'route' => 'admin_language' , ) ) ; $ breadcumbs -> addItem ( array ( 'title' => 'Edit' , 'route' => '' , ) ) ; $ entity = $ this -> g... | Edits an existing Language entity . |
18,022 | public function showAction ( $ id ) { $ breadcumbs = $ this -> container -> get ( 'bacon_breadcrumbs' ) ; $ breadcumbs -> addItem ( array ( 'title' => 'Language' , 'route' => 'admin_language' , ) ) ; $ breadcumbs -> addItem ( array ( 'title' => 'Details' , 'route' => '' , ) ) ; $ entity = $ this -> getDoctrine ( ) -> g... | Finds and displays a Language entity . |
18,023 | public function deleteAction ( Request $ request , $ id ) { $ handler = new LanguageFormHandler ( $ this -> createDeleteForm ( ) , $ request , $ this -> get ( 'doctrine' ) -> getManager ( ) , $ this -> get ( 'session' ) -> getFlashBag ( ) ) ; $ entity = $ this -> getDoctrine ( ) -> getRepository ( 'BaconLanguageBundle:... | Deletes a Language entity . |
18,024 | protected static function get ( $ script , $ openTag ) { $ data = Strings :: splite ( $ script , $ openTag ) ; $ output = '' ; for ( $ i = 1 ; $ i < Collection :: count ( $ data ) ; $ i ++ ) { $ next = Strings :: splite ( $ data [ $ i ] , self :: $ endOpenTag ) ; $ rest = '' ; for ( $ j = 0 ; $ j < Collection :: count ... | Complie the opening tag . |
18,025 | public static function get ( $ file ) { $ type = str_replace ( 'image/' , NULL , Singleton :: class ( 'ZN\Helpers\Mime' ) -> type ( $ file ) ) ; return $ type === 'jpg' ? 'jpeg' : $ type ; } | Finder mime type . |
18,026 | protected function getRedirect ( ) : Redirect { $ context = Context :: getInstance ( ) ; $ redirect = new Redirect ( $ context -> getUrl ( $ context -> getParameter ( 'controller_path' ) ) ) ; return $ redirect ; } | Get an instance of the Redirect object that is setup with this controller as its base URL . |
18,027 | protected function getActionUrl ( $ action ) : string { $ context = Context :: getInstance ( ) ; return $ context -> getUrl ( $ context -> getParameter ( 'controller_path' ) . $ action ) ; } | Returns a URL to an action in this controller . |
18,028 | public static function hasStringKeys ( $ value , $ allowEmpty = false ) { if ( ! is_array ( $ value ) ) { return false ; } if ( ! $ value ) { return $ allowEmpty ; } return count ( array_filter ( array_keys ( $ value ) , 'is_string' ) ) > 0 ; } | Test whether an array contains one or more string keys |
18,029 | public static function hasIntegerKeys ( $ value , $ allowEmpty = false ) { if ( ! is_array ( $ value ) ) { return false ; } if ( ! $ value ) { return $ allowEmpty ; } return count ( array_filter ( array_keys ( $ value ) , 'is_int' ) ) > 0 ; } | Test whether an array contains one or more integer keys |
18,030 | public static function hasNumericKeys ( $ value , $ allowEmpty = false ) { if ( ! is_array ( $ value ) ) { return false ; } if ( ! $ value ) { return $ allowEmpty ; } return count ( array_filter ( array_keys ( $ value ) , 'is_numeric' ) ) > 0 ; } | Test whether an array contains one or more numeric keys . |
18,031 | public static function isList ( $ value , $ allowEmpty = false ) { if ( ! is_array ( $ value ) ) { return false ; } if ( ! $ value ) { return $ allowEmpty ; } return ( array_values ( $ value ) === $ value ) ; } | Test whether an array is a list |
18,032 | public static function isHashTable ( $ value , $ allowEmpty = false ) { if ( ! is_array ( $ value ) ) { return false ; } if ( ! $ value ) { return $ allowEmpty ; } return ( array_values ( $ value ) !== $ value ) ; } | Test whether an array is a hash table . |
18,033 | public static function inArray ( $ needle , array $ haystack , $ strict = false ) { if ( ! $ strict ) { if ( is_int ( $ needle ) || is_float ( $ needle ) ) { $ needle = ( string ) $ needle ; } if ( is_string ( $ needle ) ) { foreach ( $ haystack as & $ h ) { if ( is_int ( $ h ) || is_float ( $ h ) ) { $ h = ( string ) ... | Checks if a value exists in an array . |
18,034 | public static function iteratorToArray ( $ iterator , $ recursive = true ) { if ( ! is_array ( $ iterator ) && ! $ iterator instanceof Traversable ) { throw new Exception \ InvalidArgumentException ( __METHOD__ . ' expects an array or Traversable object' ) ; } if ( ! $ recursive ) { if ( is_array ( $ iterator ) ) { ret... | Convert an iterator to an array . |
18,035 | public static function filter ( array $ data , $ callback , $ flag = null ) { if ( ! is_callable ( $ callback ) ) { throw new Exception \ InvalidArgumentException ( sprintf ( 'Second parameter of %s must be callable' , __METHOD__ ) ) ; } if ( version_compare ( PHP_VERSION , '5.6.0' ) >= 0 ) { return array_filter ( $ da... | Compatibility Method for array_filter on <5 . 6 systems |
18,036 | public function TopMost ( ) { $ sql = Access :: SqlBuilder ( ) ; $ tblOption = RadioOption :: Schema ( ) -> Table ( ) ; $ where = $ sql -> Equals ( $ tblOption -> Field ( 'RadioField' ) , $ sql -> Value ( $ this -> radio -> GetID ( ) ) ) -> And_ ( $ sql -> IsNull ( $ tblOption -> Field ( 'Previous' ) ) ) ; return Radio... | Returns the top most option |
18,037 | public function ToArray ( ) { $ result = array ( ) ; $ option = $ this -> TopMost ( ) ; while ( $ option ) { $ result [ $ option -> GetValue ( ) ] = $ option -> GetText ( ) ; $ option = $ this -> NextOf ( $ option ) ; } return $ result ; } | Gets the radio options as array |
18,038 | public function toArray ( ) { return array ( 'id' => $ this -> getId ( ) , 'title' => $ this -> getTitle ( ) , 'class' => $ this -> getClass ( ) , 'iconCls' => $ this -> getIconClass ( ) , 'data' => $ this -> getData ( ) , 'settings' => $ this -> getSettings ( ) , ) ; } | Return array representation of this portlet . |
18,039 | public function get ( $ uri , array $ parameters = [ ] , array $ headers = [ ] , string $ protocol = '1.1' ) : ResponseInterface { $ promise = $ this -> getAsync ( $ uri , $ parameters , $ headers , $ protocol ) ; $ promise -> wait ( ) ; if ( $ promise -> getState ( ) === Promise :: REJECTED ) { throw $ promise -> getE... | Sends a GET request |
18,040 | public function getAsync ( $ uri , array $ parameters = [ ] , array $ headers = [ ] , string $ protocol = '1.1' ) : Promise { $ request = $ this -> createQueryRequest ( static :: METHOD_GET , $ uri , $ parameters , $ headers , $ protocol ) ; return $ this -> sendAsync ( $ request ) ; } | Sends a GET request asynchronously |
18,041 | public function postAsync ( $ uri , array $ parameters = [ ] , ? ContentType $ contentType = null , array $ headers = [ ] , string $ protocol = '1.1' ) : Promise { $ request = $ this -> createBodyRequest ( static :: METHOD_POST , $ uri , $ parameters , $ contentType , $ headers , $ protocol ) ; return $ this -> sendAsy... | Sends a POST request asynchronously |
18,042 | public function putAsync ( $ uri , array $ parameters = [ ] , ? ContentType $ contentType = null , array $ headers = [ ] , string $ protocol = '1.1' ) : Promise { $ request = $ this -> createBodyRequest ( static :: METHOD_PUT , $ uri , $ parameters , $ contentType , $ headers , $ protocol ) ; return $ this -> sendAsync... | Sends a PUT request asynchronously |
18,043 | public function patchAsync ( $ uri , array $ parameters = [ ] , ? ContentType $ contentType = null , array $ headers = [ ] , string $ protocol = '1.1' ) : Promise { $ request = $ this -> createBodyRequest ( static :: METHOD_PATCH , $ uri , $ parameters , $ contentType , $ headers , $ protocol ) ; return $ this -> sendA... | Sends a PATCH request asynchronously |
18,044 | public function deleteAsync ( $ uri , array $ parameters = [ ] , ? ContentType $ contentType = null , array $ headers = [ ] , string $ protocol = '1.1' ) : Promise { $ request = $ this -> createBodyRequest ( static :: METHOD_DELETE , $ uri , $ parameters , $ contentType , $ headers , $ protocol ) ; return $ this -> sen... | Sends a DELETE request asynchronously |
18,045 | protected function createQueryRequest ( string $ method , $ uri , array $ parameters = [ ] , array $ headers = [ ] , string $ protocol = '1.1' ) : RequestInterface { $ uri = $ this -> createUri ( $ uri ) ; if ( ! empty ( $ parameters ) ) { $ queryString = http_build_query ( $ parameters ) ; if ( $ uri -> getQuery ( ) =... | Creates a query request |
18,046 | protected function createBodyRequest ( string $ method , $ uri , array $ parameters = [ ] , ? ContentType $ contentType = null , array $ headers = [ ] , string $ protocol = '1.1' ) : RequestInterface { if ( $ contentType === null ) { $ contentType = ContentType :: fromValue ( ContentType :: FORM ) ; } $ body = null ; i... | Creates a body request |
18,047 | public static function initFromItemClass ( $ itemClass ) { $ itemMetaData = new ItemMetaData ( ) ; $ itemMetaData -> setItemClass ( $ itemClass ) ; $ contruct = new ReflectionMethod ( $ itemClass , '__construct' ) ; foreach ( $ contruct -> getParameters ( ) as $ key => $ param ) { $ itemMetaData -> setHitPosition ( $ p... | Initializes a new View instance that will hold the object - relational mapping of the class with the given name . |
18,048 | protected function validateAndCompleteEntity ( $ entityIdentifier , $ entityDefinition ) { if ( ! isset ( $ entityDefinition [ 'label' ] ) ) { throw MappingException :: requiredMapping ( $ this -> itemClass , 'label' , $ entityIdentifier ) ; } elseif ( ! settype ( $ entityDefinition [ 'label' ] , 'string' ) ) { throw M... | Validates & completes the given entity definition . |
18,049 | protected function validateAndCompleteHit ( $ hitIdentifier , array & $ hitDefinition ) { $ this -> addRequiredHit ( $ hitIdentifier ) ; if ( ! isset ( $ hitDefinition [ 'scoreFactor' ] ) ) { $ this -> setHitScoreFactor ( $ hitIdentifier , 1 ) ; } elseif ( ! settype ( $ hitDefinition [ 'scoreFactor' ] , 'integer' ) ) {... | Validates & completes the given hit definition . |
18,050 | public function getOrderedRequiredHits ( ) { $ hitIdentifiers = array ( ) ; foreach ( $ this -> requiredHits as $ hitIdentifier ) { $ hitIdentifiers [ $ this -> hitPositions [ $ hitIdentifier ] ] = $ hitIdentifier ; } krsort ( $ hitIdentifiers ) ; return $ hitIdentifiers ; } | Get required hits names ordered by item constructor positions |
18,051 | public function addRequiredHit ( $ hitIdentifier ) { if ( ! in_array ( $ hitIdentifier , $ this -> requiredHits ) ) { $ this -> requiredHits [ ] = $ hitIdentifier ; } return $ this ; } | Add Required Hit |
18,052 | public function addSortableHit ( $ hitIdentifier ) { if ( ! in_array ( $ hitIdentifier , $ this -> sortableHits ) ) { $ this -> sortableHits [ ] = $ hitIdentifier ; } return $ this ; } | Add sortable hit . |
18,053 | public function getHitEntityAttribute ( $ hitIdentifier , $ entityIdentifier ) { return isset ( $ this -> entityHitMapping [ $ entityIdentifier ] [ $ hitIdentifier ] ) ? $ this -> entityHitMapping [ $ entityIdentifier ] [ $ hitIdentifier ] : null ; } | Get hit entity attribute return null if there is no mapping for this hit |
18,054 | public function setHitEntityAttribute ( $ hitIdentifier , $ entityIdentifier , $ attribute ) { if ( ! array_key_exists ( $ entityIdentifier , $ this -> entityClasses ) ) { throw MappingException :: invalidEntity ( $ this -> itemClass , $ entityIdentifier ) ; } $ this -> entityHitMapping [ $ entityIdentifier ] [ $ hitId... | Set hit entity attribute |
18,055 | public function getFunctions ( ) { return array ( 'mesd_jasper_reportviewer_stored_report_link' => new \ Twig_Function_Method ( $ this , 'renderStoredReportLink' , array ( 'is_safe' => array ( 'html' ) ) ) , 'mesd_jasper_reportviewer_report_link' => new \ Twig_Function_Method ( $ this , 'renderReportLink' , array ( 'is... | Get functions lists the functions in this class |
18,056 | public function renderReportHome ( $ linkText , $ classes = ' ' , $ openInNewTab = true ) { return $ this -> environment -> render ( 'MesdJasperReportViewerBundle:Partials:reportHome.html.twig' , array ( 'linkText' => $ linkText , 'classes' => $ classes , 'openInNewTab' => $ openInNewTab ) ) ; } | Render a link to the report viewer home |
18,057 | public function renderReportLink ( $ reportUri , $ linkText , $ classes = ' ' , $ openInNewTab = true , $ hideHome = true ) { return $ this -> environment -> render ( 'MesdJasperReportViewerBundle:Partials:reportLink.html.twig' , array ( 'reportUri' => $ reportUri , 'linkText' => $ linkText , 'classes' => $ classes , '... | Renders a link to a report |
18,058 | public function renderStoredReportLink ( $ reportUri , $ requestId , $ linkText , $ classes = ' ' , $ openInNewTab = true , $ hideHome = true ) { return $ this -> environment -> render ( 'MesdJasperReportViewerBundle:Partials:storedReportLink.html.twig' , array ( 'reportUri' => $ reportUri , 'requestId' => $ requestId ... | Renders a link to a stored report |
18,059 | public function renderDirectReportLink ( ReportInstance $ reportInstance , $ linkText , $ classes = ' ' , $ openInNewTab = true , $ hideHome = true ) { return $ this -> environment -> render ( 'MesdJasperReportViewerBundle:Partials:directReportLink.html.twig' , array ( 'reportUri' => $ reportInstance -> getReportUri ( ... | Renders a report immediately in the viewer with the parameters from the report instance object |
18,060 | public static function createFromLock ( string $ name , array $ packageData ) : PackageContract { $ keyToFunctionMappers = [ 'parent' => 'setParentName' , 'is-dev' => 'setIsDev' , 'url' => 'setUrl' , 'operation' => 'setOperation' , 'type' => 'setType' , 'requires' => 'setRequires' , 'automatic-extra' => 'setConfig' , '... | Create a automatic package from the lock data . |
18,061 | public function getRunner ( ) { if ( $ this -> runner ) return $ this -> runner ; $ runner = new Runner \ PHPSpecRunner ( ) ; $ this -> application -> getContainer ( ) -> injectDependency ( $ runner ) ; $ runner -> initialize ( ) ; return $ this -> runner = $ runner ; } | get runner . |
18,062 | protected function renderAttributes ( ) { $ output = '' ; foreach ( $ this -> _attr as $ key => $ value ) { $ output .= $ key . ' = "' . $ value . '" ' ; } return $ output ; } | Renders the attribute string for the element . |
18,063 | public function getAttribute ( $ key ) { return isset ( $ this -> _attr [ $ key ] ) ? $ this -> _attr [ $ key ] : null ; } | Returns the requested attribute if it exists . |
18,064 | public function isPipe ( ) { if ( \ is_null ( $ this -> isPipe ) ) { $ this -> isPipe = false ; if ( $ this -> isAttached ( ) ) { $ mode = fstat ( $ this -> stream ) [ 'mode' ] ; $ this -> isPipe = ( $ mode & 0010000 ) !== 0 ; } } return $ this -> isPipe ; } | Is the stream is a pipe? |
18,065 | public function enableAutofocus ( ) { static $ enabled = false ; if ( ! $ enabled ) { $ script = "$(document).ready(function(){" . "\$(this).find('[autofocus]:first').focus();" . "});" ; $ this -> registerScript ( $ script ) ; $ enabled = true ; } return $ this ; } | Activate focus on elements with the attribute autofocus |
18,066 | public static function to ( $ path , array $ data = null ) { ( $ data !== null ) ? self :: with ( $ data ) : '' ; $ path = ( self :: $ query_string === null ) ? Url :: link ( $ path ) : Url :: link ( $ path ) . '?' . self :: $ query_string ; header ( 'Location: ' . $ path ) ; exit ( ) ; } | This method redirect to the specified page |
18,067 | public function do ( String $ app = NULL , $ key , String $ data = NULL ) : Bool { return ( new Insert ) -> do ( $ app , $ key , $ data ) ; } | Updates language key |
18,068 | public function vlanTypes ( $ translate = false ) { $ states = $ this -> getSNMP ( ) -> walk1d ( self :: OID_VLAN_MEMBERSHIP_VLAN_TYPE ) ; if ( ! $ translate ) { return $ states ; } return $ this -> getSNMP ( ) -> translate ( $ states , self :: $ VLAN_MEMBERSHIP_VLAN_TYPES ) ; } | Get an array of the type of VLAN membership of each device port . |
18,069 | public function portStatus ( $ translate = false ) { $ states = $ this -> getSNMP ( ) -> walk1d ( self :: OID_VLAN_MEMBERSHIP_PORT_STATUS ) ; if ( ! $ translate ) { return $ states ; } return $ this -> getSNMP ( ) -> translate ( $ states , self :: $ VLAN_MEMBERSHIP_PORT_STATUS ) ; } | Get an array of the current status of VLAN in each device port . |
18,070 | private function getSubtree ( TreeExpression $ expr ) { foreach ( $ expr -> getChildren ( ) as $ child ) { if ( $ child -> getType ( ) == $ this -> operator ) return $ child ; } $ expr -> addChild ( $ subtree = new TreeExpression ( $ this -> operator ) ) ; return $ subtree ; } | Retrieve or create the first subtree that matches with the operator |
18,071 | public static function filterThemesBootstrap ( $ themesRootPath = 'themes' , $ bootstrapPathFile = 'src\\Bootstrap' , $ bootstrapPathPattern = '{theme-path}\\{bootstrap-path-file}' ) { if ( static :: $ _themeBootstraps === null ) { static :: $ _themeBootstraps = static :: findThemeBootstraps ( $ themesRootPath , $ boot... | Filters bootstraps in themes folder . |
18,072 | public static function findThemeBootstraps ( $ themesRootPath , $ bootstrapPathFile , $ bootstrapPathPattern ) { $ dir = Yii :: getAlias ( '@' . $ themesRootPath ) ; if ( ! is_dir ( $ dir ) ) { throw new InvalidParamException ( "The dir argument must be a directory: $dir" ) ; } $ dir = rtrim ( $ dir , DIRECTORY_SEPARAT... | Finds all Bootstrap class files in the given themes root path . |
18,073 | public function guessFromCurrent ( ) { $ this -> setUrl ( UrlHelper :: getRequestUrl ( ) ) -> setProtocol ( UrlHelper :: getHttpProtocol ( ) ) -> setMethod ( $ _SERVER [ 'REQUEST_METHOD' ] ) -> setHeaders ( $ this -> getallheaders ( ) ) -> setArguments ( isset ( $ _GET ) ? $ _GET : array ( ) ) -> setData ( isset ( $ _P... | Populate the request object with current HTTP request values |
18,074 | protected function _extractSegments ( & $ arguments ) { if ( is_string ( $ arguments ) ) $ this -> _extractArguments ( $ arguments ) ; foreach ( $ arguments as $ var => $ val ) { if ( empty ( $ val ) && strpos ( $ var , '/' ) !== false ) { $ parts = explode ( '/' , $ var ) ; unset ( $ arguments [ $ var ] ) ; $ index = ... | Extract the table of var = > val arguments pairs from a slashed route |
18,075 | public static function cleanArgument ( $ arg_value , $ flags = ENT_COMPAT , $ encoding = 'UTF-8' ) { if ( is_string ( $ arg_value ) ) { $ result = stripslashes ( htmlspecialchars ( $ arg_value , ENT_COMPAT , $ encoding ) ) ; } elseif ( is_array ( $ arg_value ) ) { $ result = array ( ) ; foreach ( $ arg_value as $ arg =... | Clean the value taken from request arguments or data |
18,076 | public function find_all_files ( $ dir ) { $ root = array_reverse ( scandir ( $ dir ) ) ; if ( count ( $ root ) == 0 ) return ; foreach ( $ root as $ value ) { if ( $ value === '.' || $ value === '..' ) { continue ; } if ( is_file ( "$dir/$value" ) ) { $ result [ ] = "$dir/$value" ; $ this -> posts [ ] = $ this -> read... | Find All file on asset dir and create array of Model \ Post |
18,077 | public function defineAuthor ( $ header ) { $ author = $ this -> config [ 'authors' ] [ $ header [ 'author' ] ] ; return new Author ( $ header [ 'author' ] , $ author [ 'name' ] , $ author [ 'email' ] , $ author [ 'signature' ] , $ author [ 'facebook' ] , $ author [ 'twitter' ] , $ author [ 'github' ] ) ; } | Create new Author object instance for Post object |
18,078 | public function defineCategories ( $ header ) { $ categories = array ( ) ; $ cats = explode ( ',' , $ header [ 'categories' ] ) ; foreach ( $ cats as $ category ) { $ categories [ ] = new Category ( trim ( $ category ) ) ; } return $ categories ; } | Create a list of category from header metadata |
18,079 | public function run ( ) { try { $ request = $ this -> getLoops ( ) -> getService ( "request" ) ; $ response = $ this -> getLoops ( ) -> getService ( "response" ) ; $ web_core = $ this -> getLoops ( ) -> getService ( "web_core" ) ; echo $ web_core -> dispatch ( $ this -> url , $ request , $ response ) ; } catch ( Throwa... | Runs the request by by dispaching the request via the web core service . This method will print the resulting output and set http status codes accordingly . Exceptions will be caught and rendered . |
18,080 | public static function encode ( $ string , $ oneLine = true ) { if ( ! self :: isEncoded ( $ string ) ) { $ string = base64_encode ( $ string ) ; } if ( $ string && $ oneLine ) { $ string = str_replace ( [ "\r" , "\n" ] , '' , $ string ) ; } return $ string ; } | Encodes the specified string as Base64 . Note that a previously - encoded string will not be re - encoded . |
18,081 | protected function throwNewInvalidArgumentException ( $ errorMsg ) { $ selfClass = version_compare ( PHP_VERSION , '5.5' , '>' ) ? self :: class : __CLASS__ ; $ str = '[' . $ selfClass . '] ' . $ errorMsg . ' (' . 'form id: `' . $ this -> id . '`, ' . 'form type: `' . get_class ( $ this -> form ) . '`' . ')' ; throw ne... | Throw new \ InvalidArgumentException with given error message and append automatically current class name current form id and form class type . |
18,082 | public function PreDispatch ( ) { if ( $ this -> dispatchState > 1 ) return $ this ; parent :: PreDispatch ( ) ; foreach ( $ this -> fields as $ field ) $ field -> PreDispatch ( ) ; $ session = & $ this -> getSession ( ) ; foreach ( $ session -> errors as $ errorMsgAndFieldNames ) { list ( $ errorMsg , $ fieldNames ) =... | Prepare form and it s fields for rendering . |
18,083 | public function onBeforeNormalization ( BeforeNormalizationEvent $ event ) : void { $ resource = $ event -> getResource ( ) ; if ( ! $ resource instanceof RelatedResourceInterface ) { return ; } $ relations = $ resource -> getRelations ( ) ; foreach ( $ relations as $ relation ) { if ( ! $ relation instanceof SymfonyGr... | Check the grants to relations |
18,084 | public function addGroup ( Group $ group ) { if ( $ this -> hasGroup ( $ group ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Group "%s" is allready defined.' , $ group -> getName ( ) ) ) ; } $ this -> groups [ $ group -> getName ( ) ] = $ group ; return $ this ; } | Adds the group . |
18,085 | public function getGroupByName ( $ name ) { if ( ! array_key_exists ( $ name , $ this -> groups ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Can\'t find "%s" group.' , $ name ) ) ; } return $ this -> groups [ $ name ] ; } | Returns a group by his name . |
18,086 | public function getDefinitionByIdentifier ( $ identifier ) { foreach ( $ this -> groups as $ group ) { foreach ( $ group -> getDefinitions ( ) as $ definition ) { if ( $ definition -> getIdentifier ( ) === $ identifier ) { return $ definition ; } } } return null ; } | Returns a characteristic definition by his identifier . |
18,087 | protected function convertValue ( $ data ) { if ( $ this -> isTraversable ( $ data ) ) { return $ this -> recursiveConvertArray ( $ data ) ; } if ( is_object ( $ data ) ) { return $ this -> convertObject ( $ data ) ? : null ; } return $ data ; } | Conversts a given value into a traversable one . |
18,088 | protected function recursiveConvertArray ( $ data ) { $ out = [ ] ; foreach ( $ data as $ key => $ value ) { $ nkey = $ this -> normalize ( $ key ) ; if ( in_array ( $ nkey , $ this -> ignoredAttributes ) ) { continue ; } $ out [ $ nkey ] = is_scalar ( $ value ) ? $ value : $ this -> convertValue ( $ value ) ; } return... | Recursivly converts a given value to an array . |
18,089 | protected function setObjectProperties ( array $ properties , $ data , array & $ out = [ ] ) { foreach ( $ properties as $ property ) { $ prop = $ property -> getName ( ) ; if ( in_array ( $ name = $ this -> normalize ( $ prop ) , $ this -> ignoredAttributes ) ) { continue ; } $ out [ $ prop ] = $ this -> getObjectProp... | Set opbject properties to an output array . |
18,090 | public static function dateSQL ( $ date , $ format = 'd-m-Y' ) { if ( empty ( $ date ) ) { return null ; } $ obj = DateTime :: createFromFormat ( 'Y-m-d H:i:s' , $ date ) ; if ( empty ( $ obj ) ) { return null ; } return $ obj -> format ( $ format ) ; } | SQL timestamp to date format |
18,091 | public static function random ( $ len = 6 ) { $ chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' ; $ random = '' ; for ( $ p = 0 ; $ p < $ len ; $ p ++ ) { $ random .= $ chars [ mt_rand ( 0 , 61 ) ] ; } return $ random ; } | Get random string |
18,092 | public static function lowerLabel ( $ value , array $ labels ) { ksort ( $ labels ) ; foreach ( $ labels as $ max => $ label ) { if ( $ value <= $ max ) { return $ label ; } } return end ( $ labels ) ; } | Get label that key is lower than value |
18,093 | public static function majorVersion ( $ version ) { $ components = explode ( '.' , $ version ) ; foreach ( $ components as $ key => $ value ) { if ( $ key > 0 && is_numeric ( $ value ) ) { $ components [ $ key ] = '0' ; } } return implode ( '.' , $ components ) ; } | Get major version |
18,094 | public function setDisplayer ( DisplayerInterface $ displayer ) { $ this -> displayer = $ displayer ; if ( ! isset ( $ this -> exceptionHandler ) ) return ; $ this -> exceptionHandler -> setDisplayer ( $ displayer ) ; } | Set the exception displayer |
18,095 | protected function registerExceptionHandler ( ) { $ this -> exceptionHandler = ExceptionHandler :: register ( true ) ; $ this -> exceptionHandler -> setDisplayer ( $ this -> displayer ) ; } | Register the Symfony exception handler |
18,096 | public function add ( ResourceAssemblerSupportableInterface $ supportable , ResourceAssemblerInterface $ assembler ) : void { $ this -> map [ ] = [ $ supportable , $ assembler ] ; } | Add the resource assembler to registry |
18,097 | public function setProperty ( $ key , $ value = null ) { if ( $ key instanceof Property ) { $ value = $ key ; $ key = $ key -> getName ( ) ; } elseif ( ! $ value instanceof Property ) { $ value = new Property ( $ key , $ value ) ; } foreach ( $ this -> properties as $ index => $ property ) { if ( $ property -> getName ... | Appending a property at the end and cleaning up any property with the same name |
18,098 | public function getProperty ( $ key , & $ match = false ) { if ( is_array ( $ key ) ) { foreach ( array_reverse ( $ this -> properties ) as $ property ) { if ( in_array ( $ property -> getName ( ) , $ key ) ) { $ match = $ property -> getName ( ) ; return $ property ; } } } else { foreach ( array_reverse ( $ this -> pr... | Return the property if it is within this set otherwise retuns false |
18,099 | protected function getHttpApplication ( ServiceLocatorInterface $ serviceLocator ) : HttpApplication { $ chain = $ serviceLocator -> getService ( MiddlewareChainInterface :: class ) ; $ request = $ serviceLocator -> getService ( RequestInterface :: class ) ; return new HttpApplication ( $ chain , $ request , $ serviceL... | Get HTTP application . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.