idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
59,900 | public static function parse ( $ yaml ) { return SymfonyYaml :: parse ( $ yaml , $ exceptionOnInvalidType = true , $ objectSupport = true , $ objectForMap = false ) ; } | Parse YAML into an object or array . |
59,901 | public static function parseFile ( $ filename ) { $ file = new SplFileInfo ( $ filename ) ; if ( ! $ file -> isFile ( ) ) { throw new RuntimeException ( 'Invalid filename supplied for `RadHam\Yaml::parseFile()`.' ) ; } $ contents = file_get_contents ( $ file -> getPathname ( ) ) ; return self :: parse ( $ contents ) ; ... | Parse a YAML file into an object or array . |
59,902 | public function build ( $ command ) { return sprintf ( '%s %s/%s %s --env=%s --no-debug' , PhpUtils :: getPhp ( ) , $ this -> consoleDir , 'console' , $ command , $ this -> environment ) ; } | Build command . |
59,903 | protected function taskPhpMd ( $ dir = null , $ format = 'xml' , $ extensions = [ ] ) { return $ this -> task ( PhpMd :: class , $ dir , $ format , $ extensions ) ; } | Creates a PHPMD task . |
59,904 | public function validate ( IUser $ user ) : bool { if ( null === $ password = make ( IPasswordRepository :: class ) -> getByUser ( $ user ) ) { return false ; } return make ( IPasswordHandler :: class ) -> verify ( $ this -> password , $ password -> value ( ) ) ; } | Validate user s credentials |
59,905 | private function getFilters ( $ type ) { $ filters = [ ] ; if ( 'contao' === $ type ) { $ filters [ ] = function ( $ package ) { return in_array ( $ package -> getType ( ) , [ 'contao-module' , 'contao-bundle' , 'legacy-contao-module' ] ) ; } ; } return $ filters ; } | Get the array of filter closures . |
59,906 | private function getRepositorySearch ( $ keywords , $ type , Composer $ composer , $ threshold ) { $ repositoryManager = $ composer -> getRepositoryManager ( ) ; $ localRepository = $ repositoryManager -> getLocalRepository ( ) ; $ repositories = new CompositeRepository ( [ $ localRepository ] ) ; if ( 'installed' !== ... | Create a repository search instance . |
59,907 | public static function buildFromSplFileInfo ( \ SplFileInfo $ fileInfo ) { $ uniqueId = $ fileInfo -> getBasename ( ) ; $ file = $ fileInfo -> openFile ( ) ; $ query = '' ; while ( ! $ file -> eof ( ) ) { $ query .= $ file -> fgets ( ) ; } return new UnitOfWork ( new Uid ( $ uniqueId ) , new Workload ( $ query ) , new ... | Builds a UnitOfWork instance from the given \ SplFileInfo |
59,908 | public static function setmycookies ( $ status , $ cookies , $ cookiedomain , $ cookiepath , $ expires = 0 , $ secure = 0 , $ httponly = 1 ) { $ options = array ( ) ; $ options [ 'cookiedomain' ] = $ cookiedomain ; $ options [ 'cookiepath' ] = $ cookiepath ; $ options [ 'expires' ] = $ expires ; $ options [ 'secure' ] ... | sets my cookies |
59,909 | public static function ipCidrsCheck ( $ p_ip , $ p_cidrs ) { foreach ( $ p_cidrs as $ name => $ range ) { if ( self :: ipCidrCheck ( $ p_ip , $ range ) ) { return true ; } } return false ; } | Check Ip in a list of cidrs |
59,910 | public static function ipCidrCheck ( $ p_ip , $ p_cidr ) { if ( strpos ( $ p_cidr , '/' ) !== false ) { list ( $ net , $ mask ) = split ( "/" , $ p_cidr ) ; $ ip_net = ip2long ( $ net ) ; $ ip_mask = ~ ( ( 1 << ( 32 - $ mask ) ) - 1 ) ; $ ip_ip = ip2long ( $ p_ip ) ; $ ip_ip_net = $ ip_ip & $ ip_mask ; return ( $ ip_ip... | Check ip in a cidr |
59,911 | public function check ( Subject $ subject ) : ResultCollection { $ resultCollection = new ResultCollection ( ) ; foreach ( $ this -> collection as $ rule ) { $ resultCollection -> merge ( $ rule -> check ( $ subject ) ) ; } return $ resultCollection ; } | Check all rules in collection |
59,912 | private function AddCheckedField ( ) { $ field = new Fields \ Checkbox ( 'Checked' , '1' , $ this -> checkbox -> GetChecked ( ) ) ; $ this -> AddField ( $ field ) ; } | Adds the checked flag field |
59,913 | private function AddCheckedValueField ( ) { $ name = 'CheckedValue' ; $ value = $ this -> checkbox -> GetCheckedValue ( ) ; $ field = Fields \ Input :: Text ( $ name , $ value ? $ value : '1' ) ; $ this -> AddField ( $ field ) ; $ this -> SetRequired ( $ name ) ; } | Adds the checked value field |
59,914 | public function t ( $ str , $ filename = "template" ) { $ this -> forceUpdateLocale ( ) ; $ key = "{$filename}.{$str}" ; $ transl = Lang :: get ( $ key ) ; if ( $ transl != $ key ) { return $ transl ; } return $ this -> strict_mode ? '' : $ str ; } | Translate a string to the current language |
59,915 | public function set ( $ lang ) { if ( ! array_key_exists ( $ lang , $ this -> getList ( ) ) ) { throw new LanguageNotPresentException ; } $ this -> locator -> set ( $ lang ) ; return $ lang ; } | Sets the current client language |
59,916 | public function verifyAndDecodeToken ( $ token , $ checkRevoked = true ) { $ payload = JWT :: decode ( $ token , $ this -> getPublicKey ( ) , [ self :: CRYPTO_ALG ] ) ; if ( $ checkRevoked && $ this -> checkRevokedToken ( $ token , $ payload ) ) throw new TokenRevokedException ( 'Token is revoked.' ) ; return $ payload... | Verify and decode a JWT token |
59,917 | public function getUserInfo ( $ accessToken = null , $ cacheDuration = - 1 ) { try { if ( $ accessToken == null && ! empty ( $ at = $ this -> getAccessToken ( ) ) ) $ accessToken = $ at -> token ; } catch ( Exception $ e ) { Yii :: error ( $ e -> getMessage ( ) ) ; } $ userInfo = null ; if ( ! empty ( $ accessToken ) )... | Get user information from OAuth2 provider |
59,918 | public function checkRevokedToken ( $ token , $ payload ) { if ( ! empty ( $ payload ) && Yii :: $ app -> cache ) { return Yii :: $ app -> cache -> get ( $ this -> getRevokedTokenCacheKey ( $ token ) ) !== false ; } return false ; } | Check if token is revoked |
59,919 | public function saveRevokedToken ( $ token , $ payload ) { if ( ! empty ( $ payload ) && property_exists ( $ payload , 'exp' ) && Yii :: $ app -> cache ) { $ duration = ( int ) $ payload -> exp + JWT :: $ leeway - time ( ) ; if ( $ duration > 0 ) Yii :: $ app -> cache -> set ( $ this -> getRevokedTokenCacheKey ( $ toke... | Save revoked token to cache |
59,920 | public function logout ( $ globalLogout = true ) { $ this -> isLoggingOut = true ; $ identity = Yii :: $ app -> user -> identity ; if ( $ globalLogout ) Yii :: $ app -> user -> logout ( ) ; try { if ( $ identity != null && ! empty ( $ identity -> sid ) ) { $ token = $ this -> getAccessToken ( ) -> token ; $ headers = [... | Logout the current user by identity |
59,921 | public static function getInstance ( ) { if ( ! isset ( self :: $ _instance ) ) { $ user = Yii :: $ app -> user ; if ( isset ( $ user -> authClientConfig ) && isset ( $ user -> authClientConfig [ 'collection' ] ) && isset ( $ user -> authClientConfig [ 'id' ] ) ) { $ collection = Yii :: $ app -> get ( $ user -> authCli... | Get singleton instance using Yii s auth client configuration |
59,922 | private function configureProcessProperties ( OptionsResolver $ resolver ) { $ resolver -> setRequired ( 'command' ) -> setAllowedTypes ( 'command' , 'string' ) ; $ resolver -> setDefined ( 'process_name' ) -> setAllowedTypes ( 'process_name' , 'string' ) ; $ resolver -> setDefined ( 'numprocs' ) ; $ this -> configureI... | Configures process related properties |
59,923 | private function configureStartControlProperties ( OptionsResolver $ resolver ) { $ resolver -> setDefined ( 'autostart' ) ; $ this -> configureBooleanProperty ( 'autostart' , $ resolver ) ; $ resolver -> setDefined ( 'autorestart' ) -> setAllowedTypes ( 'autorestart' , [ 'bool' , 'string' ] ) -> setAllowedValues ( 'au... | Configures start control related properties |
59,924 | private function configureStopControlProperties ( OptionsResolver $ resolver ) { $ resolver -> setDefined ( 'exitcodes' ) ; $ this -> configureArrayProperty ( 'exitcodes' , $ resolver ) ; $ resolver -> setDefined ( 'stopsignal' ) -> setAllowedTypes ( 'stopsignal' , 'string' ) -> setAllowedValues ( 'stopsignal' , [ 'TER... | Configures stop control related properties |
59,925 | private function configureLogProperties ( OptionsResolver $ resolver ) { $ resolver -> setDefined ( 'redirect_stderr' ) ; $ this -> configureBooleanProperty ( 'redirect_stderr' , $ resolver ) ; $ this -> configureStdoutLogProperties ( $ resolver ) ; $ this -> configureStderrLogProperties ( $ resolver ) ; } | Configures log related properties |
59,926 | private function configureStderrLogProperties ( OptionsResolver $ resolver ) { $ resolver -> setDefined ( 'stderr_logfile' ) -> setAllowedTypes ( 'stderr_logfile' , 'string' ) ; $ resolver -> setDefined ( 'stderr_logfile_maxbytes' ) ; $ this -> configureByteProperty ( 'stderr_logfile_maxbytes' , $ resolver ) ; $ resolv... | Configures stderr log related properties |
59,927 | public static function start ( ) { static :: $ time = microtime ( true ) ; static :: $ memory = memory_get_usage ( true ) ; self :: log ( static :: $ time , _t ( "Start execution time" ) , "info" ) ; } | Records the debugger and system start time |
59,928 | public static function log ( $ string , $ title = "Console Log" , $ type = "info" , $ typekey = "" , $ console = TRUE , $ logFile = TRUE ) { return static :: _ ( $ string , $ title , $ type , $ typekey , $ console , $ logFile ) ; } | Provides an alias for the log message method |
59,929 | public static function stop ( ) { $ now = microtime ( true ) ; $ speed = number_format ( 1000 * ( $ now - static :: $ time ) , 2 ) ; $ _memory = memory_get_usage ( ) ; $ units = array ( 'Bytes' , 'KB' , 'MB' , 'GB' , 'TB' , 'PB' ) ; $ memory = @ round ( $ _memory / pow ( 1024 , ( $ i = floor ( log ( $ _memory , 1024 ) ... | Records the debugger stop and stystem stop time Ideally the last method to be called before the output is sent to the server |
59,930 | public function dataContainsImportFile ( $ data , $ filename ) { if ( ! is_array ( $ data ) || ! isset ( $ data [ 'imports' ] ) || ! is_array ( $ data [ 'imports' ] ) ) { return false ; } foreach ( $ data [ 'imports' ] as $ value ) { if ( $ value [ 'resource' ] === $ filename ) { return true ; } } return false ; } | Check if the given data is an array containing a Symfony config import statement for the given file name . |
59,931 | public function sortImports ( array $ data , $ prefix = '' ) { if ( ! isset ( $ data [ 'imports' ] ) || ! is_array ( $ data [ 'imports' ] ) ) { return $ data ; } $ importsBeforePrefixed = array ( ) ; $ importsWithPrefix = array ( ) ; $ importsAfterPrefixed = array ( ) ; foreach ( $ data [ 'imports' ] as $ import ) { $ ... | Sort the imports key children of the given array by resource name . |
59,932 | public function addParameterToFile ( $ filename , $ name , $ value , $ preserveFormatting , $ addComment = null ) { $ content = file_get_contents ( $ filename ) ; $ data = Yaml :: parse ( $ content ) ; if ( $ preserveFormatting ) { $ content = rtrim ( $ content ) ; $ c = Yaml :: dump ( array ( 'parameters' => array ( $... | Add the given parameter name and value to the given parameters . yml file . |
59,933 | public function applyTemplateController ( $ ctr ) { if ( $ ctr instanceof TemplateController ) { $ this -> templateController = $ ctr ; array_merge ( $ this -> settings , $ this -> templateController -> getSettings ( ) ) ; $ lang = $ this -> templateController -> getLanguageStrings ( ) ; if ( $ lang != null ) if ( $ th... | Allows you to apply a Template to this controller . |
59,934 | public function doAction ( $ actionName ) { if ( isset ( $ this -> actions [ $ actionName ] ) ) return call_user_func_array ( array ( $ this , $ this -> actions [ $ actionName ] ) , array ( ) ) ; } | Executes the action This will call the function registered earlier |
59,935 | protected function registerEvent ( $ eventName , $ funcName ) { \ OWeb \ manage \ events :: getInstance ( ) -> registerEvent ( $ eventName , $ this , $ funcName ) ; } | Registers an event to whom this controller needs to respond |
59,936 | public function loadParams ( ) { switch ( $ this -> action_mode ) { case self :: ACTION_DOUBLE : $ a = array_merge ( \ OWeb \ OWeb :: getInstance ( ) -> get_post ( ) , \ OWeb \ OWeb :: getInstance ( ) -> get_get ( ) ) ; break ; case self :: ACTION_GET : $ a = \ OWeb \ OWeb :: getInstance ( ) -> get_get ( ) ; break ; ca... | Automatically loads parameters throught PHP get and Post variables |
59,937 | public function getParam ( $ paramName ) { if ( isset ( $ this -> params [ $ paramName ] ) ) return $ this -> params [ $ paramName ] ; else return null ; } | Gets the value of a parameter |
59,938 | protected function InitLanguageFile ( ) { if ( $ this -> language == null ) $ this -> language = new Language ( ) ; $ this -> InitRecLanguageFile ( get_class ( $ this ) ) ; } | Thiw will activate the usage f the configuration files . |
59,939 | public function forceDisplay ( $ ctr = null ) { if ( ! $ this -> viewReady ) { $ this -> prepareView ( $ ctr ) ; } $ this -> view -> display ( ) ; } | Displays the controllers view |
59,940 | public function notify ( string $ event , array $ arguments = null ) { if ( isset ( $ this -> events [ $ event ] ) ) { foreach ( $ this -> events [ $ event ] as $ priorityKey => $ callbackKey ) { $ output = $ this -> subscriptions [ $ callbackKey ] ( $ this , $ arguments ?? [ ] ) ; if ( isset ( $ output [ 'stop' ] ) &&... | Notifies listeners about an event . |
59,941 | public function get ( $ url , $ sloppy304 = false ) { if ( ! $ this -> sendRequest ( $ url ) ) { return false ; } if ( $ this -> rspStatus == 304 && $ sloppy304 ) { return $ this -> rspBody ; } if ( $ this -> rspStatus != 200 ) { return false ; } return $ this -> rspBody ; } | fetch the contents of a web page |
59,942 | public function post ( $ url , $ data = array ( ) ) { if ( ! $ this -> sendRequest ( $ url , $ data , 'POST' ) ) { return false ; } if ( $ this -> rspStatus != 200 ) { return false ; } return $ this -> rspBody ; } | post request data |
59,943 | protected function debug ( $ info , $ var = null ) { if ( ! $ this -> debug ) { return ; } print '<b>' . $ info . '</b> ' . ( microtime ( 1 ) - $ this -> start ) . 's<br />' . "\r\n" ; if ( ! is_null ( $ var ) ) { $ content = var_export ( $ var , 1 ) ; print "<pre>\r\n$content\r\n</pre>\r\n" ; } } | print debug info |
59,944 | protected function parseHeaders ( $ string ) { $ headers = array ( ) ; $ lines = explode ( "\r\n" , trim ( $ string ) ) ; foreach ( $ lines as $ line ) { @ list ( $ key , $ val ) = explode ( ':' , $ line , 2 ) ; $ key = strtolower ( trim ( $ key ) ) ; $ val = trim ( $ val ) ; if ( empty ( $ val ) ) continue ; if ( isse... | convert given header string to Header array |
59,945 | protected function buildHeaders ( $ headers ) { $ string = '' ; foreach ( $ headers as $ key => $ value ) { if ( empty ( $ value ) ) continue ; $ string .= $ key . ': ' . $ value . "\r\n" ; } return $ string ; } | convert given header array to header string |
59,946 | protected function getCookies ( ) { $ headers = '' ; foreach ( $ this -> cookies as $ key => $ val ) { if ( $ headers ) $ headers .= '; ' ; $ headers .= $ key . '=' . $ val ; } if ( $ headers ) { $ headers = "Cookie: $headers" . "\r\n" ; } return $ headers ; } | get cookies as http header string |
59,947 | protected function buildSuffixesLexer ( FormatToken $ token ) { $ choices = [ ] ; $ i = 0 ; $ repetitions = 0 ; while ( $ label = $ this -> locale -> getNumberOrdinalSuffix ( $ i ++ ) ) { if ( ! in_array ( $ label , $ choices ) ) { $ choices [ ] = $ label ; $ repetitions = 0 ; } elseif ( ++ $ repetitions > 5 ) { break ... | Builds a choice lexer based on the getNumberOrdinalSuffix localisation method . |
59,948 | public function packageListAction ( Request $ request ) { $ composer = $ this -> getComposer ( ) ; $ converter = new PackageConverter ( $ composer -> getPackage ( ) ) ; $ upgrades = $ this -> getUpgradeRepository ( ) ; $ packages = $ converter -> convertRepositoryToArray ( $ composer -> getRepositoryManager ( ) -> getL... | Retrieve the package list . |
59,949 | public function getPackageAction ( $ vendor , $ package ) { $ packageName = $ vendor . '/' . $ package ; $ composer = $ this -> getComposer ( ) ; if ( $ package = $ this -> findPackage ( $ packageName , $ composer -> getRepositoryManager ( ) -> getLocalRepository ( ) ) ) { $ converter = new PackageConverter ( $ compose... | Retrieve a package . |
59,950 | public function putPackageAction ( $ vendor , $ package , Request $ request ) { $ packageName = $ vendor . '/' . $ package ; $ info = new JsonArray ( $ request -> getContent ( ) ) ; $ name = $ info -> get ( 'name' ) ; if ( ! ( $ info -> has ( 'name' ) && $ info -> has ( 'locked' ) && $ info -> has ( 'constraint' ) ) ) ... | Update the information of a package in the composer . json . |
59,951 | private function findPackage ( $ name , RepositoryInterface $ repository ) { $ packages = $ repository -> findPackages ( $ name ) ; while ( ! empty ( $ packages ) && $ packages [ 0 ] instanceof AliasPackage ) { array_shift ( $ packages ) ; } if ( empty ( $ packages ) ) { return null ; } return $ packages [ 0 ] ; } | Search the repository for a package . |
59,952 | private function getUpgradeRepository ( ) { $ upgradeFile = $ this -> getTensideDataDir ( ) . DIRECTORY_SEPARATOR . 'upgrades.json' ; if ( ! file_exists ( $ upgradeFile ) ) { return null ; } $ packageLoader = new ArrayLoader ( ) ; $ packageChanges = new WritableArrayRepository ( ) ; $ upgrades = new JsonFile ( $ upgrad... | Load a repository containing available upgrades . |
59,953 | public function offsetGet ( $ columnName ) { $ row = current ( $ this -> _rows ) ; return $ row !== false ? $ row [ $ columnName ] : null ; } | Gets the column value . |
59,954 | public function insert ( ) : self { $ data = $ this ; if ( ! $ this -> validate ( "post" , $ missing ) ) { throw new \ Exception ( "[MVQN\REST\Endpoints\Endpoint] Annotations for the '" . get_class ( $ this ) . "' class require valid values be set " . "on all of the following properties before attempting an insert():\n... | Attempts to INSERT this Endpoint object using the class s annotated information via a HTTP POST Request . |
59,955 | public static function post ( Endpoint $ data , array $ params = [ ] ) : Endpoint { $ class = get_called_class ( ) ; $ annotations = new AnnotationReader ( $ class ) ; $ endpoints = $ annotations -> getClassAnnotation ( "endpoints" ) ; $ endpoint = array_key_exists ( "post" , $ endpoints ) ? $ endpoints [ "post" ] : ""... | Sends a HTTP POST Request on behalf of the Endpoint given optional parameters . |
59,956 | public static function get ( string $ override = "" , array $ params = [ ] , array $ query = [ ] ) : Collection { $ class = get_called_class ( ) ; $ excludeId = false ; if ( $ override === "" ) { $ annotations = new AnnotationReader ( $ class ) ; $ endpoints = $ annotations -> getClassAnnotation ( "endpoints" ) ; $ exc... | Sends an HTTP GET Request using the calling class s annotated information for all objects at this Endpoint . |
59,957 | public static function getById ( int $ id ) : ? Endpoint { $ class = get_called_class ( ) ; $ annotations = new AnnotationReader ( $ class ) ; $ endpoints = $ annotations -> getClassAnnotation ( "endpoints" ) ; if ( ! array_key_exists ( "getById" , $ endpoints ) ) throw new \ Exception ( "[MVQN\REST\Endpoints\Endpoint]... | Sends an HTTP GET Request using the calling class s annotated information for a single object given the ID . |
59,958 | public function update ( ) : self { $ data = $ this ; if ( ! $ this -> validate ( "patch" , $ missing ) ) { throw new \ Exception ( "[MVQN\REST\Endpoints\Endpoint] Annotations for the '" . get_class ( $ this ) . "' class require valid values be set " . "on all of the following properties before attempting an update():\... | Attempts to UPDATE this Endpoint object using the class s annotated information via a HTTP PATCH Request . |
59,959 | public static function getRoutes ( ) { $ routes = new \ FreeFW \ Router \ RouteCollection ( ) ; $ paths = [ ] ; $ paths [ ] = __DIR__ . '/../resource/routes/restful/v1/routes.php' ; foreach ( $ paths as $ idx => $ onePath ) { $ apiRoutes = @ include ( $ onePath ) ; if ( is_array ( $ apiRoutes ) ) { foreach ( $ apiRoute... | Retourne une liste de routes au format FreeFW |
59,960 | protected function prepareValue ( $ value ) { switch ( gettype ( $ value ) ) { case OptionInterface :: TYPE_BOOLEAN : return ( $ value ) ? 'true' : 'false' ; case OptionInterface :: TYPE_NUMBER : return $ value ; case OptionInterface :: TYPE_STRING : return "'" . $ value . "'" ; } } | Prepares value to use in DataGrid JS configuration |
59,961 | protected function registerDefaultParser ( ) { $ this -> registerMediaTypeParser ( 'application/json' , function ( string $ input ) { $ result = json_decode ( $ input , true ) ; if ( ! is_array ( $ result ) ) { return null ; } return $ result ; } , null ) ; $ this -> registerMediaTypeParser ( 'application/xml' , functi... | Register Default Parser |
59,962 | public function getMediaType ( ) { $ contentType = $ this -> getContentType ( ) ; if ( is_string ( $ contentType ) ) { $ contentTypeParts = preg_split ( '/\s*[;,]\s*/' , $ contentType ) ; return isset ( $ contentTypeParts [ 0 ] ) ? strtolower ( $ contentTypeParts [ 0 ] ) : null ; } return null ; } | Get request media type if known . |
59,963 | private static function reconstructOriginalKey ( string $ key ) { if ( strpos ( $ key , 'HTTP_' ) === 0 ) { $ key = substr ( $ key , 5 ) ; } return strtr ( ucwords ( strtr ( strtolower ( $ key ) , '_' , ' ' ) ) , ' ' , '-' ) ; } | Reconstruct original header name |
59,964 | public static function createFromGlobalsResolveCLIRequest ( array $ globals = null ) : Request { $ globals = static :: manipulateIfCLIRequest ( ( $ globals === null ? Uri :: fixSchemeProxyFromGlobals ( $ _SERVER ) : $ globals ) ) ; return static :: createFromGlobals ( $ globals ) ; } | Create new HTTP request with data extracted from the application Environment object that Allowed CLI |
59,965 | public function name ( string $ string ) : RoleObject { $ this -> role [ ] = $ role = new RoleObject ( $ string ) ; return $ role ; } | create new role |
59,966 | public function sendMailToAdministrators ( $ envoyeur = 'archi-strasbourg' , $ sujet = '' , $ message = '' , $ criteres = '' , $ writeMailToLogs = false , $ isEnvoiRegroupeDesactive = false , $ logfile = 'mail.log' ) { $ replyTo = "" ; if ( is_array ( $ envoyeur ) ) { $ replyTo = $ envoyeur [ "replyTo" ] ; $ envoyeur =... | Envoi d un mail a tous les administrateurs |
59,967 | public function saveMailToLogs ( $ params = array ( ) ) { if ( isset ( $ params [ 'destinataire' ] ) && isset ( $ params [ 'sujet' ] ) && isset ( $ params [ 'message' ] ) && isset ( $ params [ 'debug' ] ) ) { $ debugValue = false ; if ( $ params [ 'debug' ] == true ) { $ debugValue = true ; } $ message = strip_tags ( $... | Effectue une sauvegarde du mail |
59,968 | public function listAction ( Request $ request ) { $ mediaTypeManager = $ this -> get ( 'phlexible_media_type.media_type_manager' ) ; $ iconResolver = $ this -> get ( 'phlexible_media_type.icon_resolver' ) ; $ mediaTypes = [ ] ; foreach ( $ mediaTypeManager -> findAll ( ) as $ mediaType ) { $ mediaTypes [ ] = [ 'id' =>... | List media types . |
59,969 | public function isValidLocale ( $ locale ) { foreach ( $ this -> locales as $ validLocale ) { if ( strcmp ( $ validLocale , $ locale ) == 0 ) { return true ; } } return false ; } | REturns whether or not the locale is valid |
59,970 | public function setUrl ( ) { $ name = preg_replace ( "/[^a-zA-Z0-9]+/" , " " , $ this -> getUsername ( ) ) ; $ name = preg_replace ( '!\s+!' , ' ' , trim ( $ name ) ) ; $ this -> url = '/authors/' . str_replace ( " " , "-" , strtolower ( $ name ) ) . '.html' ; } | Set URL of author page |
59,971 | public function remove ( $ element ) : bool { if ( ! $ this -> contains ( $ element ) ) { return false ; } $ index = array_search ( $ element , $ this -> elements , true ) ; unset ( $ this -> elements [ $ index ] ) ; return ! $ this -> contains ( $ element ) ; } | Removes element and checks if collection not contains it anymore |
59,972 | public function animate ( ) { for ( $ time = 0 ; $ time <= $ this -> meta [ 't' ] ; $ time += $ this -> meta [ 'f' ] ) { foreach ( $ this -> frames as $ frame ) { fwrite ( STDOUT , $ frame ) ; $ this -> sleepMilli ( $ this -> meta [ 'f' ] ) ; Console :: moveCursorRel ( - $ this -> meta [ 'w' ] , - $ this -> meta [ 'h' ... | Displays animation on screen |
59,973 | public function getFullName ( ) { if ( $ this -> firstName && $ this -> lastName ) { return "{$this->firstName} {$this->lastName}" ; } elseif ( $ this -> firstName ) { return $ this -> firstName ; } elseif ( $ this -> lastName ) { return $ this -> lastName ; } else { return '' ; } } | Get fullName . |
59,974 | public function setViewModel ( ViewModel $ viewModel ) { $ viewModel -> setVariable ( "formName" , $ this -> getName ( ) ) ; if ( $ this -> getFormAction ( ) != "" ) { $ viewModel -> setVariable ( "formAction" , $ this -> getFormAction ( ) ) ; } else { throw new \ Exception ( "You must provide a formAction" ) ; } $ wiz... | the template of the viewModel must provide variables currentStep and fromName |
59,975 | public function getBreaker ( $ name ) { if ( ! array_key_exists ( $ name , $ this -> instances ) ) { $ this -> instances [ $ name ] = new CircuitBreaker ( $ name , $ this -> storage ) ; } return $ this -> instances [ $ name ] ; } | Returns a circuit breaker given by name . Will create a new instance if it doesn t exist already or return one that already does . |
59,976 | public function save ( array $ options = array ( ) ) { if ( ! $ this -> exists ) { $ this -> recordEvents ( new UserWasRegisteredEvent ( $ this ) ) ; } $ saved = parent :: save ( $ options ) ; return $ saved ; } | Save User ensuring all its Relationships are assigned |
59,977 | static public function fromArray ( $ id , array $ array = null , callable $ callback , array $ options = [ ] ) { $ form = static :: createInstance ( $ id , $ callback ) ; $ form -> parseOptions ( $ options ) ; $ form -> createResource ( $ array ) ; $ form -> render ( ) ; } | Create a form bound to an key - value array . |
59,978 | static public function fromObject ( $ obj = null , callable $ callback , array $ options = [ ] ) { $ form = static :: createInstance ( get_class ( $ obj ) , $ callback ) ; $ form -> setNamePattern ( $ obj ) ; $ form -> parseOptions ( $ options ) ; $ form -> createResource ( $ obj ) ; $ form -> addClass ( get_class ( $ ... | Create a form bound to an object . |
59,979 | public function hiddenField ( $ key , $ value = null , array $ attr = [ ] ) { if ( $ value !== null ) { $ attr [ 'value' ] = $ value ; } $ this -> hidden [ ] = $ this -> builder -> factory ( "hidden" , $ key , false , $ attr ) ; } | Overridden hidden so child - containers can call this . |
59,980 | public function getString ( string $ key , string $ default_value = NULL ) { $ value = $ this -> getPropertyNodeValue ( $ key ) ; if ( NULL === $ value ) { return NULL === $ default_value ? NULL : $ default_value ; } return strval ( $ value ) ; } | Get as string value |
59,981 | public function getList ( $ key , array $ default_value = NULL ) { $ value = $ this -> getPropertyNodeValue ( $ key ) ; if ( NULL === $ value ) { return NULL === $ default_value ? NULL : new ArrayList ( $ default_value ) ; } return new ArrayList ( $ value ) ; } | Get as list value |
59,982 | public function getHashMap ( $ key , array $ default_value = NULL ) { $ value = $ this -> getPropertyNodeValue ( $ key ) ; if ( NULL === $ value ) { return NULL === $ default_value ? NULL : new HashMap ( $ default_value ) ; } return new HashMap ( $ value ) ; } | Get as associative array value |
59,983 | public function getInteger ( $ key , int $ default_value = NULL ) { $ value = $ this -> getPropertyNodeValue ( $ key ) ; if ( NULL === $ value ) { return NULL === $ default_value ? NULL : $ default_value ; } return intval ( $ value ) ; } | Get as int value |
59,984 | public function getFloat ( $ key , float $ default_value = NULL ) { $ value = $ this -> getPropertyNodeValue ( $ key ) ; if ( NULL === $ value ) { return NULL === $ default_value ? NULL : $ default_value ; } return floatval ( $ value ) ; } | Get as float value |
59,985 | public function getBoolean ( $ key , bool $ default_value = NULL ) { $ value = $ this -> getPropertyNodeValue ( $ key ) ; if ( NULL === $ value ) { return NULL === $ default_value ? NULL : $ default_value ; } return boolval ( $ value ) ; } | Get as bool value |
59,986 | private function getPropertyNodeValue ( string $ key ) { $ data = $ this -> toArray ( ) ; if ( strpos ( $ key , '/' ) === false ) { return $ data [ $ key ] ?? NULL ; } $ node_keys = explode ( '/' , $ key ) ; $ node = $ data ; while ( ( $ node_key = array_shift ( $ node_keys ) ) && ( count ( $ node_keys ) > 0 ) ) { if (... | Get property node |
59,987 | public function from ( $ table , $ alias = '' ) { $ tbl = $ this -> fixTable ( $ table , $ alias ) ; $ this -> tables = array_merge ( $ this -> tables , $ tbl ) ; return $ this ; } | Append to existing tables |
59,988 | protected function updateDocComment ( $ doc , $ properties , $ coveredProperties , $ ref ) { $ lines = explode ( "\n" , trim ( $ doc ) ) ; $ propertyPart = false ; $ propertyPosition = false ; foreach ( $ lines as $ i => $ line ) { if ( substr ( trim ( $ line ) , 0 , 12 ) == '* @property ' ) { $ propertyPart = true ; }... | Replace property annotations in doc comment . |
59,989 | public function decrementLargeTiles ( ) { if ( $ this -> wide === 0 && $ this -> tall === 0 ) { throw new Exception ( 'Cannot decrement the number of either wide or tall tiles.' ) ; } if ( $ this -> tall === 0 ) { $ decrementWide = true ; } elseif ( $ this -> wide > 0 ) { $ wideRateDelta = $ this -> initialWideRate - $... | Decrement the number of large tiles and increment the number of small tiles . |
59,990 | public function incrementLargeTiles ( ) { if ( $ this -> small === 0 ) { throw new Exception ( 'Cannot decrement the number of small tiles, already 0.' ) ; } $ wideRateDelta = $ this -> getWideRate ( ) - $ this -> initialWideRate ; $ tallRateDelta = $ this -> getTallRate ( ) - $ this -> initialTallRate ; $ incrementWid... | Increment the number of large tiles and decrement the number of small tiles . |
59,991 | public static function fromLargeTiles ( int $ total , int $ tall , int $ wide ) { return new Distribution ( $ total - $ tall - $ wide , $ tall , $ wide ) ; } | Convenience method to create a new Distribution from a total number of tiles and number of tall and wide tiles . |
59,992 | public function build ( ) { $ value = sprintf ( "'%s'" , $ this -> value ) ; $ where = sprintf ( 'WHERE %s %s %s' , $ this -> column , $ this -> operator , $ value ) ; $ keyword = $ this -> keyword ; if ( ! is_null ( $ keyword ) ) { $ where = sprintf ( ' %s %s' , $ keyword , $ where ) ; } return $ where ; } | Builds the current where expression and returns the result . |
59,993 | public static function fromJson ( $ jsonFile ) { if ( ! is_file ( $ jsonFile ) && ! is_readable ( $ jsonFile ) ) { throw new \ RuntimeException ( "Either '$jsonFile' is not a file or cannot access it" ) ; } $ content = file_get_contents ( $ jsonFile ) ; if ( ! $ content ) { throw new \ RuntimeException ( "Cannot load e... | Construct from JSON file |
59,994 | public function removeAttrib ( $ attribName ) { if ( isset ( $ this -> attribs [ $ attribName ] ) ) { unset ( $ this -> attribs [ $ attribName ] ) ; return true ; } return false ; } | Removes a single attribute by name |
59,995 | public function setOption ( $ key , $ value ) { if ( 'id' == $ key ) { $ this -> proxyBase -> setOption ( $ key , $ value ) ; return $ this ; } return parent :: setOption ( $ key , $ value ) ; } | Set option enhanced to be able to set id |
59,996 | public function setType ( $ type ) { if ( empty ( static :: $ type ) ) { $ this -> proxyBase -> type = $ type ; } elseif ( static :: $ type != $ type ) { throw new LogicException ( 'Cannot alter type after creation' ) ; } return $ this ; } | Set type of the paragraph |
59,997 | public function getRootParagraph ( ) { if ( $ this -> proxyBase -> rootId && ( null === $ this -> rootParagraph || $ this -> rootParagraph -> id != $ this -> proxyBase -> rootId ) ) { $ this -> rootParagraph = $ this -> getMapper ( ) -> find ( $ this -> proxyBase -> rootId ) ; } return $ this -> rootParagraph ; } | Get root paragraph |
59,998 | public static function getAllowedFunctions ( ) { $ properties = array ( static :: PROPERTY_DRAG , static :: PROPERTY_DROP , static :: PROPERTY_EDIT , static :: PROPERTY_DELETE , ) ; $ class = get_called_class ( ) ; if ( is_a ( $ class , __NAMESPACE__ . '\RepresentsTextContentInterface' , true ) ) { $ properties [ ] = s... | This paragraph - type functions |
59,999 | public function getResourceId ( ) { if ( null === $ this -> aclResourceId ) { $ this -> aclResourceId = 'paragraph.' . $ this -> getType ( ) . '.' . ( ( int ) $ this -> getId ( ) ) ; } return $ this -> aclResourceId ; } | Returns the string identifier of the Resource |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.