idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
15,400 | public static function execute ( $ sql , $ parameters = null , $ connection = null , $ fetchMode = \ PDO :: FETCH_ASSOC ) { self :: $ _statement = self :: createStatement ( $ sql , $ connection , $ fetchMode ) ; if ( empty ( $ parameters ) ) { return self :: $ _statement -> execute ( ) ; } return self :: $ _statement -... | Executes a SQL statement |
15,401 | public static function find ( $ sql , $ parameters = null , $ connection = null , $ fetchMode = \ PDO :: FETCH_ASSOC ) { if ( false === ( $ _reader = self :: query ( $ sql , $ parameters , $ connection , $ fetchMode ) ) ) { return null ; } return $ _reader -> fetch ( ) ; } | Executes a SQL query |
15,402 | public static function findAll ( $ sql , $ parameters = null , $ connection = null , $ fetchMode = \ PDO :: FETCH_ASSOC ) { if ( false === ( $ _reader = self :: query ( $ sql , $ parameters , $ connection , $ fetchMode ) ) ) { return null ; } return $ _reader -> fetchAll ( ) ; } | Executes the given sql statement and returns all results |
15,403 | public static function scalar ( $ sql , $ columnNumber = 0 , $ parameters = null , $ connection = null , $ fetchMode = \ PDO :: FETCH_ASSOC ) { if ( false === ( $ _reader = self :: query ( $ sql , $ parameters , $ connection , $ fetchMode ) ) ) { return null ; } return $ _reader -> fetchColumn ( $ columnNumber ) ; } | Returns the first column of the first row or null |
15,404 | protected function _setStateMachine ( $ stateMachine ) { if ( $ stateMachine !== null && ! ( $ stateMachine instanceof StateMachineInterface ) ) { throw $ this -> _createInvalidArgumentException ( $ this -> __ ( 'Argument is not a valid state machine instance' ) , null , null , $ stateMachine ) ; } $ this -> stateMachi... | Sets the state machine for this instance . |
15,405 | public function setEnv ( $ shortOptions = '' , array $ longOptions = array ( ) , array $ argv = array ( ) ) { if ( ! empty ( $ argv ) ) { $ this -> argv = $ argv ; $ this -> argc = count ( $ argv ) ; } $ this -> shortOptions = $ shortOptions ; $ this -> longOptions = $ longOptions ; $ this -> program = $ this -> argv [... | Sets the working environment for the program |
15,406 | public function options ( $ start = 1 ) { $ this -> optind = ( 0 == ( $ start ) ) ? 1 : ( int ) $ start ; do { $ nextOption = $ this -> getopt ( ) ; if ( null !== $ nextOption && - 1 !== $ nextOption ) { $ this -> options [ $ nextOption ] = ( null !== $ this -> optarg ) ? $ this -> optarg : true ; } } while ( $ nextOpt... | Return all the options in an associative array where the key is the option s name |
15,407 | public function arguments ( ) { if ( $ this -> optind < $ this -> argc ) { for ( $ i = $ this -> optind ; $ i < $ this -> argc ; $ i ++ ) { $ this -> arguments [ ] = $ this -> argv [ $ i ] ; } } return $ this -> arguments ; } | Returns program s arguments |
15,408 | private function getopt ( ) { $ this -> optarg = null ; if ( $ this -> optind >= $ this -> argc ) { return - 1 ; } $ arg = $ this -> argv [ $ this -> optind ] ; if ( $ this -> isLongOption ( $ arg ) ) { return $ this -> parseLongOption ( $ arg ) ; } if ( $ this -> isShortOption ( $ arg ) ) { return $ this -> parseShort... | Searches for a valid next option |
15,409 | private function getLongOptionKey ( $ arg ) { $ key = ( false !== ( $ eqPos = strpos ( $ arg , '=' ) ) ) ? substr ( $ arg , 2 , $ eqPos - 2 ) : substr ( $ arg , 2 ) ; return $ key ; } | Extracts the key from a long option |
15,410 | private function parseShortOptionGroup ( $ key ) { $ shortOptions = $ this -> shortOptions ; $ chars = str_split ( $ key ) ; foreach ( $ chars as $ char ) { $ cpos = strpos ( $ shortOptions , $ char ) ; if ( false === $ cpos ) { $ this -> optind ++ ; return null ; } $ option = $ char ; if ( isset ( $ shortOptions [ $ c... | Parse and extract the keys and values of a short options group |
15,411 | public function find ( $ basePath ) { if ( is_file ( $ basePath ) ) { $ basePath = dirname ( $ basePath ) ; } elseif ( ! is_dir ( $ basePath ) ) { throw new \ InvalidArgumentException ( 'Base path must be either a file path or directory' ) ; } $ basePath = realpath ( $ basePath ) ? : $ basePath ; do { $ autoloaderPath ... | Find the best autoloader for the current project |
15,412 | public function setItemCountPerPage ( $ itemCountPerPage = - 1 ) { $ this -> itemCountPerPage = ( int ) $ itemCountPerPage ; if ( $ this -> itemCountPerPage < 1 ) { $ this -> itemCountPerPage = $ this -> getTotalItemCount ( ) ; } $ this -> pageCount = $ this -> _calculatePageCount ( ) ; $ this -> currentItems = null ; ... | Sets the number of items per page . |
15,413 | public function getPages ( $ scrollingStyle = null ) { if ( $ this -> pages === null ) { $ this -> pages = $ this -> _createPages ( $ scrollingStyle ) ; } return $ this -> pages ; } | Returns the page collection . |
15,414 | public function getPagesInRange ( $ lowerBound , $ upperBound ) { $ lowerBound = $ this -> normalizePageNumber ( $ lowerBound ) ; $ upperBound = $ this -> normalizePageNumber ( $ upperBound ) ; $ pages = array ( ) ; for ( $ pageNumber = $ lowerBound ; $ pageNumber <= $ upperBound ; $ pageNumber ++ ) { $ pages [ $ pageN... | Returns a subset of pages within a given range . |
15,415 | public function normalizeItemNumber ( $ itemNumber ) { $ itemNumber = ( int ) $ itemNumber ; if ( $ itemNumber < 1 ) { $ itemNumber = 1 ; } if ( $ itemNumber > $ this -> getItemCountPerPage ( ) ) { $ itemNumber = $ this -> getItemCountPerPage ( ) ; } return $ itemNumber ; } | Brings the item number in range of the page . |
15,416 | public function normalizePageNumber ( $ pageNumber ) { $ pageNumber = ( int ) $ pageNumber ; if ( $ pageNumber < 1 ) { $ pageNumber = 1 ; } $ pageCount = $ this -> count ( ) ; if ( $ pageCount > 0 && $ pageNumber > $ pageCount ) { $ pageNumber = $ pageCount ; } return $ pageNumber ; } | Brings the page number in range of the paginator . |
15,417 | protected function _createPages ( $ scrollingStyle = null ) { $ pageCount = $ this -> count ( ) ; $ currentPageNumber = $ this -> getCurrentPageNumber ( ) ; $ pages = array ( 'pageCount' => $ pageCount , 'itemCountPerPage' => $ this -> getItemCountPerPage ( ) , 'first' => 1 , 'current' => $ currentPageNumber , 'last' =... | Creates the page collection . |
15,418 | public function resolveComposedTargetObject ( $ e ) { $ annotation = $ e -> getParam ( 'annotation' ) ; if ( ! $ annotation instanceof ComposedObject ) { return ; } $ formSpec = $ e -> getParam ( 'formSpec' ) ; if ( ! isset ( $ formSpec [ 'object' ] ) ) { return ; } $ metadata = $ this -> objectManager -> getClassMetad... | ComposedObject target object resolver |
15,419 | public function handleHydratorAnnotation ( $ e ) { $ annotation = $ e -> getParam ( 'annotation' ) ; if ( ! ( $ annotation instanceof ComposedObject && $ annotation -> isCollection ( ) ) ) { return ; } $ elementSpec = $ e -> getParam ( 'elementSpec' ) ; if ( isset ( $ elementSpec [ 'spec' ] [ 'hydrator' ] ) ) { unset (... | Handle the Hydrator annotation |
15,420 | public function resolveObjectSelectTargetClass ( $ e ) { $ elementSpec = $ e -> getParam ( 'elementSpec' ) ; if ( ! isset ( $ elementSpec [ 'spec' ] [ 'type' ] ) ) { return ; } $ type = $ elementSpec [ 'spec' ] [ 'type' ] ; if ( strtolower ( $ type ) !== 'objectselect' && ! $ type instanceof ObjectSelect ) { return ; }... | ObjectSelect target class resolver |
15,421 | public function newAction ( ) { $ entity = new Product ( ) ; $ entity = $ this -> addProductItemFieldData ( $ entity ) ; $ form = $ this -> createCreateForm ( $ entity ) ; return array ( 'entity' => $ entity , 'form' => $ form -> createView ( ) , ) ; } | Displays a form to create a new Product entity . |
15,422 | public function copyAction ( Product $ product ) { $ productCopy = new Product ( ) ; $ copyName = $ this -> get ( 'translator' ) -> trans ( 'Copy of' ) . " " . $ product -> getName ( ) ; $ productCopy -> setName ( $ copyName ) ; $ productCopy -> setCostPrice ( $ product -> getCostPrice ( ) ) ; $ productCopy -> setDescr... | Displays a form to edit an existing CampaignMail entity . |
15,423 | public function updateAction ( Request $ request , Product $ entity ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ entity = $ this -> addProductItemFieldData ( $ entity ) ; if ( ! $ entity ) { throw $ this -> createNotFoundException ( 'Unable to find Product entity.' ) ; } $ deleteForm = $ this -> createDel... | Edits an existing Product entity . |
15,424 | public function showGalleryItemAction ( Product $ product ) { $ entity = $ product -> getMediaGallery ( ) ; if ( ! $ entity ) { throw $ this -> createNotFoundException ( 'Unable to find Gallery entity.' ) ; } $ deleteForm = $ this -> createDeleteForm ( $ product -> getId ( ) ) ; return array ( 'entity' => $ entity , 'p... | Finds and displays a Gallery entity . |
15,425 | public function deleteGalleryItemAction ( Request $ request , GalleryItem $ entity ) { $ form = $ this -> createDeleteForm ( $ entity -> getId ( ) ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; if ( ! $ entity ) { throw $ this -> createNot... | Deletes a GalleryItem entity . |
15,426 | public function updateGalleryItemPosition ( Request $ request ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ posArray = $ request -> get ( 'data' ) ; $ i = 0 ; foreach ( $ posArray as $ item ) { $ entity = $ em -> getRepository ( 'AmulenMediaBundle:GalleryItem' ) -> find ( $ item ) ; $ entity -> setPosition... | Actualizar la posicion de cada imagen . |
15,427 | public function addMediaProductAction ( Product $ product , $ type = null ) { if ( $ type == 'type_image_file' ) { return $ this -> redirectToRoute ( 'admin_product_new_image' , array ( 'id' => $ product -> getId ( ) ) ) ; } $ entity = new Media ( ) ; $ entity -> setMediaType ( $ type ) ; $ form = $ this -> mediaCreate... | Add media . |
15,428 | public function editMediaAction ( Product $ product , Media $ entity , $ type , Request $ request ) { if ( ! $ entity ) { throw $ this -> createNotFoundException ( 'Unable to find Media entity.' ) ; } $ editForm = $ this -> mediaCreateEditForm ( $ entity , $ product , $ type ) ; return array ( 'entity' => $ entity , 't... | Displays a form to edit an existing Media entity . |
15,429 | private function mediaCreateEditForm ( Media $ entity , $ product , $ type ) { $ types = $ this -> container -> getParameter ( 'flowcode_media.media_types' ) ; $ class = $ types [ $ entity -> getMediaType ( ) ] [ "class_type" ] ; $ form = $ this -> createForm ( new $ class ( ) , $ entity , array ( 'action' => $ this ->... | Creates a form to edit a Media entity . |
15,430 | public static function Rxpv ( array $ r , array $ pv , array & $ rpv ) { IAU :: Rxp ( $ r , $ pv [ 0 ] , $ rpv [ 0 ] ) ; IAU :: Rxp ( $ r , $ pv [ 1 ] , $ rpv [ 1 ] ) ; return ; } | - - - - - - - - i a u R x p v - - - - - - - - |
15,431 | public static function load ( array $ langs , $ lang = null ) { static :: $ langs = $ langs ; static :: $ lang = $ lang ? : key ( $ langs ) ; } | Load langs array |
15,432 | public function onBeforeNormalization ( BeforeNormalizationEvent $ event ) : void { $ resource = $ event -> getResource ( ) ; if ( ! $ resource instanceof ActionedResourceInterface ) { return ; } $ actions = $ resource -> getActions ( ) ; foreach ( $ actions as $ action ) { if ( ! $ action instanceof SymfonyGrantedActi... | Check the grants to actions |
15,433 | public function addError ( $ error , $ file = __FILE__ , $ line = __LINE__ , $ type = ERROR_INFORMATION , $ log = LOG_SYSTEM ) { if ( $ log != LOG_HISTORY && $ log != LOG_CRONS && $ log != LOG_EVENT ) { if ( Config :: config ( ) [ 'user' ] [ 'debug' ] [ 'log' ] ) { if ( $ log == LOG_SQL ) { $ error = preg_replace ( '#(... | add an error in the log |
15,434 | public function addErrorHr ( $ log = LOG_SYSTEM ) { if ( Config :: config ( ) [ 'user' ] [ 'debug' ] [ 'log' ] ) { file_put_contents ( APP_LOG_PATH . $ log . '.log' , "#################### END OF EXECUTION OF http://" . $ _SERVER [ 'HTTP_HOST' ] . $ _SERVER [ 'REQUEST_URI' ] . " ####################\n" , FILE_APPEND | ... | add an hr line in the log |
15,435 | public function removeUser ( $ user ) { $ username = ( $ user instanceof UserInformation ) ? $ user -> getUsername ( ) : ( string ) $ user ; $ this -> configSource -> set ( 'auth-password/' . $ username , null ) ; return $ this ; } | Add the passed credentials in the database . |
15,436 | public function parse ( $ data ) { if ( $ this -> state === self :: STATE_UNSENT ) { $ this -> state = self :: STATE_OPENED ; } if ( $ this -> isHeaderComplete ) { $ data = $ this -> parseData ( $ data ) ; } else { $ data = $ this -> parseHeader ( $ data ) ; } if ( $ this -> cursor == $ this -> getLength ( ) + $ this -... | Parses raw data for this frame |
15,437 | public function getLength ( ) { $ length = $ this -> length64 ; if ( $ length == 0 ) { $ length = $ this -> length16 ; } if ( $ length == 0 ) { $ length = $ this -> length ; } return $ length ; } | Gets the length of this frame s payload data in bytes |
15,438 | protected function getHeader ( ) { $ header = '' ; $ fin = $ this -> fin ? 0x80 : 0x00 ; $ rsv1 = $ this -> rsv1 ? 0x40 : 0x00 ; $ rsv2 = $ this -> rsv2 ? 0x20 : 0x00 ; $ rsv3 = $ this -> rsv3 ? 0x10 : 0x00 ; $ byte1 = $ fin | $ rsv1 | $ rsv2 | $ rsv3 | $ this -> opcode ; $ mask = $ this -> isMasked ? 0x80 : 0x00 ; $ b... | Gets this frame s header as a binary string |
15,439 | protected function getData ( ) { $ data = $ this -> unmaskedData ; if ( $ this -> isMasked ) { $ data = $ this -> mask ( $ data ) ; } return $ data ; } | Gets the data portion of this frame as a binary string |
15,440 | protected function parseData ( $ data ) { $ length = mb_strlen ( $ data , '8bit' ) ; if ( $ this -> cursor + $ length > $ this -> getLength ( ) + $ this -> headerLength ) { $ dataLength = $ this -> getLength ( ) - $ this -> cursor + $ this -> headerLength ; } else { $ dataLength = $ length ; } $ data = mb_substr ( $ da... | Parses the data payload of this frame from a raw data stream |
15,441 | protected function mask ( $ data ) { $ out = '' ; $ length = mb_strlen ( $ data , '8bit' ) ; $ j = ( $ this -> cursor - $ this -> headerLength ) % 4 ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ data_octet = $ this -> getChar ( $ data , $ i ) ; $ mask_octet = $ this -> getChar ( $ this -> mask , $ j ) ; $ out .= pack... | Masks data according the the algorithm described in RFC 6455 Section 5 . 3 |
15,442 | public function setLocale ( $ locale ) { if ( $ locale instanceof Locale ) { $ this -> locale = $ locale ; return $ this ; } $ this -> locale = strtolower ( $ locale ) ; return $ this ; } | Sets a locale . |
15,443 | public function getLocale ( ) { if ( $ this -> locale instanceof Locale ) { return $ this -> locale ; } if ( ! isset ( $ this -> locales [ $ this -> locale ] ) ) { $ this -> locale = 'en' ; } if ( isset ( static :: $ localeInstances [ $ this -> locale ] ) ) { return static :: $ localeInstances [ $ this -> locale ] ; } ... | Returns a locale instance . |
15,444 | public function getFormat ( $ name ) { if ( isset ( $ this -> formats [ $ name ] ) ) { return $ this -> formats [ $ name ] ; } return null ; } | Returns a format by name . |
15,445 | public function setFormatOptions ( array $ options ) { foreach ( $ options as $ name => $ handler ) { $ this -> setFormatOption ( $ name , $ handler ) ; } return $ this ; } | Adds a format options . |
15,446 | public function setFormatOption ( $ name , callable $ handler ) { if ( in_array ( $ name , static :: $ formatOptionsNames ) ) { return $ this ; } static :: $ formatOptionsNames [ ] = $ name ; static :: $ formatOptionsPlaceholders [ ] = '~' . count ( static :: $ formatOptionsPlaceholders ) . '~' ; static :: $ formatOpti... | Adds a format option . |
15,447 | public function format ( $ format = null ) { if ( empty ( $ format ) ) { $ format = $ this -> defaultFormat ; } return $ this -> formatDatetimeObject ( $ format ) ; } | Returns formatting date . |
15,448 | public static function is ( $ date ) { if ( is_bool ( $ date ) || empty ( $ date ) xor ( $ date === 0 || $ date === '0' ) ) { return false ; } $ date = static :: isTimestamp ( $ date ) ? '@' . ( string ) $ date : $ date ; return ( bool ) date_create ( $ date ) ; } | Validate is date . |
15,449 | public static function isTimestamp ( $ timestamp ) { if ( is_bool ( $ timestamp ) || ! is_scalar ( $ timestamp ) ) { return false ; } return ( ( string ) ( int ) $ timestamp === ( string ) $ timestamp ) && ( $ timestamp <= PHP_INT_MAX ) && ( $ timestamp >= ~ PHP_INT_MAX ) ; } | Validate is timestamp . |
15,450 | protected function generateNextMask ( ) { if ( is_null ( $ this -> mask ) ) { $ this -> generateFirstMask ( ) ; return TRUE ; } if ( ! $ this -> generateNextPermutation ( ) ) { return $ this -> addPositive ( ) ; } return TRUE ; } | Generates the next mask . |
15,451 | protected function generateNextPermutation ( ) { $ number = implode ( '' , $ this -> mask ) ; $ result = LexographicalPermutation :: getNextPermutation ( $ number ) ; if ( $ result !== FALSE ) { $ this -> mask = str_split ( $ result ) ; } return $ result !== FALSE ; } | Generates the next permutation of the current mask . |
15,452 | protected function generateFirstMask ( ) { $ this -> mask = array_fill ( 0 , $ this -> length , 0 ) ; for ( $ i = 0 ; $ i < $ this -> positivesAmount ; $ i ++ ) { $ this -> mask [ $ this -> length - $ i - 1 ] = 1 ; } } | Generates the very first mask . |
15,453 | protected function addPositive ( ) { if ( $ this -> positivesAmount >= $ this -> length ) { return FALSE ; } $ this -> positivesAmount ++ ; $ this -> generateFirstMask ( ) ; return TRUE ; } | Adds a positive marker to the mask . |
15,454 | public static function inArray ( $ needle , $ haystack , $ strict = NULL ) { return static :: is_array ( $ haystack ) && in_array ( $ needle , $ haystack , $ strict ) ; } | Checks if a value exists in an array |
15,455 | public function loaderModels ( ClassMetadata $ class , $ manager , array $ ids , \ Closure $ stacker ) { $ classOfManagerName = $ class -> getFieldMapping ( $ manager ) ; $ pool = $ this -> manager -> getPool ( ) ; $ methodFind = $ classOfManagerName -> getRepositoryMethod ( ) ; $ repository = $ pool -> getManager ( $ ... | Performed research on the model via their repository . |
15,456 | protected function getManagersPerCollection ( array $ referenceModels , array $ fields = array ( ) ) { $ this -> collections -> clean ( ) ; if ( empty ( $ fields ) ) { return ; } foreach ( $ this -> class -> getAssociationDefinitions ( ) as $ assoc ) { $ compatible = $ assoc -> getCompatible ( ) ; if ( ! empty ( $ comp... | Returns list of collection . |
15,457 | protected function handleCharacter34 ( ) { if ( ! $ this -> inSingleQuotes && $ this -> lastCharacter != 92 ) { $ this -> inQuotes = ! $ this -> inQuotes ; } return true ; } | Handle unescaped double quotes |
15,458 | protected function handleCharacter39 ( ) { if ( ! $ this -> inQuotes && $ this -> lastCharacter != 92 ) { $ this -> inSingleQuotes = ! $ this -> inSingleQuotes ; } return true ; } | Handle unescaped single quotes |
15,459 | public function get ( $ key , $ default = null ) { if ( empty ( $ key ) ) { return $ default ; } $ parts = explode ( "." , $ key ) ; $ file = array_shift ( $ parts ) ; if ( ! isset ( $ this -> registry [ $ file ] ) ) { $ this -> registry [ $ file ] = $ this -> discover ( $ file ) ; } $ res = $ this -> parse ( $ key ) ;... | Returns loaded config option . If the key is not found it checks if registered loaders can find the key . |
15,460 | public function set ( $ key , $ value ) { if ( empty ( $ key ) ) { throw new Exception ( "Key must be set" ) ; } $ parts = array_reverse ( explode ( "." , $ key ) ) ; $ file = array_pop ( $ parts ) ; if ( ! isset ( $ this -> registry [ $ file ] ) ) { $ this -> registry [ $ file ] = $ this -> discover ( $ file ) ; } for... | Registers a config variable |
15,461 | protected function discover ( $ resource ) { foreach ( $ this -> loaders as $ loader ) { $ res = $ loader -> load ( $ resource ) ; if ( ! is_null ( $ res ) ) { return $ res ; } } } | Tries to find needed resource by looping each of registered loaders . |
15,462 | protected function parse ( $ key ) { $ values = $ this -> registry ; $ parts = explode ( "." , $ key ) ; foreach ( $ parts as $ part ) { if ( $ part === "" ) { return $ values ; } if ( ! is_array ( $ values ) || ! array_key_exists ( $ part , $ values ) ) { return ; } $ values = $ values [ $ part ] ; } return $ values ;... | Search for a key with dot notation in the array . If the key is not found NULL is returned |
15,463 | public function first ( ) { $ path = $ this -> model -> getPath ( 'show' ) ; $ this -> query -> from ( $ path ) ; return $ this -> get ( ) -> first ( ) ; } | Execute a show on the API and get the first result . |
15,464 | public function get ( ) { $ hasFrom = ! is_null ( $ this -> query -> from ) ; if ( ! $ hasFrom ) { $ path = $ this -> model -> getPath ( 'index' ) ; $ this -> query -> from ( $ path ) ; } $ models = $ this -> getModels ( ) ; return $ this -> model -> newCollection ( $ models ) ; } | Execute an index on the API . |
15,465 | public function getModels ( ) { $ results = $ this -> query -> get ( ) ; $ connection = $ this -> model -> getConnectionName ( ) ; $ models = [ ] ; foreach ( $ results as $ result ) { $ models [ ] = $ model = $ this -> model -> newFromBuilder ( $ result ) ; $ model -> setConnection ( $ connection ) ; } return $ models ... | Get the hydrated models . |
15,466 | public function applyVariables ( $ groups , $ separator = '_' ) { if ( ! is_array ( $ groups ) ) { $ groups = array ( $ groups ) ; } foreach ( $ groups as $ group ) { $ values = $ this -> getVariables ( $ group ) ; $ this -> setEnvironmentVariables ( $ values , $ group , $ separator ) ; } } | Apply group s values as individual plain environment variables . |
15,467 | public function getVariables ( $ group ) { $ encodedValues = $ this -> getEnvironmentVariable ( $ group ) ; if ( $ encodedValues === null ) { return null ; } return $ this -> decode ( $ encodedValues ) ; } | Decode and decrypt values from a previously set environment variable . |
15,468 | public function getVariable ( $ group , $ name ) { $ variables = $ this -> getVariables ( $ group ) ; return array_key_exists ( $ name , $ variables ) ? $ variables [ $ name ] : null ; } | Decode and decrypt a single value from a previously set environment variable . |
15,469 | public function encode ( $ values ) { $ json = json_encode ( $ values ) ; $ this -> handleJsonError ( 'Failed to encode group values to JSON' ) ; return parent :: encode ( $ json ) ; } | Encrypt and encode group values . |
15,470 | public function decode ( $ value ) { $ json = parent :: decode ( $ value ) ; $ values = json_decode ( $ json , true ) ; $ this -> handleJsonError ( 'Failed to decode group values from JSON' ) ; return $ values ; } | Decode and decrypt group values . |
15,471 | public function addStack ( StackInterface $ stack ) : ResultInterface { $ this -> stack -> addStack ( $ stack , false ) ; return $ this ; } | Add items to the stack |
15,472 | final public function process ( BuildInterface $ build ) { $ result = $ this -> checkModified ( $ build ) ; $ this -> frame -> addResult ( $ result ) ; } | abstract process of a modification set . |
15,473 | public function validate ( & $ msg = null ) { if ( $ this -> frame instanceof ModificationSetInterface ) { return true ; } throw new MalformedConfigException ( $ this -> getName ( ) . ' must be inside of a "modificationset".' ) ; } | Check necessary variables are set . |
15,474 | public static function date ( $ format = "Y-m-d H:i:s" , $ time = null ) { $ time = ( $ time !== null ? $ time : time ( ) ) ; if ( ! is_numeric ( $ time ) ) { $ time = static :: toUnix ( $ time ) ; } return date ( $ format , $ time ) ; } | Formats the date . |
15,475 | public static function toUnix ( $ original ) { if ( is_numeric ( $ original ) ) { return $ original ; } if ( preg_match ( "/(?P<year>\d+)-(?P<month>\d+)-(?P<day>\d+) (?P<hour>\d+):(?P<minute>\d+):(?P<second>\d+)/" , $ original , $ match ) ) { return mktime ( $ match [ 'hour' ] , $ match [ 'minute' ] , $ match [ 'second... | Converts a datetime timestamp into a unix timestamp . |
15,476 | public static function agoInWords ( $ original , $ detailed = false ) { if ( ! is_numeric ( $ original ) ) { $ original = static :: toUnix ( $ original ) ; } $ now = time ( ) ; $ chunks = array ( array ( 60 * 60 * 24 * 365 , 'year' , 'years' ) , array ( 60 * 60 * 24 * 30 , 'month' , 'months' ) , array ( 60 * 60 * 24 * ... | Returns time ago in words of the given date . |
15,477 | private function find ( $ locale , $ dictionary , $ keys ) { if ( ! isset ( $ this -> entries [ $ locale ] [ $ dictionary ] ) ) { if ( ! isset ( $ this -> entries [ $ locale ] ) ) { $ this -> entries [ $ locale ] = [ ] ; } $ file = $ this -> dictionaryFile ( $ dictionary , $ locale ) ; $ this -> entries [ $ locale ] [ ... | Find the translation . |
15,478 | private function dictionaryFile ( $ dictionary , $ locale ) { $ file = $ this -> languagePath . DIRECTORY_SEPARATOR . $ locale . DIRECTORY_SEPARATOR . $ dictionary . '.php' ; if ( file_exists ( $ file ) ) { return $ file ; } if ( $ this -> manifest === null ) { $ this -> manifest = file_exists ( $ this -> pluginManifes... | Get the full filename of the dictionary . |
15,479 | public function selectRenderer ( ViewEvent $ e ) { $ model = $ e -> getModel ( ) ; if ( $ model instanceof NewsletterViewModel ) { return $ this -> renderer ; } return false ; } | Detect if we should use the NewsletterRenderer based on model type |
15,480 | public function formatCode ( string $ code , $ enableColors ) : string { $ block = [ ] ; $ codeLines = explode ( "\n" , $ code ) ; $ this -> enableColors = ( bool ) $ enableColors ; $ this -> numberOfLines = count ( $ codeLines ) ; $ this -> gutterWidth = strlen ( ( string ) $ this -> numberOfLines ) + 1 ; $ i = 0 ; fo... | Formats the given code |
15,481 | public function merge ( MetaData $ data ) : void { foreach ( $ data -> toArray ( ) as $ key => $ value ) { $ this -> set ( $ key , $ value ) ; } } | Merges the given meta data |
15,482 | protected function isValid ( $ value ) : bool { $ type = gettype ( $ value ) ; switch ( $ type ) { case 'string' : case 'integer' : case 'double' : case 'boolean' : case 'NULL' : return true ; break ; case 'array' : return ArrayCollection :: create ( $ value ) -> every ( function ( $ v ) { return $ this -> isValid ( $ ... | Checks if a value is valid |
15,483 | public function getConnection ( ) { if ( null === $ this -> connection ) { $ this -> setConnection ( \ Doctrine_Manager :: getInstance ( ) -> getCurrentConnection ( ) ) ; } return $ this -> connection ; } | Get doctrine connection |
15,484 | protected function prepeareQuery ( $ value ) { $ query = \ Doctrine_Query :: create ( $ this -> getConnection ( ) ) -> select ( $ this -> getField ( ) ) -> from ( $ this -> getTable ( ) ) -> where ( sprintf ( '%s = ?' , $ this -> getField ( ) ) , $ value ) ; foreach ( $ this -> getExclude ( ) as $ exclude => $ value ) ... | Prepare validate query |
15,485 | public function passwordFieldRow ( $ model , $ property , $ htmlOptions = array ( ) , $ validators = NULL ) { $ htmlOptions [ 'value' ] = Cii :: decrypt ( $ model -> $ property ) ; $ htmlOptions [ 'type' ] = 'password' ; $ htmlOptions [ 'id' ] = get_class ( $ model ) . '_' . $ property ; $ htmlOptions [ 'name' ] = get_... | passwordFieldRow provides a password box that decrypts the database stored value since it will be encrypted in the db |
15,486 | public function numberFieldRow ( $ model , $ property , $ htmlOptions = array ( ) , $ validators = NULL ) { if ( $ validators !== NULL ) { foreach ( $ validators as $ k => $ v ) { if ( get_class ( $ v ) == "CNumberValidator" ) { $ htmlOptions [ 'min' ] = $ v -> min ; $ htmlOptions [ 'step' ] = 1 ; } if ( get_class ( $ ... | numberRow HTML5 number elemtn to work with |
15,487 | public function rangeFieldRow ( $ model , $ property , $ htmlOptions = array ( ) , $ validators = NULL ) { if ( $ validators !== NULL ) { foreach ( $ validators as $ k => $ v ) { if ( get_class ( $ v ) == "CNumberValidator" ) { $ htmlOptions [ 'min' ] = $ v -> min ; $ htmlOptions [ 'max' ] = $ v -> max ; $ htmlOptions ... | rangeRow provides a pretty ish range slider with view controls |
15,488 | private function checkPerfilExists ( $ perfilId ) { $ db = $ this -> db ; $ perfil = $ db -> fetchAssoc ( 'SELECT * FROM singular_perfil WHERE id = ' . $ perfilId ) ; return is_array ( $ perfil ) ? true : false ; } | Verifica se um perfil existe . |
15,489 | public function registerMinimal ( string $ filePath = null ) { is_file ( $ filePath ) || $ filePath = App :: getBasePath ( ) . $ filePath ; if ( is_file ( $ filePath ) ) { $ configItems = require_once $ filePath ; ! is_array ( $ configItems ) || Config :: items ( $ configItems ) ; ini_set ( 'error_reporting' , Config :... | Registers the minimal config file . It stores the array items from the minimal config file in the Config object and eventually sets the phpini error_reporting and display_errors . |
15,490 | public function registerConfig ( string $ filePath = null ) { is_file ( $ filePath ) || $ filePath = App :: getBasePath ( ) . $ filePath ; if ( is_file ( $ filePath ) ) { $ configItems = require_once $ filePath ; if ( is_array ( $ configItems ) ) { foreach ( $ configItems as $ key => $ value ) { if ( Config :: exists (... | Registers the main config file . It stores the array items from the main config file in the Config object . It will merge recursively with other items in the Config object . It eventually sets the phpini error_reporting and display_errors |
15,491 | public function get ( string $ key ) { $ result = $ this -> strings [ $ key ] ?? $ key ; if ( is_string ( $ result ) && substr ( $ result , 0 , 2 ) == '@@' ) { $ result = $ this -> get ( substr ( $ result , 2 ) ) ; } if ( $ result == $ key && isset ( $ this -> fallback_language ) ) { $ result = $ this -> fallback_langu... | Returns the string of string of a specific language key or an array of strings flagge as preserved |
15,492 | public static function create ( $ path = false , $ mode = 0777 ) { if ( $ path && ! self :: isFolder ( dirname ( $ path ) ) && self :: isWritable ( dirname ( $ path ) ) ) { mkdir ( $ path , $ mode ) ; if ( Folder :: isFolder ( $ path ) ) { return true ; } } return false ; } | Create an empty folder . |
15,493 | public static function find ( $ fileName = false , $ path = false ) { if ( $ fileName ) { if ( ! $ path ) { $ path = __DIR__ ; } if ( self :: isFolder ( $ path ) ) { $ dir = new \ RecursiveDirectoryIterator ( $ path ) ; foreach ( new \ RecursiveIteratorIterator ( $ dir ) as $ filePath ) { if ( $ fileName == basename ( ... | Find file with a given name inside a given directory . |
15,494 | public static function get ( $ path = false ) { if ( $ path && self :: isFolder ( $ path ) ) { $ list = array ( ) ; $ tmpList = scandir ( $ path ) ; foreach ( $ tmpList as $ k => $ item ) { if ( $ item != '.' && $ item != '..' && $ item != '.DS_Store' ) { $ list [ ] = $ item ; } } return $ list ; } return false ; } | Get list of all files in a given directory . |
15,495 | public function getPeopleIdFromFullName ( $ fullName ) { $ result = DB :: table ( 'peoples' ) -> where ( 'first_name' , $ this -> getFirstName ( $ fullName ) ) -> where ( 'middle_name' , $ this -> getMiddleName ( $ fullName ) ) -> where ( 'surname' , $ this -> getLastName ( $ fullName ) ) -> first ( ) ; if ( count ( $ ... | get the peoples ID from the full name |
15,496 | public function isAllowedPeopleIdSingleContactDisplay ( $ id ) { if ( $ id == 0 ) { return false ; } $ allowedIDs = Config :: get ( 'lasallecrmcontact.single_contact_display_people_id_allowed' ) ; foreach ( $ allowedIDs as $ allowedID ) { if ( $ allowedID == $ id ) { return true ; } } return false ; } | Is this people ID allowed to be displayed in the single contact display? |
15,497 | protected function _send ( ) { $ message = $ this -> build_message ( true ) ; if ( empty ( $ this -> config [ 'smtp' ] [ 'host' ] ) or empty ( $ this -> config [ 'smtp' ] [ 'port' ] ) ) { throw new \ FuelException ( 'Must supply a SMTP host and port, none given.' ) ; } $ authenticate = ( empty ( $ this -> smtp_connecti... | Initalted all needed for SMTP mailing . |
15,498 | protected function smtp_connect ( ) { if ( ! empty ( $ this -> smtp_connection ) ) { return ; } if ( strpos ( $ this -> config [ 'smtp' ] [ 'host' ] , '://' ) === false ) { $ this -> config [ 'smtp' ] [ 'host' ] = 'tcp://' . $ this -> config [ 'smtp' ] [ 'host' ] ; } $ this -> smtp_connection = stream_socket_client ( $... | Connects to the given smtp and says hello to the other server . |
15,499 | protected function smtp_authenticate ( ) { $ username = base64_encode ( $ this -> config [ 'smtp' ] [ 'username' ] ) ; $ password = base64_encode ( $ this -> config [ 'smtp' ] [ 'password' ] ) ; try { $ this -> smtp_send ( 'AUTH LOGIN' , 334 ) ; $ this -> smtp_send ( $ username , 334 ) ; $ this -> smtp_send ( $ passwor... | Performs authentication with the SMTP host |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.