idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
15,800 | public function first ( ) { $ this -> getIterator ( ) -> rewind ( ) ; return $ this -> getIterator ( ) -> count ( ) ? $ this -> getIterator ( ) -> current ( ) : false ; } | Gets the first item from the collection . |
15,801 | public function getPhotoEmail ( ) { $ email = false ; $ emailType = Yii :: $ app -> collectors [ 'types' ] -> getOne ( 'EmailAddress' ) ; if ( empty ( $ emailType -> object ) ) { return false ; } foreach ( $ this -> children ( $ emailType -> object -> primaryModel , [ 'where' => [ 'primary_child' => 1 ] ] ) as $ child ... | Get photo email . |
15,802 | public static function loadSimpleXML ( $ xml_file , $ verify_dtd = true ) { $ options = ( $ verify_dtd ? LIBXML_DTDVALID : null ) ; libxml_clear_errors ( ) ; $ SimpleXML = @ simplexml_load_file ( $ xml_file , null , $ options ) ; $ LibXMLError = libxml_get_last_error ( ) ; if ( $ SimpleXML === false || $ LibXMLError in... | Load and verify an XML - file using SimpleXML . |
15,803 | public static function Gst00a ( $ uta , $ utb , $ tta , $ ttb ) { $ gmst00 ; $ ee00a ; $ gst ; $ gmst00 = IAU :: Gmst00 ( $ uta , $ utb , $ tta , $ ttb ) ; $ ee00a = IAU :: Ee00a ( $ tta , $ ttb ) ; $ gst = IAU :: Anp ( $ gmst00 + $ ee00a ) ; return $ gst ; } | - - - - - - - - - - i a u G s t 0 0 a - - - - - - - - - - |
15,804 | public function addPermission ( $ permission ) { if ( is_array ( $ permission ) || $ permission instanceof \ Traversable ) return $ this -> addMultiplePermissions ( $ permission ) ; else return $ this -> addSinglePermission ( $ permission ) ; } | Add a permission to the role . The argument can be the permission name ID Permission object or an array of the previous |
15,805 | public function addSinglePermission ( $ permission ) { if ( is_string ( $ permission ) ) return $ this -> addPermissionByName ( $ permission ) ; elseif ( is_numeric ( $ permission ) ) return $ this -> addPermissionById ( $ permission ) ; elseif ( $ permission instanceof BridgePermission ) return $ this -> addPermission... | Add a single permission . The argument is a string integer or instance of BridgePermission |
15,806 | public function addPermissionByName ( $ permission_name ) { $ permission = static :: $ app [ 'db' ] -> connection ( ) -> table ( 'permissions' ) -> where ( 'name' , '=' , $ permission_name ) -> first ( ) ; if ( ! $ permission ) return new \ RuntimeException ( 'No permission with that name found.' ) ; if ( is_array ( $ ... | Add a single permission to the role by name |
15,807 | public function addPermissionByObject ( BridgePermission $ permission_obj ) { if ( ! $ permission_obj -> exists ) $ permission_obj -> save ( ) ; $ permission_id = $ permission_obj -> getKey ( ) ; return $ this -> addPermissionById ( $ permission_id ) ; } | Add a single permission to the role by using the Permission object |
15,808 | public function hasPermission ( $ permission ) { $ permissions = $ this -> permissions ; foreach ( $ permissions as $ permission_obj ) if ( $ this -> checkPermission ( $ permission , $ permission_obj ) ) return true ; return false ; } | Checks to see if a role has a certain permission |
15,809 | public function checkPermission ( $ check , BridgePermission $ has ) { if ( is_string ( $ check ) ) return $ this -> checkPermissionByName ( $ check , $ has ) ; elseif ( is_numeric ( $ check ) ) return $ this -> checkPermissionById ( $ check , $ has ) ; elseif ( $ check instanceof BridgePermission ) return $ this -> ch... | Checks to see if a given permission is equal to a permission the user already has |
15,810 | public function checkPermissionByObject ( BridgePermission $ check , BridgePermission $ has ) { return $ this -> checkPermissionById ( $ check -> id , $ has ) ; } | Check to see if the Permission provided is the same as the BridgePermission object passed in |
15,811 | public function query ( $ statement , $ fetchMode = null , $ modeArg = null , array $ ctorArgs = array ( ) ) { $ stmt = $ this -> prepare ( $ statement ) ; $ stmt -> execute ( ) ; if ( $ fetchMode ) { $ stmt -> setFetchMode ( $ fetchMode , $ modeArg , $ ctorArgs ) ; } return $ stmt ; } | Executes an SQL statement returning the results as a Vincent \ Pdo \ Oci8 \ Statement object . |
15,812 | public function constructInnerJoinSql ( Table $ fromTable , $ usingThrough = false , $ alias = null ) { if ( $ usingThrough ) { $ joinTable = $ fromTable ; $ joinTableName = $ fromTable -> getFullyQualifiedTableName ( ) ; $ fromTableName = Table :: load ( $ this -> className ) -> getFullyQualifiedTableName ( ) ; } else... | Creates INNER JOIN SQL for associations . |
15,813 | private function getForeignKeyForNewAssociation ( Model $ model ) { $ this -> setKeys ( $ model ) ; $ primaryKey = Inflector :: instance ( ) -> variablize ( $ this -> foreignKey [ 0 ] ) ; return array ( $ primaryKey => $ model -> id , ) ; } | Get an array containing the key and value of the foreign key for the association |
15,814 | private function getInstance ( ) { if ( is_null ( $ this -> instance ) ) { $ this -> instance = \ RegexGuard \ Factory :: getGuard ( ) ; } return $ this -> instance ; } | Returns an instance of the library |
15,815 | public function match ( $ pattern , $ subject ) { if ( ! $ this -> validate ( $ pattern ) ) { return false ; } return $ this -> getInstance ( ) -> match ( $ pattern , $ subject ) ; } | Matches a regular expression |
15,816 | private function getWords ( string $ template ) : array { $ flags = PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY ; return ( array ) preg_split ( self :: WORD_DELIMITER , $ template , - 1 , $ flags ) ; } | Devuelve una lista con las palabras que componen la linea |
15,817 | private function getTokens ( string $ word ) : array { $ flags = PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY ; return ( array ) preg_split ( self :: TOKEN_DELIMITER , $ word , - 1 , $ flags ) ; } | Devuelve los tokens que componen una palabra |
15,818 | public function parse ( callable $ callback , int $ width ) : string { $ tokens = [ ] ; foreach ( $ this as $ token ) { $ token -> setLineWidth ( $ width ) ; $ tokens [ ] = call_user_func ( $ callback , $ token ) ; } return implode ( '' , $ tokens ) ; } | Devuelve esta linea en forma de string usando un callback para resolver cada token |
15,819 | public function getWidth ( ) : int { $ total = 0 ; foreach ( $ this as $ token ) { $ total += $ token -> width ( ) ; } return $ total ; } | Devuelve el ancho del linea |
15,820 | public function handle ( UploadedFile $ uploadedFile , $ folderId , $ userId ) { $ uploadFileSource = new UploadedFileSource ( $ uploadedFile ) ; $ volume = $ this -> volumeManager -> getByFolderId ( $ folderId ) ; $ folder = $ volume -> findFolder ( $ folderId ) ; $ file = $ volume -> findFileByPath ( $ folder -> getP... | Handle upload . |
15,821 | public function getVisits ( $ items ) { $ result = [ ] ; foreach ( $ items as $ item ) { $ result [ ] = new Visit ( $ item ) ; } return $ result ; } | Returns array of visits . |
15,822 | protected function loadModule ( ) : void { $ fqn = $ this -> getFullyQualifiedClass ( $ this -> response -> getModule ( ) , $ this -> response -> getController ( ) ) ; $ the_module = new $ fqn ( ) ; call_user_func_array ( array ( $ the_module , $ this -> getActionMethodName ( $ this -> response -> getAction ( ) ) ) , [... | Load a module as requested and mapped by the router . |
15,823 | protected function loadErrorModule ( ) : void { $ fqn = $ this -> getFullyQualifiedClass ( 'index' , 'index' ) ; $ the_module = new $ fqn ( ) ; $ action = $ this -> getActionMethodName ( ( string ) $ this -> response -> getStatusCode ( ) ) ; if ( method_exists ( $ fqn , $ action ) ) { call_user_func_array ( array ( $ t... | Load an error module based on the error code . |
15,824 | protected function getFullyQualifiedClass ( string $ module_name , string $ controller_class ) : string { return 'Application\\Module\\' . $ this -> getModuleName ( $ module_name ) . '\\Controller\\' . $ this -> getControllerName ( $ controller_class ) ; } | Get the fully qualified class name of the controller . |
15,825 | protected function getConnection ( $ nameDB = NULL ) { if ( self :: $ config_db == NULL ) { self :: $ config_db = $ this -> context -> readConfigurationFile ( $ this -> configFile ) ; } if ( $ nameDB == NULL ) $ nameDB = self :: $ config_db [ 'actual-db' ] ; $ cbd = self :: $ config_db [ $ nameDB ] ; $ this -> currentD... | Abre una conexion en base a la configuracion de la BD |
15,826 | protected function catchError ( $ error ) { if ( $ this -> connection -> inTransaction ( ) ) { $ this -> errorTran [ ] = $ error ; $ this -> stateTran = FALSE ; } $ this -> lastError = $ error ; } | Almacena los errores |
15,827 | public function connect ( $ nameDB = NULL , $ configFile = NULL ) { if ( $ configFile != NULL ) { $ this -> configFile = $ configFile ; self :: $ config_db = NULL ; } $ this -> connection = $ this -> getConnection ( $ nameDB ) ; } | Realiza la conexion a la base indicada o por defecto |
15,828 | public function select ( $ select , $ distinct = FALSE ) { if ( $ distinct ) { $ this -> select = 'DISTINCT ' ; } else { $ this -> select = '' ; } $ this -> select .= $ select ; } | Arma el Select de la consulta |
15,829 | public function where ( $ conditions , array $ values ) { if ( $ this -> where != '' ) { $ this -> where .= 'AND ' ; } $ this -> where .= $ conditions . ' ' ; $ this -> where_values = array_merge ( $ this -> where_values , $ values ) ; } | Arma el where de la consulta |
15,830 | public function where_like ( $ field , $ match , $ joker = 'both' , $ not = FALSE ) { if ( $ this -> where != '' ) { $ this -> where .= 'AND ' ; } $ this -> like ( $ field , $ match , $ joker , $ not ) ; } | Arma el where like de la consutla |
15,831 | protected function like ( $ field , $ match , $ joker = 'both' , $ not = FALSE ) { $ this -> where .= $ field . ' ' ; if ( $ not ) { $ this -> where .= 'NOT ' ; } $ this -> where .= 'LIKE ' ; switch ( $ joker ) { case 'both' : $ this -> where .= "'%$match%' " ; break ; case 'after' : $ this -> where .= "'$match%' " ; b... | Arma el Like para el where and o or |
15,832 | public function where_in ( $ field , array $ values , $ not = FALSE ) { if ( $ this -> where != '' ) { $ this -> where .= 'AND ' ; } $ this -> in ( $ field , $ values , $ not ) ; } | Arma el where in de la consulta |
15,833 | public function or_where_in ( $ field , array $ values , $ not = FALSE ) { if ( $ this -> where != '' ) { $ this -> where .= 'OR ' ; } $ this -> in ( $ field , $ values , $ not ) ; } | Arma el where in con or de la consulta |
15,834 | protected function in ( $ field , array $ values , $ not = FALSE ) { $ this -> where .= $ field . ' ' ; if ( $ not ) { $ this -> where .= 'NOT ' ; } $ this -> where .= 'IN (' ; foreach ( $ values as $ value ) { $ this -> where .= "'$value'," ; } $ this -> where = rtrim ( $ this -> where , ',' ) ; $ this -> where .= ') ... | Arma el in para el where and o or |
15,835 | public function group ( $ group ) { if ( is_array ( $ group ) ) { $ this -> group = 'GROUP BY ' ; foreach ( $ group as $ value ) { $ this -> group .= $ value . ',' ; } $ this -> group = rtrim ( $ this -> group , ',' ) ; $ this -> group .= ' ' ; } else { $ this -> group = 'GROUP BY ' . $ group . ' ' ; } } | Arma el group de la consulta |
15,836 | public function having ( $ conditions , array $ values ) { if ( $ this -> having != '' ) { $ this -> having .= 'AND ' ; } $ this -> having .= $ conditions . ' ' ; $ this -> where_values = array_merge ( $ this -> where_values , $ values ) ; } | Arma el having de la consulta |
15,837 | public function get ( ) { $ res = FALSE ; try { $ query = $ this -> prepareSelect ( $ this -> select , $ this -> from , $ this -> where , $ this -> group , $ this -> having , $ this -> order , $ this -> limit ) ; $ query -> execute ( $ this -> where_values ) ; if ( $ this -> isOk ( $ query ) ) { $ res = $ query ; } $ t... | Devuelve el resultado de la consulta armada de forma ActiveRecord |
15,838 | public function getFromWhere ( $ from , $ where = NULL , $ where_values = array ( ) , $ order = NULL , $ limit = NULL , $ offset = NULL ) { $ res = FALSE ; try { if ( $ order != NULL ) { $ order = " ORDER BY " . $ order ; } if ( $ limit != NULL ) { $ limit = " LIMIT " . $ limit ; if ( $ offset != NULL ) { $ limit .= ' ... | Devuelve el resultado de la consulta armada en base a los parametros |
15,839 | public function insert ( $ table , array $ values ) { try { $ query = $ this -> prepareInsert ( $ table , $ values ) ; $ query -> execute ( $ values ) ; return $ this -> isOk ( $ query ) ; } catch ( \ PDOException $ e ) { throw $ e ; } } | Inserta en una tabla los valores indicados |
15,840 | public function insertMany ( $ table , array $ manyValues ) { try { reset ( $ manyValues ) ; if ( current ( $ manyValues ) != FALSE ) { $ query = $ this -> prepareInsert ( $ table , $ manyValues [ 0 ] ) ; } $ ok = true ; while ( current ( $ manyValues ) != FALSE && $ ok ) { $ query -> execute ( current ( $ manyValues )... | Inserta en una tabla un conjunto de valores indicados . Cada elemento del vector guardado debe tener la misma estructura |
15,841 | public function update ( $ table , array $ values ) { $ res = FALSE ; try { $ query = $ this -> prepareUpdate ( $ table , $ values , $ this -> where ) ; $ values = array_merge ( $ values , $ this -> where_values ) ; $ query -> execute ( $ values ) ; $ res = $ this -> isOk ( $ query ) ; $ this -> cleanVars ( ) ; } catch... | Actualiza una tabla en base a los datos indicados y la consulta armada al estilo Active Record |
15,842 | public function delete ( $ table ) { $ res = FALSE ; try { $ query = $ this -> prepareDelete ( $ table , $ this -> where ) ; $ query -> execute ( $ this -> where_values ) ; $ res = $ this -> isOk ( $ query ) ; $ this -> cleanVars ( ) ; } catch ( \ PDOException $ e ) { $ this -> cleanVars ( ) ; throw $ e ; } return $ re... | Elimina tuplas de una tabla en base a la consulta armada de la forma Active Record |
15,843 | protected function isOk ( \ PDOStatement $ query ) { $ error = $ query -> errorInfo ( ) ; if ( $ error [ 0 ] == '00000' ) { return TRUE ; } else { $ this -> catchError ( $ error ) ; return FALSE ; } } | Retorna si la consulta se realizao con exito si no ocurrio ningun error . |
15,844 | protected function cleanVars ( ) { $ this -> select = "*" ; $ this -> from = '' ; $ this -> where = '' ; $ this -> where_values = array ( ) ; $ this -> group = '' ; $ this -> having = '' ; $ this -> order = '' ; $ this -> limit = '' ; } | Limpia las variables de instancia del ActiveRecord |
15,845 | protected function prepareSelect ( $ select , $ from , $ where = '' , $ group = '' , $ having = '' , $ order = '' , $ limit = '' ) { $ sql = "SELECT " . $ select ; $ sql .= " FROM " . $ from ; if ( $ where != '' && $ where != NULL ) { $ sql .= " WHERE " . $ where ; } $ sql .= $ group ; if ( $ having != '' && $ having !... | Retorna un PDOStatement SELECT armado en base a los parametros pasados |
15,846 | protected function prepareInsert ( $ table , $ values ) { $ sql = 'INSERT INTO ' . $ table . ' (' ; $ value = 'values(' ; foreach ( $ values as $ key => $ val ) { $ sql .= $ key . ',' ; $ value .= ':' . $ key . ',' ; } $ sql = trim ( $ sql , ',' ) ; $ value = trim ( $ value , ',' ) ; $ sql .= ') ' . $ value . ')' ; ret... | Retorna un PDOStatement INSERT armado en base a los parametros pasados |
15,847 | protected function prepareUpdate ( $ table , $ values , $ where ) { $ sql = 'UPDATE ' . $ table . ' SET ' ; foreach ( $ values as $ key => $ value ) { $ sql .= $ key . '=:' . $ key . ',' ; } $ sql = trim ( $ sql , ',' ) ; if ( $ where != '' ) { $ sql .= " WHERE " . $ where ; } return $ this -> connection -> prepare ( $... | Retorna un PDOStatement UPDATE armado en base a los parametros pasados |
15,848 | protected function prepareDelete ( $ table , $ where ) { $ sql = 'DELETE FROM ' . $ table . ' ' ; if ( $ where != '' ) { $ sql .= " WHERE " . $ where ; } return $ this -> connection -> prepare ( $ sql ) ; } | Retorna un PDOStatement DELETE armado en base a los parametros pasados |
15,849 | public function set ( int $ id ) : bool { if ( ! $ this -> isAllowed ( ) ) { return false ; } $ hash = $ this -> hasher -> hash ( $ id ) ; $ uniqid = uniqid ( ) ; $ this -> session -> setExpiration ( '5 minutes' ) ; $ this -> session -> $ uniqid = $ hash ; $ this -> id = $ uniqid ; $ this -> presenter -> redirect ( $ t... | Nastavi testovaci ucet a presmeruje |
15,850 | protected function validateIndex ( $ index , $ indexType ) { if ( is_null ( $ this -> resultMap ) ) { if ( ! array_key_exists ( $ index , $ this -> columnTypes ) ) { if ( is_numeric ( $ index ) && array_key_exists ( intval ( $ index ) , $ this -> columnTypes ) ) $ index = intval ( $ index ) ; else throw new \ Unexpecte... | Validates a user defined index againts current result |
15,851 | protected function validateGroup ( $ group , $ groupType ) { if ( is_null ( $ this -> resultMap ) ) { if ( ! array_key_exists ( $ group , $ this -> columnTypes ) ) { if ( is_numeric ( $ group ) && array_key_exists ( intval ( $ group ) , $ this -> columnTypes ) ) $ group = intval ( $ group ) ; else throw new \ Unexpecte... | Validates a user defined group against current result |
15,852 | protected function buildTypeHandlerList ( ) { foreach ( $ this -> properties as $ name => $ propertyProfile ) { $ column = $ propertyProfile -> getColumn ( ) ; if ( ! array_key_exists ( $ column , $ this -> columnTypes ) ) continue ; $ this -> availableColumns [ $ name ] = $ column ; $ type = $ propertyProfile -> getTy... | Builds a list of type handlers for the available columns |
15,853 | public function processResponse ( ResponseInterface $ response , SystemEvent $ event ) { if ( $ event -> getName ( ) === SystemEvent :: FINISH ) { $ event -> stopPropagation ( true ) ; $ server = $ this -> getServer ( ) ; $ emitter = $ server -> getEmitter ( ) ; $ emitter -> emit ( $ response ) ; return ; } $ events = ... | Processes the response . |
15,854 | public static function add ( $ objectType , $ objectId = null , $ action = null , $ fieldName = null , $ oldValue = null , $ newValue = null , $ userId = 0 , $ content = '' ) { global $ PPHP ; $ db = $ PPHP [ 'db' ] ; $ ip = '127.0.0.1' ; $ req = grab ( 'request' ) ; if ( isset ( $ req [ 'remote_addr' ] ) ) { $ ip = $ ... | Add a new transaction to the audit trail |
15,855 | public static function getLastLogin ( $ userId ) { global $ PPHP ; $ db = $ PPHP [ 'db' ] ; $ last = $ db -> selectSingleArray ( " SELECT timestamp, ip, datetime(timestamp, 'localtime') AS localtimestamp FROM transactions WHERE objectType='user' AND objectId=? AND action='login' ... | Get user s last login details |
15,856 | public static function getObjectIds ( $ objectType , $ begin = null , $ end = null ) { global $ PPHP ; $ db = $ PPHP [ 'db' ] ; $ q = $ db -> query ( "SELECT DISTINCT(objectId) FROM transactions WHERE objectType=?" , $ objectType ) ; if ( $ begin !== null && $ end !== null ) { $ q -> and ( "timestamp BETWEEN date(?) AN... | Get IDs with activity present |
15,857 | public function prepareForTransport ( ) { foreach ( $ this as $ k => $ v ) { if ( $ v instanceof FortifiApiResponse ) { $ v -> prepareForTransport ( ) ; } else if ( is_array ( $ v ) ) { foreach ( $ v as $ vi => $ vv ) { if ( $ vv instanceof FortifiApiResponse ) { $ vv -> prepareForTransport ( ) ; } } } } } | Executed before sending the response |
15,858 | public function setSetting ( $ name , $ value ) { $ old = isset ( $ this -> settings [ $ name ] ) ? $ this -> settings [ $ name ] : null ; if ( $ old instanceof self || $ value instanceof self ) { if ( $ old instanceof self && $ value instanceof self ) { $ old -> setSettings ( $ value -> settings ) ; } else if ( $ old ... | Set a setting by name |
15,859 | public static function capture ( $ files = null ) { $ files = $ files ?? $ _FILES ; if ( ! is_array ( $ files ) ) { return null ; } $ keys = array_keys ( $ files ) ; sort ( $ keys ) ; $ multi = $ keys !== [ 'error' , 'name' , 'size' , 'tmp_name' , 'type' ] ; if ( ! $ multi && is_array ( $ files [ 'name' ] ) ) { $ multi... | Capture uploaded files |
15,860 | public function generateKeyURI ( $ type , $ secret , $ account , $ issuer = '' , $ counter = 0 , $ algorithm = '' , $ digits = '' , $ period = '' ) { $ this -> validateType ( $ type ) ; $ this -> validateAlgorithm ( $ algorithm ) ; $ this -> formatLabel ( $ issuer , 'issuer' ) ; $ this -> formatLabel ( $ account , 'acc... | Generate OTP key URI |
15,861 | protected function formatLabel ( $ string , $ part ) { $ string = trim ( $ string ) ; if ( $ part === 'account' ) { $ this -> setAccount ( $ string ) ; } else if ( $ part === 'issuer' ) { $ this -> setIssuer ( $ string ) ; } } | Format label string according to expected urlencoded standards . |
15,862 | protected function setAccount ( $ account ) { if ( empty ( $ account ) ) { throw new \ InvalidArgumentException ( "Label can't contain empty strings" ) ; } $ this -> label .= str_replace ( '%40' , '@' , rawurlencode ( $ account ) ) ; } | Format and and set account name |
15,863 | protected function setIssuer ( $ issuer ) { if ( ! empty ( $ issuer ) ) { $ this -> label = rawurlencode ( $ issuer ) . ':' ; $ this -> issuer = '&issuer=' . rawurlencode ( $ issuer ) ; } } | Format and set issuer |
15,864 | protected function setCounter ( $ type , $ counter ) { if ( $ type === 'hotp' ) { if ( $ counter !== 0 && empty ( $ counter ) ) { throw new \ InvalidArgumentException ( "Counter can't be empty if HOTP is being used" ) ; } $ this -> parameters .= "&counter=$counter" ; } } | Set counter value if hotp is being used |
15,865 | public static function full ( $ object ) : string { if ( is_string ( $ object ) ) { return str_replace ( '.' , '\\' , $ object ) ; } if ( is_object ( $ object ) ) { return trim ( get_class ( $ object ) , '\\' ) ; } $ message = sprintf ( '%s expects $object to be an object or string; received (%s) %s' , __METHOD__ , get... | Retrieves the fully qualified class name of an object |
15,866 | public function addAnnotationController ( $ bundle , $ controller ) { $ current = '' ; if ( file_exists ( $ this -> file ) ) { $ current = file_get_contents ( $ this -> file ) ; } elseif ( ! is_dir ( $ dir = dirname ( $ this -> file ) ) ) { mkdir ( $ dir , 0777 , true ) ; } $ code = sprintf ( "%s:\n" , Container :: und... | Add an annotation controller resource . |
15,867 | protected function createProgressBar ( OutputInterface $ output , $ length = 10 ) { $ progress = $ this -> getHelper ( 'progress' ) ; $ progress -> setBarCharacter ( '<info>|</info>' ) ; $ progress -> setEmptyBarCharacter ( ' ' ) ; $ progress -> setProgressCharacter ( '|' ) ; $ progress -> start ( $ output , $ length )... | Create progress bar |
15,868 | private function validateTemplate ( $ template , $ templateList ) { if ( empty ( $ template ) ) { throw new \ Exception ( 'The template name is required.' ) ; } if ( ! in_array ( $ template , $ templateList ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The template "%s" does not exist, use: %s' , $ template ,... | Validate template name |
15,869 | public function setCallable ( $ callableExpression ) { if ( strpos ( "@" , $ callableExpression ) === false ) { $ callableExpression .= "@indexAction" ; } list ( $ controllerName , $ action ) = explode ( "@" , $ callableExpression ) ; $ controller = $ this -> pimple [ $ controllerName ] ; $ callable = array ( $ control... | Sets the controller and action |
15,870 | public function addConditionsFromArray ( array $ conditions ) { foreach ( $ conditions as $ condition ) { if ( ! is_callable ( $ condition ) ) { $ message = "One or more of the conditions you provided are not callable, " ; $ message .= "please pass an array of callable functions." ; throw new \ InvalidArgumentException... | Adds conditions to the route from the given array |
15,871 | public function run ( ) { if ( ! isset ( $ this -> conditions ) || ! isset ( $ this -> callable ) ) { $ message = "You have called the run function but have not provided both a array of conditions" ; $ message .= " and a callable function, which will be called if all the given conditions are met." ; throw new \ Runtime... | Runs through all the callable functions provided if all are met call the given callable |
15,872 | protected function generateBody ( $ modelName , array $ properties ) { $ linesProperties = array ( "" ) ; $ linesMethods = array ( "" ) ; foreach ( $ properties as $ field ) { foreach ( $ field as $ property ) { $ linesProperties [ ] = " /**" ; $ linesProperties [ ] = " * " . $ property [ 'columnName' ] ; $ line... | Generate array properties getters and setters |
15,873 | public function panelHeader ( $ title , $ h = 'h1' ) { $ panelTitle = parent :: tag ( $ h , $ title , [ 'class' => 'panel-title' ] ) ; return parent :: tag ( "div" , $ panelTitle , [ 'class' => 'panel-heading' ] ) ; } | Returns a panel header |
15,874 | public function modalHeader ( $ title , $ h = 'h4' ) { $ modalTitle = parent :: tag ( $ h , $ title , [ 'class' => 'modal-title' ] ) ; return parent :: tag ( "div" , $ modalTitle , [ "class" => 'modal-header' ] ) ; } | Returns a modal header |
15,875 | public function descriptionList ( $ data , $ options = [ ] , $ dtOpts = [ ] , $ ddOpts = [ ] ) { if ( empty ( $ data ) || ! is_array ( $ data ) ) { return false ; } $ out = [ ] ; $ dtOptions = parent :: _parseAttributes ( $ dtOpts ) ; $ ddOptions = parent :: _parseAttributes ( $ ddOpts ) ; foreach ( $ data as $ descr =... | returns a dl element |
15,876 | public function well ( $ text , $ size = null , $ options = [ ] ) { $ options = [ 'class' => 'well' ] ; if ( ! empty ( $ size ) ) { switch ( $ size ) { case 'lg' : case 'large' : $ options = parent :: addClass ( $ options , 'well-lg' ) ; break ; case 'sm' : case 'small' : $ options = parent :: addClass ( $ options , 'w... | creates a div with well properties |
15,877 | public function lead ( $ content , $ options = [ ] ) { $ options = array_merge ( [ 'class' => 'lead' ] , $ options ) ; return parent :: tag ( 'p' , $ content , $ options ) ; } | Creates a paragraph with lead class |
15,878 | protected function _generateListGroupText ( $ title ) { if ( is_array ( $ title ) ) { $ text = '' ; if ( ! empty ( $ title [ 'header' ] ) ) { $ text .= $ this -> tag ( 'h4' , $ title [ 'header' ] , [ 'class' => 'list-group-item-heading' ] ) ; } if ( ! empty ( $ title [ 'text' ] ) ) { $ text .= $ this -> para ( 'list-gr... | _generateListGroupText Generates the text for the list group item |
15,879 | public function badge ( $ text , $ options = [ ] ) { $ defaults = array_merge ( [ 'class' => 'badge' ] , $ options ) ; return parent :: tag ( 'span' , $ text , $ defaults ) ; } | return a badge |
15,880 | public function status ( $ value , $ url = [ ] ) { $ icon = $ value == true ? 'check' : 'times' ; $ contextual = $ value == true ? 'success' : 'danger' ; return $ this -> label ( '' , $ contextual , [ 'icon' => $ icon ] ) ; } | Returns a well formatted check . Used special for booleans |
15,881 | public function icon ( $ type , $ text = '' , array $ options = [ ] ) { $ icon = $ this -> iconPrefix ; $ class = "$icon $icon-$type" ; if ( isset ( $ options [ 'class' ] ) && ! empty ( $ class ) ) { $ options [ 'class' ] = $ class . ' ' . $ options [ 'class' ] ; } else { $ options [ 'class' ] = $ class ; } $ tag = par... | Returns an icon element followed by a text |
15,882 | protected function _icon ( $ title , array $ options = [ ] ) { if ( empty ( $ options ) || ! isset ( $ options [ 'icon' ] ) ) { return $ title ; } $ options = $ options [ 'icon' ] ; if ( is_array ( $ options ) ) { if ( ! isset ( $ options [ 'class' ] ) || empty ( $ options [ 'class' ] ) ) { return $ title ; } } if ( is... | Returns an icon element followed by a text . This function is used for generating an icon for internal functions inside this helper . |
15,883 | protected function insertRow ( AbstractEntity $ entity ) { $ values = $ entity -> getDbValues ( ) ; $ columns = array_keys ( $ values ) ; if ( $ this -> autoIncrementColumn && ! array_key_exists ( $ this -> autoIncrementColumn , $ values ) ) { throw new LogicException ( 'auto_increment column ' . $ this -> autoIncremen... | Insert an entity s DB row using the given values . Set the ID on the entity from the query result . |
15,884 | public function compile ( CompilerConfig $ config ) : Compiler { $ cache_dir = $ config -> getCacheDir ( ) ; if ( ! $ cache_dir ) { throw new CacheDirectoryConfigurationException ( $ cache_dir ) ; } $ cache_dir = new File ( $ cache_dir ) ; if ( ! $ cache_dir -> exists ( ) || ! $ cache_dir -> isDirectory ( ) ) { throw n... | Compile setup code |
15,885 | private function constructor ( string $ class_name , array $ params = null ) { $ this -> state -> category = CompilerState :: CATEGORY_CONSTRUCTOR ; $ this -> state -> name = '' ; $ params_str = '' ; if ( is_array ( $ params ) ) { $ params_str = $ this -> decorateParamsForMethodCall ( $ params ) ; } return $ class_name... | Make constructor code |
15,886 | private function methodCallList ( array $ method_injections ) { $ this -> state -> category = CompilerState :: CATEGORY_METHOD ; $ ret = '' ; foreach ( $ method_injections as $ injection ) { $ method_name = $ injection [ 'method' ] ?? null ; $ params = $ injection [ 'params' ] ?? null ; $ this -> state -> name = $ meth... | Make method call code |
15,887 | private function propertySetList ( array $ property_injections ) { $ this -> state -> category = CompilerState :: CATEGORY_PROPERTY ; $ ret = '' ; foreach ( $ property_injections as $ injection ) { $ property_name = $ injection [ 'property' ] ?? null ; $ value = $ injection [ 'value' ] ?? null ; $ this -> state -> name... | Make property set code |
15,888 | private function findPropertyInjections ( array $ injections ) { $ ret = [ ] ; if ( is_array ( $ injections ) ) { foreach ( $ injections as $ injection ) { if ( ! isset ( $ injection [ 'property' ] ) ) { continue ; } $ ret [ ] = $ injection ; } } return $ ret ; } | find property injection |
15,889 | private function decorateParamsForMethodCall ( array $ params ) : string { $ params_out = [ ] ; foreach ( $ params as $ param ) { $ params_out [ ] = $ this -> decorateValue ( $ param ) ; } return implode ( ',' , $ params_out ) ; } | Modify param array for method call |
15,890 | private function decorateValue ( $ value ) : string { $ ret = 'null' ; switch ( gettype ( $ value ) ) { case 'string' : $ ret = $ this -> decorateStringValue ( $ value ) ; break ; case 'integer' : case 'double' : $ ret = $ value ; break ; case 'boolean' : $ ret = $ value ? 'true' : 'false' ; break ; case 'array' : $ re... | Modify value for function call or setting property |
15,891 | private function decorateStringValue ( string $ value ) : string { if ( $ value === '@this' ) { return "\$c" ; } if ( preg_match ( '/^@id:(.*)$/s' , $ value , $ matches ) ) { $ id = trim ( $ matches [ 1 ] ) ; return "\$c['" . self :: escapeSingleQuote ( $ id ) . "']" ; } if ( preg_match ( '/^@resolve:(.*)$/s' , $ value... | Modify string value for function call or setting property |
15,892 | private function validateCallable ( string $ str ) { ob_start ( ) ; try { $ _ = @ eval ( 'return ' . $ str . ';' ) ; if ( ! is_callable ( $ _ ) ) { throw new ValidateCallableException ( $ str ) ; } } catch ( \ Throwable $ e ) { ob_end_clean ( ) ; throw new CompileErrorException ( $ e -> getMessage ( ) , $ this -> state... | Validate if expression is callable |
15,893 | private function validateInteger ( string $ str ) : int { $ ret = filter_var ( $ str , FILTER_VALIDATE_INT ) ; if ( $ ret === false ) { throw new CompileErrorException ( 'invalid integer value' , $ this -> state ) ; } return $ ret ; } | Validate if expression is integer value |
15,894 | private function validateJson ( string $ str ) : array { $ ret = json_decode ( $ str , true ) ; if ( $ ret === null ) { throw new CompileErrorException ( 'invalid json value:' . json_last_error_msg ( ) , $ this -> state ) ; } if ( ! is_array ( $ ret ) ) { throw new CompileErrorException ( '@json immediate must be array... | Validate if expression is json value |
15,895 | private function findSlotById ( string $ id , array $ slots ) { $ slot = null ; foreach ( $ slots as $ s ) { $ slot_id = $ s [ 'id' ] ?? null ; if ( $ slot_id == $ id ) { $ slot = $ s ; break ; } } return $ slot ; } | Find slot by id |
15,896 | public function toArray ( Model $ model ) { if ( method_exists ( $ model , 'withoutArrayHook' ) ) { $ model -> withoutArrayHook ( ) ; } $ result = $ model -> toArray ( ) ; $ namedExc = [ ] ; foreach ( $ this -> exclude as $ k ) { array_set ( $ namedExc , $ k , true ) ; } $ namedInc = [ ] ; foreach ( $ this -> include a... | Serializes a model to an array . |
15,897 | private function expand ( Model $ model , array $ result , array $ namedExc , array $ namedInc , array $ namedExp ) { foreach ( $ namedExp as $ k => $ subExp ) { $ value = array_value ( $ result , $ k ) ; if ( ! $ this -> isExpandable ( $ model , $ k , $ value ) ) { continue ; } $ subExc = array_value ( $ namedExc , $ ... | Expands any relational properties within a result . |
15,898 | private function isExpandable ( Model $ model , $ k , $ value ) { if ( ! $ value ) { return false ; } $ property = $ model :: getProperty ( $ k ) ; if ( ! $ property || ! isset ( $ property [ 'relation' ] ) ) { return false ; } return true ; } | Expands a model . |
15,899 | public static function encode ( String $ string , $ badWords = NULL , $ changeChar = '[badchars]' ) : String { if ( empty ( $ badWords ) ) { $ secnc = Properties :: $ ncEncode ; $ badWords = $ secnc [ 'badChars' ] ; $ changeChar = $ secnc [ 'changeBadChars' ] ; } $ regex = Singleton :: class ( 'ZN\Regex' ) ; if ( ! is_... | Encode Nasty Code |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.