idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
15,900 | public function getData ( Entity $ entity ) { $ column = $ this -> analyzer -> listColumns ( ) ; $ data = array ( ) ; foreach ( $ column as $ key => $ value ) { $ method = 'get' . Utils :: capitalize ( $ key ) ; $ data [ $ key ] = $ entity -> $ method ( ) ; if ( is_null ( $ data [ $ key ] ) ) $ data [ $ key ] = array (... | Inverse the hydrate method |
15,901 | public static function isUrl ( $ url , bool $ schemeRequired = true ) { try { $ url = Url :: create ( $ url ) -> toIdnaAsciiString ( ) ; } catch ( \ InvalidArgumentException $ e ) { return false ; } if ( $ schemeRequired ) { if ( false !== filter_var ( $ url , FILTER_VALIDATE_URL , FILTER_FLAG_SCHEME_REQUIRED ) ) { ret... | checks a string if it is a valid url address |
15,902 | public function render ( Request $ request ) { $ manager = $ this -> manager ; $ dbm = new DataBuilderManager ( ) ; $ data_builder = $ dbm -> getRepository ( ) -> findOneById ( intval ( $ request -> input ( 'data_builder_id' ) ) ) ; if ( $ data_builder == null ) { return $ this -> error ( [ [ 'message' => 'invalid data... | Render raw template . |
15,903 | public static function indent ( $ str , $ with = ' ' ) { $ newline = ( substr ( $ str , - 1 , 1 ) == "\n" ) ? "\n" : '' ; return $ with . join ( "\n" . $ with , self :: lines ( $ str ) ) . $ newline ; } | Indent a string with the specified indent |
15,904 | public static function formatLines ( $ lines , $ prefixStart = 1 ) { $ max = strlen ( ( string ) ( count ( $ lines ) + $ prefixStart ) ) ; $ prefixTemplate = "%{$max}d. " ; $ ret = '' ; foreach ( $ lines as $ l => $ line ) { $ ret .= sprintf ( $ prefixTemplate , $ prefixStart + $ l ) . $ line . "\n" ; } return $ ret ; ... | Prefix all lines with a line number starting at the given number . |
15,905 | public static function dump ( $ var , $ maxdepth = 10 , $ maxValueLen = 255 , $ stack = [ ] ) { $ children = $ hierarchyNotation = null ; if ( is_object ( $ var ) ) { $ children = get_object_vars ( $ var ) ; $ hierarchyNotation = '->%s' ; } elseif ( is_array ( $ var ) ) { $ children = $ var ; $ hierarchyNotation = '[%s... | Variable dumper . Dumps variables in a PHP - syntax format . |
15,906 | public static function dumpScalar ( $ var , $ maxValueLen ) { switch ( true ) { case is_null ( $ var ) : $ val = 'null' ; break ; case is_bool ( $ var ) : $ val = ( $ var ? 'true' : 'false' ) ; break ; case is_integer ( $ var ) : $ val = sprintf ( '%d' , $ var ) ; break ; case is_float ( $ var ) : $ val = sprintf ( '%F... | Dumps a scalar value . |
15,907 | public static function formatString ( $ var , $ maxValueLen ) { $ val = '"' ; if ( strlen ( $ var ) > $ maxValueLen ) { $ val .= substr ( $ var , 0 , $ maxValueLen ) . '" ... (' . ( strlen ( $ var ) - $ maxValueLen ) . ' more)' ; } else { $ val .= $ var . '"' ; } return $ val ; } | Format a string for dump output |
15,908 | protected static function formatDumpStack ( $ stack , $ var ) { $ ret = ( count ( $ stack ) ? join ( '' , $ stack ) : '' ) ; $ ret .= '<' . ( is_array ( $ var ) ? 'array(' . count ( $ var ) . ')' : get_class ( $ var ) ) . '>' ; return $ ret ; } | Formats a stack prefix |
15,909 | public function createQuery ( $ params , $ queryBuilder ) { $ userID = $ this -> auth -> getUser ( ) -> getId ( ) ; if ( $ params instanceof Parameters ) { $ value = $ params -> toArray ( ) ; } else { $ value = $ params ; } if ( isset ( $ value [ 'job' ] ) && ! empty ( $ value [ 'job' ] ) ) { $ queryBuilder -> field ( ... | Creates a query for filtering applications |
15,910 | public function connect ( ) { if ( $ this -> isConnected ( ) ) throw new SmtpException ( 'SMTP client already connected' ) ; $ this -> log ( 'connecting...' ) ; $ response = $ this -> connection -> open ( ) ; $ this -> log ( $ response ) ; } | connects to an smtp server |
15,911 | function isConnected ( ) { try { return $ this -> connection -> isOpen ( ) ; } catch ( SmtpException $ ex ) { $ this -> log ( 'EOF caught while checking if connected' , 'client' ) ; $ this -> close ( ) ; } return false ; } | returns whether or not a connection is open |
15,912 | public function authenticate ( ) { $ this -> sendMessage ( 'AUTH LOGIN' , 334 , 'SMTP AUTH not accepted from server' ) ; $ this -> sendMessage ( $ this -> config -> getUser ( ) , 334 , 'SMTP username not accepted from server' , true ) ; $ this -> sendMessage ( $ this -> config -> getPassword ( ) , 235 , 'SMTP password ... | sends authentification to the server |
15,913 | public function quit ( $ closeOnError = true ) { try { $ this -> sendMessage ( 'QUIT' , 221 , 'SMTP server rejected quit command' ) ; } catch ( SmtpConnectionException $ ex ) { if ( ! $ closeOnError ) throw $ ex ; } $ this -> close ( ) ; } | quits the communication with the server . is private as you shoul always call quit |
15,914 | public function connectAndAuthenticate ( ) { if ( ! $ this -> isConnected ( ) ) { $ this -> connect ( ) ; } $ this -> hello ( ) ; $ securityMode = $ this -> config -> getSecurityMode ( ) ; if ( $ securityMode == SmtpConfig :: SECURITY_MODE_TLS ) { $ this -> startTls ( ) ; $ this -> hello ( ) ; } if ( $ this -> config -... | method to call connect hello tls hello and authenticate if needed |
15,915 | public function sendMail ( Mail $ mail ) { $ sender = $ mail -> getSender ( ) ; if ( ! $ sender instanceof MailAddress ) { throw new SmtpException ( 'no sender found on mail' ) ; } $ this -> mail ( $ sender -> getEmail ( ) ) ; foreach ( $ mail -> getRecipients ( ) as $ address ) { $ address instanceof MailAddress ; $ t... | method to call mail recipients and data after each other |
15,916 | private function sendMessage ( $ message , $ successCodes = null , $ errorMsg = null , $ baseEncode = false ) { $ this -> log ( $ message ) ; $ getResponse = ( bool ) $ successCodes ; if ( $ baseEncode ) $ message = base64_encode ( $ message ) ; try { $ response = $ this -> connection -> sendMessage ( $ message , $ get... | sends a message over the SmtpConnection to the server |
15,917 | private function log ( $ message , $ party = null , $ exception = false ) { if ( ! $ this -> config -> getDebugMode ( ) ) return ; if ( ! $ party ) { $ party = $ message instanceof SmtpResponse ? 'server' : 'client' ; } $ eol = self :: EOL ; echo "SMTP " . strtoupper ( $ party ) . ":{$eol}{$message}{$eol}" ; } | makes a log entry |
15,918 | public function dashboardAction ( ) { $ request = $ this -> getRequest ( ) ; $ params = $ request -> getQuery ( ) ; $ isRecruiter = $ this -> Acl ( ) -> isRole ( 'recruiter' ) ; if ( $ isRecruiter ) { $ params -> set ( 'by' , 'me' ) ; } if ( ! isset ( $ params [ 'sort' ] ) ) { $ params [ 'sort' ] = "-date" ; } $ params... | Handles dashboard listings of applications |
15,919 | public function setUrl ( $ url ) { $ this -> reset ( ) ; foreach ( parse_url ( $ url ) as $ part => $ value ) { $ this [ $ part ] = $ value ; } } | Set and parse the url . |
15,920 | public function offsetGet ( $ offset ) { if ( ! in_array ( $ offset , self :: $ parts ) ) { throw new \ OutOfBoundsException ( "$offset is not a valid url part" ) ; } if ( isset ( $ this -> components [ $ offset ] ) ) { $ ret = $ this -> components [ $ offset ] ; } else { $ ret = '' ; } if ( is_array ( $ ret ) && $ off... | Returns the string value of the specified url part . Does not allow getting properties other than the specified class constants . |
15,921 | public function offsetSet ( $ offset , $ value ) { if ( $ offset == self :: QUERY ) { $ parameters = [ ] ; parse_str ( $ value , $ parameters ) ; $ value = $ parameters ; } $ this -> set ( $ offset , $ value ) ; } | Set the specified URL part . |
15,922 | public function set ( $ part , $ value ) { if ( ! in_array ( $ part , self :: $ parts ) ) { throw new \ OutOfBoundsException ( "$part is not a valid url part" ) ; } $ this -> components [ $ part ] = $ value ; return $ this ; } | Set a URL part . |
15,923 | public function getParam ( $ name , $ default = null ) { if ( is_array ( $ name ) ) { return TreeTools :: getByPath ( $ this -> components [ self :: QUERY ] , $ name , $ default ) ; } if ( isset ( $ this -> components [ self :: QUERY ] [ $ name ] ) ) { return $ this -> components [ self :: QUERY ] [ $ name ] ; } return... | Returns a parameter from the query string . Allows an array to traverse a tree of key names . |
15,924 | public function setParam ( $ name , $ value , $ replace = true ) { if ( is_array ( $ name ) ) { if ( ! isset ( $ this -> components [ self :: QUERY ] ) ) { $ this -> components [ self :: QUERY ] = [ ] ; } TreeTools :: setByPath ( $ this -> components [ self :: QUERY ] , $ name , $ value ) ; } else { if ( isset ( $ this... | Sets a parameter in the query string . Allows an array to traverse a tree of key names . |
15,925 | public function addParam ( $ name , $ value , $ convertToArrayIfExists = false ) { if ( isset ( $ this -> components [ self :: QUERY ] [ $ name ] ) ) { if ( ! is_array ( $ this -> components [ self :: QUERY ] [ $ name ] ) ) { if ( $ convertToArrayIfExists ) { $ this -> components [ self :: QUERY ] [ $ name ] = [ $ this... | Adds a parameter at the specified path . |
15,926 | public static function queryString ( $ params , $ parent = null , $ callback = 'rawurlencode' , $ ignoreNonValues = true ) { $ params = self :: flattenRequestVars ( $ params , $ parent ) ; $ ret = [ ] ; foreach ( $ params as $ pair ) { list ( $ name , $ value ) = $ pair ; if ( ! $ value && $ ignoreNonValues ) { continu... | Construct a query string from the parameters |
15,927 | protected function getPaginationQueryBuilder ( $ params ) { $ filter = $ this -> getService ( 'FilterManager' ) -> get ( 'PaginationQuery/Applications' ) ; $ qb = $ filter -> filter ( $ params , $ this -> createQueryBuilder ( ) ) ; return $ qb ; } | Gets a query builder to search for applications |
15,928 | public function getPaginationList ( $ params ) { $ qb = $ this -> getPaginationQueryBuilder ( $ params ) ; $ cursor = $ qb -> hydrate ( false ) -> select ( '_id' ) -> getQuery ( ) -> execute ( ) ; $ list = new PaginationList ( array_keys ( ArrayUtils :: iteratorToArray ( $ cursor ) ) ) ; return $ list ; } | Gets a result list of applications |
15,929 | public function loadUnreadApplicationsForJob ( $ job ) { $ auth = $ this -> getService ( 'AuthenticationService' ) ; $ qb = $ this -> createQueryBuilder ( ) -> field ( "readBy" ) -> notIn ( array ( $ auth -> getUser ( ) -> getId ( ) ) ) -> field ( "job" ) -> equals ( new \ MongoId ( $ job -> getId ( ) ) ) ; return $ qb... | Get unread applications |
15,930 | public function findComment ( $ commentOrId ) { if ( $ commentOrId instanceof CommentInterface ) { $ commentOrId = $ commentOrId -> getId ( ) ; } $ application = $ this -> findOneBy ( array ( 'comments.id' => $ commentOrId ) ) ; foreach ( $ application -> getComments ( ) as $ comment ) { if ( $ comment -> getId ( ) == ... | Get comments of an applications |
15,931 | public function findProfile ( $ profileId ) { $ application = $ this -> findOneBy ( array ( 'isDraft' => null , 'profiles._id' => new \ MongoId ( $ profileId ) ) ) ; foreach ( $ application -> getProfiles ( ) as $ profile ) { if ( $ profile -> getId ( ) == $ profileId ) { return $ profile ; } } return null ; } | Gets social profiles of an application |
15,932 | public function getUserApplications ( $ userId , $ limit = null ) { $ qb = $ this -> createQueryBuilder ( null ) -> field ( 'user' ) -> equals ( $ userId ) -> sort ( [ 'date' => - 1 ] ) ; if ( isset ( $ limit ) ) { $ qb -> limit ( $ limit ) ; } return $ qb -> getQuery ( ) -> execute ( ) ; } | Get applications for given user ID |
15,933 | public static function sanitize ( $ fileName , $ stripPath = true , $ maxLength = 120 , $ defaultExtension = 'bin' ) { list ( $ dirname , $ name , $ ext ) = self :: split ( $ fileName ) ; if ( ! $ stripPath ) { $ unslashedFilename = str_replace ( '/' , '-' , ltrim ( $ dirname , '/' ) ) . '-' . $ name . '.' . $ ext ; re... | Sanitize a file name excluding unwanted characters and replacing them with a dash . |
15,934 | public function setList ( array $ ids ) { $ this -> ids = $ ids ; $ this -> count = count ( $ ids ) ; return $ this ; } | Sets the list entries |
15,935 | public function getCurrent ( ) { if ( false === $ this -> pointer || empty ( $ this -> ids ) ) { return null ; } return $ this -> ids [ $ this -> pointer ] ; } | Gets current list entry . |
15,936 | public function getPrevious ( ) { if ( false === $ this -> pointer || ! $ this -> count || 0 == $ this -> pointer ) { return null ; } return $ this -> ids [ $ this -> pointer - 1 ] ; } | gets the id BEFORE the current entry . |
15,937 | public function getNext ( ) { if ( false === $ this -> pointer || ! $ this -> count || $ this -> count == $ this -> pointer ) { return null ; } $ pointer = $ this -> pointer + 1 ; return isset ( $ this -> ids [ $ pointer ] ) ? $ this -> ids [ $ pointer ] : null ; } | Gets the id BEHIND the current entry . |
15,938 | public function generateKeywordsAction ( ) { $ applications = $ this -> fetchApplications ( ) ; $ count = count ( $ applications ) ; $ repositories = $ this -> repositories ; if ( 0 === $ count ) { return 'No applications found.' ; } foreach ( $ repositories -> getEventManager ( ) -> getListeners ( 'preUpdate' ) as $ l... | regenerate keywords for applications |
15,939 | public function calculateRatingAction ( ) { $ applications = $ this -> fetchApplications ( ) ; $ count = count ( $ applications ) ; $ i = 0 ; echo "Calculate rating for " . $ count . " applications ...\n" ; $ progress = new ProgressBar ( $ count ) ; foreach ( $ applications as $ application ) { $ progress -> update ( $... | Recalculates ratings for applications |
15,940 | protected function cleanupAction ( ) { $ days = 2 ; $ date = new \ DateTime ( ) ; $ date -> modify ( "-$days day" ) ; $ filter = array ( "before" => $ date -> format ( "Y-m-d" ) , "isDraft" => 1 ) ; $ applications = $ this -> fetchApplications ( $ filter ) ; $ documentManager = $ this -> documentManager ; $ count = cou... | removes unfinished applications . Applications which are in Draft Mode for more than 24 hours . |
15,941 | public function listviewscriptsAction ( ) { $ config = $ this -> config ; $ table = new Table ( array ( 'columnWidths' => array ( 40 , 40 , 40 ) , 'decorator' => 'ascii' ) ) ; $ table -> appendRow ( array ( 'Module' , 'Name' , 'Description' ) ) ; $ offset = strlen ( getcwd ( ) ) + 1 ; $ links = "" ; $ github = 'https:/... | list available view scripts |
15,942 | public function search ( $ q ) { $ qb = $ this -> repository -> createQueryBuilder ( ) ; $ qb -> field ( 'title' ) -> equals ( new \ MongoRegex ( '/' . addslashes ( $ q ) . '/i' ) ) ; $ cursor = $ qb -> getQuery ( ) -> execute ( ) ; $ adapter = new DoctrineMongoCursor ( $ cursor ) ; parent :: __construct ( $ adapter ) ... | Set the search criteria . |
15,943 | public function prepareFormData ( ApplicationEvent $ e ) { $ target = $ e -> getTarget ( ) ; if ( $ target -> isPostRequest ( ) ) { return ; } $ this -> application = $ target -> getApplicationEntity ( ) ; $ status = $ target -> getStatus ( ) ; $ user = $ target -> getUser ( ) ; $ settings = $ user -> getSettings ( 'Ap... | Prepares the Notification Mail |
15,944 | public function sendMail ( ApplicationEvent $ event ) { $ event = $ event -> getTarget ( ) ; if ( ! $ event -> isPostRequest ( ) ) { return ; } $ this -> application = $ event -> getApplicationEntity ( ) ; $ status = $ event -> getStatus ( ) ; $ user = $ event -> getUser ( ) ; $ post = $ event -> getPostData ( ) ; $ se... | Sends the Notification Mail . |
15,945 | protected function sendCarbonCopyToCandidate ( ) { if ( $ this -> application -> getAttributes ( ) -> getSendCarbonCopy ( ) ) { $ this -> mailService -> send ( 'Applications/CarbonCopy' , [ 'application' => $ this -> application ] ) ; } } | Send Carbon Copy to the User |
15,946 | protected function generateBody ( ) { $ message = new Mime \ Message ( ) ; $ text = $ this -> generateHtml ( ) ; $ textPart = new Mime \ Part ( $ text ) ; $ textPart -> type = 'text/html' ; $ textPart -> charset = 'UTF-8' ; $ textPart -> disposition = Mime \ Mime :: DISPOSITION_INLINE ; $ message -> addPart ( $ textPar... | Generates the Mail Body |
15,947 | public function setSelectedJob ( JobInterface $ job ) { $ this -> setValueOptions ( [ '0' => '' , $ job -> getId ( ) => $ job -> getTitle ( ) , ] ) ; $ this -> setValue ( $ job -> getId ( ) ) ; return $ this ; } | Set the pre selected job . |
15,948 | public function refreshRatingAction ( ) { $ model = new ViewModel ( ) ; $ model -> setTemplate ( 'applications/manage/_rating' ) ; $ application = $ this -> repositories -> get ( 'Applications/Application' ) -> find ( $ this -> params ( 'id' , 0 ) ) ; if ( ! $ application ) { throw new \ DomainException ( 'Invalid appl... | Refreshes the rating of an application |
15,949 | public function statusAction ( ) { $ applicationId = $ this -> params ( 'id' ) ; $ repository = $ this -> repositories -> get ( 'Applications/Application' ) ; $ application = $ repository -> find ( $ applicationId ) ; $ request = $ this -> getRequest ( ) ; if ( ! $ application ) { throw new \ InvalidArgumentException (... | Changes the status of an application |
15,950 | public function forwardAction ( ) { $ emailAddress = $ this -> params ( ) -> fromQuery ( 'email' ) ; $ application = $ this -> repositories -> get ( 'Applications/Application' ) -> find ( $ this -> params ( 'id' ) ) ; $ this -> acl ( $ application , 'forward' ) ; $ translator = $ this -> translator ; if ( ! $ emailAddr... | Forwards an application via Email |
15,951 | public function deleteAction ( ) { $ id = $ this -> params ( 'id' ) ; $ repositories = $ this -> repositories ; $ repository = $ repositories -> get ( 'Applications/Application' ) ; $ application = $ repository -> find ( $ id ) ; if ( ! $ application ) { throw new \ DomainException ( 'Application not found.' ) ; } $ th... | Deletes an application |
15,952 | public function moveAction ( ) { $ id = $ this -> params ( 'id' ) ; $ repositories = $ this -> repositories ; $ application = $ repositories -> get ( 'Applications/Application' ) -> find ( $ id ) ; if ( ! $ application ) { throw new \ DomainException ( 'Application not found.' ) ; } $ this -> acl ( $ application , 'mov... | Move an application to talent pool |
15,953 | public function init ( ) { $ this -> setName ( 'emails' ) -> setLabel ( 'E-Mail Notifications' ) ; $ this -> add ( array ( 'type' => Checkbox :: class , 'name' => 'mailAccess' , 'label' => 'foo' , 'options' => array ( 'label' => 'receive E-Mail alert' , 'long_label' => 'if checked, you\'ll be informed by mail about new... | initialize settings form |
15,954 | protected function getFormalSalutation ( ) { $ contact = $ this -> application -> getContact ( ) ; $ name = $ contact -> getLastName ( ) ; $ gender = $ contact -> getGender ( ) ; $ translator = $ this -> getTranslator ( ) ; $ salutation = 'male' == $ gender ? $ translator -> translate ( 'Dear Mr. %s' ) : $ translator -... | Gets the formal salutation of the applicant |
15,955 | public function sendMessage ( $ message , $ getResponse = true , $ eol = "\r\n" ) { fputs ( $ this -> conn , $ message . $ eol ) ; if ( ! $ getResponse ) return null ; return $ this -> getResponse ( ) ; } | sends a message to the smtp server |
15,956 | private function getResponse ( ) { $ data = '' ; $ start = microtime ( true ) ; while ( ! feof ( $ this -> conn ) && ( microtime ( true ) - $ start ) < ( $ this -> timeout + 1 ) ) { $ line = fgets ( $ this -> conn , 515 ) ; if ( $ line === false ) break ; $ data .= $ line ; if ( substr ( $ line , 3 , 1 ) == ' ' ) break... | reads all the lines of the command |
15,957 | public static function camel ( $ str , $ split = '-_' ) { return preg_replace_callback ( '/[' . preg_quote ( $ split ) . '](.?)/' , function ( $ m ) { return ucfirst ( $ m [ 1 ] ) ; } , $ str ) ; } | Camelcases an underscored or dashed string |
15,958 | public static function infix ( $ str , $ infix ) { return lcfirst ( preg_replace_callback ( '/(?<=.)[A-Z]/' , function ( $ m ) use ( $ infix ) { return $ infix . strtolower ( $ m [ 0 ] ) ; } , $ str ) ) ; } | Converts a camelcased string to another separator using infix as the separator . |
15,959 | public static function rstrip ( $ str , $ suffix ) { if ( substr ( $ str , - strlen ( $ suffix ) ) == $ suffix ) { return substr ( $ str , 0 , - strlen ( $ suffix ) ) ; } return $ str ; } | Strips a suffix of a string |
15,960 | public static function lstrip ( $ str , $ prefix ) { if ( substr ( $ str , 0 , strlen ( $ prefix ) ) == $ prefix ) { return substr ( $ str , strlen ( $ prefix ) ) ; } return $ str ; } | Strips a prefix of a string |
15,961 | public static function strip ( $ str , $ prefix , $ suffix ) { return self :: rstrip ( self :: lstrip ( $ str , $ prefix ) , $ suffix ) ; } | Strips a prefix and suffix of a string |
15,962 | public static function systemize ( $ str , $ infix = '-' ) { $ str = self :: ascii ( $ str ) ; return trim ( preg_replace ( '/' . preg_quote ( $ infix , '/' ) . '+/' , $ infix , preg_replace ( '/[^\w-]+/' , $ infix , strtolower ( $ str ) ) ) , $ infix ) ; } | Returns a systemized version of the string . |
15,963 | public static function ascii ( $ str , $ srcEncoding = 'UTF-8' ) { $ str = str_replace ( html_entity_decode ( '­' , null , 'UTF-8' ) , '' , $ str ) ; return transliterator_transliterate ( 'Any-Latin;Latin-ASCII' , $ str ) ; } | Converts a text string to ASCII |
15,964 | public static function random ( $ length = 64 , $ characters = self :: ALNUM ) { static $ random_generator = null ; if ( null === $ random_generator ) { $ random_generator = is_callable ( 'mt_rand' ) ? 'mt_rand' : 'rand' ; } $ len = strlen ( $ characters ) ; return join ( '' , array_map ( function ( ) use ( $ character... | Generate a random string with specified length from the specified characters |
15,965 | public function generate ( FileGenerator $ generator , array $ data = [ ] ) { $ result = ( new DataBuilderManager ( ) ) -> validateRaw ( $ generator -> data_builder , $ data ) ; if ( ! $ result -> ok ( ) ) { return $ result ; } dispatch ( new GenerateFile ( $ generator , $ data , $ this -> getAgent ( ) ) ) ; return $ r... | Request a file - generator . |
15,966 | public function connect ( ) { $ this -> connect = ldap_connect ( $ this -> hostname , $ this -> port ) ; if ( ! $ this -> connect ) { throw new ConnectionException ( $ this ) ; } ldap_set_option ( $ this -> connect , LDAP_OPT_PROTOCOL_VERSION , 3 ) ; if ( ! is_null ( $ this -> username ) && ! is_null ( $ this -> passwo... | Connect to the Ldap Server and get a client to execute Query |
15,967 | public function getName ( $ quoted = false ) { if ( ! $ quoted ) return $ this -> name ; $ quotedName = addcslashes ( $ this -> name , "\0..\37\177\\\"" ) ; if ( $ this -> name == $ quotedName && ! preg_match ( '/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/' , $ this -> name ) ) { return $ this -> name ; } else { return mb_enco... | returns the name if desired in quoted style for e - mail header output |
15,968 | private function validateAddress ( $ address ) { ArgUtils :: valType ( $ address , 'scalar' ) ; $ email = self :: stripEmail ( $ address ) ; if ( ! filter_var ( $ email , FILTER_VALIDATE_EMAIL ) ) throw new MailFormatException ( 'invalid e-mail address: ' . $ address ) ; } | checks if an address contains a valid e - mail address |
15,969 | public static function stripName ( $ address ) { $ address = trim ( preg_replace ( '/[\r\n]+/' , '' , $ address ) ) ; $ email = self :: stripEmail ( $ address ) ; $ name = trim ( str_replace ( '<' . $ email . '>' , '' , $ address ) ) ; if ( substr ( $ name , 0 , 1 ) == "\"" && substr ( $ name , - 1 ) == "\"" ) { $ name... | returns the name of an expression like John Doe <john |
15,970 | public function init ( ) { $ this -> setHydrator ( new \ Core \ Entity \ Hydrator \ EntityHydrator ( ) ) -> setName ( 'base' ) ; $ this -> add ( array ( 'type' => 'textarea' , 'name' => 'summary' , 'options' => array ( 'description' => '<strong>Please note</strong>: HTML tags get stripped out. Line breaks are preserved... | initialize base fieldset |
15,971 | protected function configureContainer ( Container $ container ) { $ application = $ container -> getEntity ( ) ; $ job = $ application -> getJob ( ) ; $ settings = ( $ user = $ job -> getUser ( ) ) ? $ user -> getSettings ( 'Applications' ) : null ; $ formSettings = $ settings ? $ settings -> getApplyFormSettings ( ) :... | Configures the apply form container . |
15,972 | protected function getOptions ( ) { if ( ! $ this -> options ) { $ this -> options = $ this -> default ; } $ options = [ ] ; foreach ( $ this -> options as $ value => $ active ) { $ options [ ] = $ this -> getActiveString ( $ active ) . $ value ; } return join ( " " , $ options ) ; } | If not options has been defined get default . |
15,973 | public function open ( $ device , $ mode = "w+b" ) { if ( false === file_exists ( $ device ) ) { throw new DeviceNotFound ( ) ; } $ this -> getConfigure ( ) -> configure ( $ device ) ; $ this -> fd = fopen ( $ device , $ mode ) ; if ( false !== $ this -> fd ) { stream_set_blocking ( $ this -> fd , false ) ; return true... | Open serial connection |
15,974 | public function write ( $ data ) { $ this -> ensureDeviceOpen ( ) ; if ( false !== ( $ dataWritten = fwrite ( $ this -> fd , $ data ) ) ) { return $ dataWritten ; } throw new WriteNotAllowed ( ) ; } | Write data into serial port line |
15,975 | public function read ( ) { $ this -> ensureDeviceOpen ( ) ; $ chars = [ ] ; do { $ char = fread ( $ this -> fd , 1 ) ; $ chars [ ] = $ char ; } while ( $ char != $ this -> getParser ( ) -> getSeparator ( ) ) ; return $ this -> getParser ( ) -> parse ( $ chars ) ; } | Read data byte per byte until separator found |
15,976 | protected function defaultSubmitEvent ( ) { $ expression = [ ] ; if ( $ this -> autoClose ) { $ expression [ ] = "$(this).modal('toggle');" ; } if ( $ this -> pjaxContainer ) { $ expression [ ] = "$.pjax.reload({container : '$this->pjaxContainer', timeout : $this->pjaxTimeout });" ; } $ script = implode ( "\r\n" , $ ex... | register pjax event |
15,977 | public static function getAuthorizationUri ( array $ scope , $ redirect_uri , array $ options = array ( ) ) { if ( self :: $ production === null ) { throw new RuntimeException ( 'You must initialize the WePay SDK with WePay::useStaging() or WePay::useProduction()' ) ; } $ domain = self :: $ production ? 'https://www.we... | Generate URI used during oAuth authorization Redirect your user to this URI where they can grant your application permission to make API calls |
15,978 | public static function useProduction ( $ client_id , $ client_secret , $ api_version = null ) { if ( self :: $ production !== null ) { throw new RuntimeException ( 'API mode has already been set.' ) ; } self :: $ production = true ; self :: $ client_id = $ client_id ; self :: $ client_secret = $ client_secret ; self ::... | Configure SDK to run against WePay s production servers |
15,979 | public static function useStaging ( $ client_id , $ client_secret , $ api_version = null ) { if ( self :: $ production !== null ) { throw new RuntimeException ( 'API mode has already been set.' ) ; } self :: $ production = false ; self :: $ client_id = $ client_id ; self :: $ client_secret = $ client_secret ; self :: $... | Configure SDK to run against WePay s staging servers |
15,980 | private static function make_request ( $ endpoint , $ values , $ headers = array ( ) ) { self :: $ ch = curl_init ( ) ; $ headers = array_merge ( array ( "Content-Type: application/json" ) , $ headers ) ; if ( ! empty ( self :: $ api_version ) ) { $ headers [ ] = "Api-Version: " . self :: $ api_version ; } curl_setopt ... | create the cURL request and execute it |
15,981 | public function request ( $ endpoint , array $ values = array ( ) , $ risk_token = null , $ client_ip = null ) { $ headers = array ( ) ; if ( $ this -> token ) { $ headers [ ] = "Authorization: Bearer $this->token" ; } if ( $ risk_token ) { $ headers [ ] = "WePay-Risk-Token: " . $ risk_token ; } if ( $ client_ip ) { $ ... | Make API calls against authenticated user |
15,982 | public static function clone ( ) { $ bowerDir = 'vendor' . DIRECTORY_SEPARATOR . self :: $ sourceBower ; $ bowerYiiDir = 'vendor' . DIRECTORY_SEPARATOR . self :: $ bowerVendor ; try { self :: deleteDir ( $ bowerYiiDir ) ; self :: copyDir ( $ bowerDir , $ bowerYiiDir ) ; echo "Clone bower process done\n" ; } catch ( Exc... | Install via cloning package to Bower vendor |
15,983 | public static function setAlias ( ) { $ file = file_get_contents ( self :: $ aliasFilePath ) ; $ newAliasString = str_replace ( "'" . self :: $ bowerVendor . "'" , "'" . self :: $ sourceBower . "'" , self :: $ aliasBowerString ) ; $ file = str_replace ( self :: $ aliasBowerString , $ newAliasString , $ file ) ; $ resul... | Install via setting alias of Bower |
15,984 | public static function unsetAlias ( ) { $ file = file_get_contents ( self :: $ aliasFilePath ) ; $ aliasString = str_replace ( "'" . self :: $ bowerVendor . "'" , "'" . self :: $ sourceBower . "'" , self :: $ aliasBowerString ) ; $ file = str_replace ( $ aliasString , self :: $ aliasBowerString , $ file ) ; $ result = ... | Uninstall via re - setting alias of Bower |
15,985 | public function onOpen ( ConnectionInterface $ conn ) { $ this -> conn = $ conn ; $ this -> attach ( ) -> throttle ( ) -> limit ( ) ; } | Perform action on open . |
15,986 | protected function throttle ( ) { if ( $ this -> isThrottled ( $ this -> conn , 'onOpen' ) ) { $ this -> console -> info ( sprintf ( 'Connection throttled: %d' , $ this -> conn -> resourceId ) ) ; $ this -> conn -> send ( trans ( 'ratchet::messages.tooManyConnectionAttempts' ) ) ; $ this -> throttled = true ; $ this ->... | Throttle connections . |
15,987 | protected function limit ( ) { if ( ( $ connectionLimit = config ( 'ratchet.connectionLimit' ) ) && $ this -> connections - 1 >= $ connectionLimit ) { $ this -> console -> info ( sprintf ( 'To many connections: %d of %d' , $ this -> connections - 1 , $ connectionLimit ) ) ; $ this -> conn -> send ( trans ( 'ratchet::me... | Limit connections . |
15,988 | protected function isThrottled ( $ conn , $ setting ) { $ connectionThrottle = explode ( ':' , config ( sprintf ( 'ratchet.throttle.%s' , $ setting ) ) ) ; return ! Throttle :: attempt ( [ 'ip' => $ conn -> remoteAddress , 'route' => $ setting , ] , ( int ) $ connectionThrottle [ 0 ] , ( int ) $ connectionThrottle [ 1 ... | Check if the called function is throttled . |
15,989 | public function onMessage ( ConnectionInterface $ conn , $ input ) { $ this -> console -> comment ( sprintf ( 'Message from %d: %s' , $ conn -> resourceId , $ input ) ) ; if ( $ this -> isThrottled ( $ conn , 'onMessage' ) ) { $ this -> console -> info ( sprintf ( 'Message throttled: %d' , $ conn -> resourceId ) ) ; $ ... | Perform action on message . |
15,990 | public function onClose ( ConnectionInterface $ conn ) { $ this -> clients -> detach ( $ conn ) ; $ this -> console -> error ( sprintf ( 'Disconnected: %d' , $ conn -> resourceId ) ) ; } | Perform action on close . |
15,991 | public function onError ( ConnectionInterface $ conn , \ Exception $ exception ) { $ message = $ exception -> getMessage ( ) ; $ conn -> close ( ) ; $ this -> console -> error ( sprintf ( 'Error: %s' , $ message ) ) ; } | Perform action on error . |
15,992 | private function startServer ( $ driver = null ) { if ( ! $ driver ) { $ driver = $ this -> driver ; } $ this -> info ( sprintf ( 'Starting %s server on: %s:%d' , $ this -> option ( 'driver' ) , $ this -> host , $ this -> port ) ) ; $ this -> createServerInstance ( ) ; $ this -> { 'start' . $ driver } ( ) -> run ( ) ; ... | Start the appropriate server . |
15,993 | private function bootWithBlacklist ( ) { $ this -> serverInstance = new IpBlackList ( $ this -> serverInstance ) ; foreach ( config ( 'ratchet.blackList' ) as $ host ) { $ this -> serverInstance -> blockAddress ( $ host ) ; } } | Decorate a server instance with a blacklist instance and block any blacklisted addresses . |
15,994 | private function bootWebSocketServer ( $ withZmq = false ) { if ( $ withZmq || $ this -> option ( 'zmq' ) ) { $ this -> bootZmqConnection ( ) ; } $ this -> wsServerInstance = new WsServer ( $ this -> serverInstance ) ; $ this -> serverInstance = new HttpServer ( $ this -> wsServerInstance ) ; if ( $ this -> keepAlive >... | Decorate the server instance with a WebSocket server . |
15,995 | private function startWampServer ( ) { if ( ! $ this -> serverInstance instanceof RatchetWampServer ) { throw new \ Exception ( "{$this->class} must be an instance of " . RatchetWampServer :: class . " to create a Wamp server" ) ; } $ this -> serverInstance = new WampServer ( $ this -> serverInstance ) ; return $ this ... | Deploy a WampServer |
15,996 | private function startWsServer ( ) { if ( ! $ this -> serverInstance instanceof RatchetWsServer ) { throw new \ Exception ( "{$this->class} must be an instance of " . RatchetWsServer :: class . " to create a WebSocket server" ) ; } $ this -> bootWithBlacklist ( ) ; return $ this -> bootWebSocketServer ( ) ; } | Deploy a WsServer . |
15,997 | private function bootIoServer ( ) { $ context = [ 'tls' => $ this -> tls , ] ; $ socket = new SocketServer ( $ this -> host . ':' . $ this -> port , $ this -> getEventLoop ( ) , $ context ) ; return new IoServer ( $ this -> serverInstance , $ socket , $ this -> getEventLoop ( ) ) ; } | Create the IoServer instance to encapsulate our server in . |
15,998 | private function bootZmqConnection ( ) { $ this -> info ( sprintf ( 'Starting ZMQ listener on: %s:%s' , config ( 'ratchet.zmq.host' ) , config ( 'ratchet.zmq.port' ) ) ) ; $ context = new ZMQContext ( $ this -> getEventLoop ( ) ) ; $ socket = $ context -> getSocket ( config ( 'ratchet.zmq.method' , \ ZMQ :: SOCKET_PULL... | Boot a ZMQ listener and let the Ratchet server handle its events . |
15,999 | private function getEventLoop ( ) { if ( ! $ this -> eventLoop instanceof LoopInterface ) { $ this -> eventLoop = EventLoop :: create ( ) ; } return $ this -> eventLoop ; } | Generate and return a React EventLoop object . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.