idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
58,700
public static function shorten ( $ url ) { $ client = new Client ( ) ; $ request = $ client -> get ( self :: $ _BITLY_URL ) ; $ request -> getQuery ( ) -> add ( 'access_token' , self :: $ _ACCESS_KEY ) ; $ request -> getQuery ( ) -> add ( 'longUrl' , $ url ) ; $ resp = $ request -> send ( ) ; $ jsonRep = $ resp -> json...
Shortens a URL to a bit . ly url
58,701
public function fetchRepository ( Repository $ repository ) { $ response = $ this -> getResponse ( sprintf ( '%s/%s/metrics' , $ repository -> getType ( ) , $ repository -> getSlug ( ) ) ) ; if ( ! $ response || isset ( $ repositoryArray [ 'error' ] ) ) { throw new \ UnexpectedValueException ( sprintf ( 'Response is em...
Fetch data from repository URL
58,702
public static function run ( $ app ) { $ route = Router :: process ( new Request ) ; if ( ! class_exists ( $ route [ 'controller' ] ) or ! method_exists ( $ route [ 'controller' ] , "{$route['method']}Action" ) ) { if ( $ app -> environment ( ) == 'development' ) { throw new Exception ( "Unable to find controller for '...
Runs the application and routes the request .
58,703
public function listAction ( $ person_id , Request $ request ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ person = $ em -> getRepository ( 'ChillPersonBundle:Person' ) -> find ( $ person_id ) ; $ this -> denyAccessUnlessGranted ( 'CHILL_PERSON_SEE' , $ person ) ; $ reachableScopes = $ this -> get ( 'chill...
List all the report entities for a given person .
58,704
public function selectReportTypeAction ( $ person_id , Request $ request ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ person = $ em -> getRepository ( 'ChillPersonBundle:Person' ) -> find ( $ person_id ) ; if ( $ person === NULL ) { throw $ this -> createNotFoundException ( 'Person not found!' ) ; } $ thi...
Display a form for selecting which type of report to add for a given person
58,705
public function exportAction ( $ cf_group_id , Request $ request ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ cFGroup = $ em -> getRepository ( 'ChillCustomFieldsBundle:CustomFieldsGroup' ) -> find ( $ cf_group_id ) ; $ reports = $ em -> getRepository ( 'ChillReportBundle:Report' ) -> findByCFGroup ( $ cF...
Return a csv file with all the reports of a given type
58,706
public function newAction ( $ person_id , $ cf_group_id , Request $ request ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ person = $ em -> getRepository ( 'ChillPersonBundle:Person' ) -> find ( $ person_id ) ; $ cFGroup = $ em -> getRepository ( 'ChillCustomFieldsBundle:CustomFieldsGroup' ) -> find ( $ cf_...
Display a form for creating a new report for a given person and of a given type
58,707
public function createAction ( $ person_id , $ cf_group_id , Request $ request ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ entity = new Report ( ) ; $ cFGroup = $ em -> getRepository ( 'ChillCustomFieldsBundle:CustomFieldsGroup' ) -> find ( $ cf_group_id ) ; $ person = $ em -> getRepository ( 'ChillPerso...
Create a new report for a given person and of a given type
58,708
private function createCreateForm ( Report $ entity , Person $ person , $ cFGroup ) { $ form = $ this -> createForm ( 'chill_reportbundle_report' , $ entity , array ( 'action' => $ this -> generateUrl ( 'report_create' , array ( 'person_id' => $ person -> getId ( ) , 'cf_group_id' => $ cFGroup -> getId ( ) ) ) , 'metho...
Creates a form to create a Report entity .
58,709
public function viewAction ( $ report_id , $ person_id ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ person = $ em -> getRepository ( 'ChillPersonBundle:Person' ) -> find ( $ person_id ) ; $ entity = $ em -> getRepository ( 'ChillReportBundle:Report' ) -> find ( $ report_id ) ; if ( ! $ entity || ! $ perso...
Find and display a report .
58,710
public function editAction ( $ person_id , $ report_id , Request $ request ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ report = $ em -> getRepository ( 'ChillReportBundle:Report' ) -> find ( $ report_id ) ; if ( ! $ report ) { throw $ this -> createNotFoundException ( $ this -> get ( 'translator' ) -> tr...
Display a form to edit an existing Report entity .
58,711
private function createEditForm ( Report $ entity ) { $ form = $ this -> createForm ( 'chill_reportbundle_report' , $ entity , array ( 'action' => $ this -> generateUrl ( 'report_update' , array ( 'person_id' => $ entity -> getPerson ( ) -> getId ( ) , 'report_id' => $ entity -> getId ( ) ) ) , 'method' => 'PUT' , 'cFG...
Creates a form to edit a Report entity .
58,712
public function updateAction ( $ person_id , $ report_id , Request $ request ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ report = $ em -> getRepository ( 'ChillReportBundle:Report' ) -> find ( $ report_id ) ; if ( ! $ report ) { throw $ this -> createNotFoundException ( $ this -> get ( 'translator' ) -> ...
Web page for editing an existing report .
58,713
public static function factory ( StyleType $ type ) : Style { return self :: evaluate ( $ type ) -> isInstanceOf ( Style :: class ) -> getValue ( ) ; }
Crea objetos Style
58,714
protected function configure ( ) : void { $ this -> register ( 'makeType' ) ; $ this -> register ( 'makeValue' ) ; $ this -> register ( 'makeArgument' ) ; $ this -> register ( 'makeStrong' ) ; $ this -> register ( 'makeExceptionHeader' ) ; $ this -> register ( 'makeExceptionBody' ) ; $ this -> register ( 'makeException...
Configura esta factoria
58,715
public function makeArgument ( StyleType $ type ) : ? Style { if ( ! $ type -> isArgument ( ) ) { return null ; } return Style :: make ( ) -> setFgColor ( Color :: YELLOW ( ) ) ; }
Devuelte un style de tipo argument
58,716
public function makeStrong ( StyleType $ type ) : ? Style { if ( ! $ type -> isStrong ( ) ) { return null ; } return Style :: make ( ) -> bold ( ) -> underscore ( ) ; }
Devuelte un style de tipo strong
58,717
public function makeExceptionHeader ( StyleType $ type ) : ? Style { if ( ! $ type -> isExceptionHeader ( ) ) { return null ; } return Style :: make ( ) -> setBgColor ( Color :: RED ( ) ) -> setFgColor ( Color :: WHITE ( ) ) -> bold ( ) -> margin ( 2 ) -> padding ( 2 ) -> align ( Align :: CENTER ( ) ) ; }
Devuelte un style de tipo exception_header
58,718
public function makeExceptionBody ( StyleType $ type ) : ? Style { if ( ! $ type -> isExceptionBody ( ) ) { return null ; } return Style :: make ( ) -> margin ( 2 ) ; }
Devuelte un style de tipo exception_body
58,719
public function makeExceptionTrace ( StyleType $ type ) : ? Style { if ( ! $ type -> isExceptionTrace ( ) ) { return null ; } return Style :: make ( ) -> setFgColor ( Color :: GREEN ( ) ) -> margin ( 2 ) ; }
Devuelte un style de tipo exception_trace
58,720
public function onSitemapNodeEdit ( SitemapNodeEvent $ event ) { $ node = $ event -> getNode ( ) ; if ( in_array ( $ node -> getType ( ) , $ this -> textNodeTypes ) ) { $ tab = new Tab ( $ event -> getTranslator ( ) -> trans ( 'text' , array ( ) , 'SilvestraTextNodeBundle' ) , 'silvestra_text_node' , $ event -> getRout...
On edit node .
58,721
public function onSitemapNodeDelete ( TreeNodeEvent $ event ) { $ node = $ event -> getNode ( ) ; if ( TextNodeInterface :: NODE_TYPE === $ node -> getType ( ) ) { $ this -> nodeHandler -> onDeleteNode ( $ node ) ; } }
On sitemap node delete .
58,722
public function query ( $ query ) { if ( strtoupper ( substr ( PHP_OS , 0 , 3 ) ) === 'WIN' ) { return $ this -> connection -> ExecQuery ( $ query ) ; } else { $ execString = $ this -> connectionString . '"' . $ query . '"' ; $ aReturn = Array ( ) ; $ inc = $ wmiout = $ execstatus = null ; exec ( $ execString , $ wmiou...
Executes the specified query on the current connection .
58,723
public static function pluralize ( $ word ) { $ lowerCasedWord = strtolower ( $ word ) ; foreach ( static :: $ uncountables as $ uncountable ) { if ( substr ( $ lowerCasedWord , ( - 1 * strlen ( $ uncountable ) ) ) == $ uncountable ) { return $ word ; } } foreach ( static :: $ irregulars as $ plural => $ singular ) { i...
Pluralizes English noun .
58,724
public static function singularize ( $ word ) { static :: $ uncountables = array ( 'equipment' , 'information' , 'rice' , 'money' , 'species' , 'series' , 'fish' , 'sheep' , 'media' ) ; static :: $ irregulars = array ( 'person' => 'people' , 'man' => 'men' , 'child' => 'children' , 'sex' => 'sexes' , 'move' => 'moves' ...
Singularizes English plural .
58,725
public function setGithubOAuthToken ( $ token , $ domain = 'github.com' ) { $ this -> set ( self :: GITHUB_OAUTH_KEY . '/' . $ this -> escape ( $ domain ) , $ token ) ; return $ this ; }
Set a github OAuth token .
58,726
public function removeGithubOAuthToken ( $ domain = 'github.com' ) { $ this -> remove ( self :: GITHUB_OAUTH_KEY . '/' . $ this -> escape ( $ domain ) ) ; return $ this ; }
Unset a github OAuth token .
58,727
public function setGitlabOAuthToken ( $ token , $ domain = 'gitlab.com' ) { $ this -> set ( self :: GITLAB_OAUTH_KEY . '/' . $ this -> escape ( $ domain ) , $ token ) ; return $ this ; }
Set a gitlab OAuth token .
58,728
public function removeGitlabOAuthToken ( $ domain = 'gitlab.com' ) { $ this -> remove ( self :: GITLAB_OAUTH_KEY . '/' . $ this -> escape ( $ domain ) ) ; return $ this ; }
Unset a gitlab OAuth token .
58,729
public function setGitlabPrivateToken ( $ token , $ domain = 'gitlab.com' ) { $ this -> set ( self :: GITLAB_PRIVATE_KEY . '/' . $ this -> escape ( $ domain ) , $ token ) ; return $ this ; }
Set a gitlab private token .
58,730
public function removeGitlabPrivateToken ( $ domain = 'gitlab.com' ) { $ this -> remove ( self :: GITLAB_PRIVATE_KEY . '/' . $ this -> escape ( $ domain ) ) ; return $ this ; }
Unset a gitlab private token .
58,731
public function setBitbucketOAuth ( $ key , $ secret , $ domain = 'bitbucket.org' ) { $ this -> set ( self :: BITBUCKET_OAUTH_KEY . '/' . $ this -> escape ( $ domain ) , [ 'consumer-key' => $ key , 'consumer-secret' => $ secret ] ) ; return $ this ; }
Set Bitbucket OAuth .
58,732
public function removeBitbucketOAuth ( $ domain = 'bitbucket.org' ) { $ this -> remove ( self :: BITBUCKET_OAUTH_KEY . '/' . $ this -> escape ( $ domain ) ) ; return $ this ; }
Unset a Bitbucket token .
58,733
public function setHttpBasic ( $ username , $ password , $ domain ) { $ this -> set ( self :: HTTP_BASIC_KEY . '/' . $ this -> escape ( $ domain ) , [ 'username' => $ username , 'password' => $ password ] ) ; return $ this ; }
Set http - basic auth .
58,734
public function removeHttpBasic ( $ domain ) { $ this -> remove ( self :: HTTP_BASIC_KEY . '/' . $ this -> escape ( $ domain ) ) ; return $ this ; }
Unset http - basic auth .
58,735
public function markComplete ( $ calcId ) { $ dateEnded = $ this -> hlpDate -> getUtcNowForDb ( ) ; $ bind = [ ECalculation :: A_DATE_ENDED => $ dateEnded , ECalculation :: A_STATE => Cfg :: CALC_STATE_COMPLETE ] ; $ result = $ this -> updateById ( $ calcId , $ bind ) ; return $ result ; }
Mark calculation as complete .
58,736
public static function patchTags ( $ ids , $ tag ) { assert ( is_array ( $ ids ) || $ ids === 'all' ) ; $ fields = [ 'action' => 'reassign_tag' , 'data' => [ 'subscribers' => $ ids , 'tag' => $ tag ] ] ; Yii :: $ app -> mailtankClient -> sendRequest ( self :: ENDPOINT , json_encode ( $ fields ) , 'patch' ) ; return tru...
Reassigns tag to specified subscribers
58,737
public function validateOperator ( $ operator ) { $ operators = Operator :: get ( ) ; if ( in_array ( $ operator , $ operators ) ) return true ; $ message = "Operator: $operator is invalid, and cannot be used." ; throw new InvalidOperatorException ( $ message ) ; }
Validates the operator in an expression .
58,738
public function boot ( ) { if ( null === $ this -> service ) { throw new \ LogicException ( 'You must setup a ServiceInterface' ) ; } foreach ( $ this -> service -> getStatuses ( ) as $ status ) { $ hasToContinue = false ; foreach ( $ this -> filters as $ filter ) { if ( ! $ filter -> isValid ( $ status ) ) { $ hasToCo...
Fetch datas filter and format them .
58,739
public static function loadFile ( $ fileName ) { if ( ! preg_match ( '/\.ini$/i' , $ fileName ) ) { $ fileName .= '.ini' ; } if ( ! static :: isFileLoaded ( $ fileName ) ) { self :: $ files [ ] = $ fileName ; return static :: loadFileInMemory ( $ fileName ) ; } return false ; }
Charge un nouveau fichier de langue .
58,740
public function check ( ) { $ action = $ this -> request -> param ( 'action' ) ; $ controller = $ this -> request -> param ( 'controller' ) ; $ prefix = ( $ this -> request -> param ( 'prefix' ) === false ) ? '/' : $ this -> request -> param ( 'prefix' ) ; $ plugin = ( $ this -> request -> param ( 'plugin' ) === false ...
Checks whether the user or group is allowed access
58,741
private function getUniqueString ( $ controller , $ action , $ prefix = false , $ plugin = false ) { $ unique_string = '' ; if ( $ plugin && ! empty ( $ plugin ) ) $ unique_string .= $ plugin . '.' ; if ( $ prefix && $ prefix != '/' ) $ unique_string .= $ prefix ; return $ unique_string . '/' . $ controller . '->' . $ ...
Create unique string acl
58,742
public function newAction ( ) { $ entity = new ProductOrderStatus ( ) ; $ form = $ this -> createCreateForm ( $ entity ) ; return array ( 'entity' => $ entity , 'form' => $ form -> createView ( ) , ) ; }
Displays a form to create a new ProductOrderStatus entity .
58,743
public function commit ( UncommittedEvents $ events ) { $ aggregateId = ( string ) $ events [ 0 ] -> getAggregateIdentity ( ) ; $ stream = fopen ( $ this -> dataPath . '/' . $ aggregateId , 'a' ) ; $ i = 0 ; foreach ( $ events as $ event ) { $ content = ( $ i > 0 ) ? PHP_EOL : '' ; $ content .= serialize ( $ event ) ; ...
Serialize given events and save them do disk . Actually each event is a new line inside a single file for each aggregate
58,744
public function getMappedAttributes ( ) { $ mappedArrayForApiRequest = [ ] ; $ requestAttributes = $ this -> request -> getData ( ) ; foreach ( $ requestAttributes as $ key => $ value ) { if ( array_key_exists ( $ key , $ this -> mappingRequestToOtherRequestAttributes ) ) { $ mappedArrayForApiRequest [ $ this -> mappin...
Get mapped array from the request attributes to the other attributes
58,745
public function init ( $ dbConfig ) { $ profiler = new Profiler ( ) ; if ( isset ( $ this -> drivers [ $ dbConfig [ 'driver' ] ] ) ) { $ driverClass = $ this -> drivers [ $ dbConfig [ 'driver' ] ] ; self :: $ driverInstance = $ driverClass :: getInstance ( ) ; $ profiler -> getTimer ( ) -> start ( ) ; self :: $ driverI...
Connect to driver
58,746
public function overlay ( $ message , $ title = 'Notice' ) { $ this -> message ( $ message , $ title ) ; $ this -> session -> flash ( 'flash_notification.overlay' , true ) ; return $ this ; }
Flash an overlay modal .
58,747
public static function check_token ( $ value = null ) { $ value = $ value ? : \ Input :: param ( static :: $ csrf_token_key , \ Input :: json ( static :: $ csrf_token_key , 'fail' ) ) ; if ( static :: fetch_token ( ) == static :: $ csrf_old_token and ! empty ( $ value ) ) { static :: set_token ( true ) ; } return $ val...
Check CSRF Token
58,748
public static function generate_token ( ) { $ token_base = time ( ) . uniqid ( ) . \ Config :: get ( 'security.token_salt' , '' ) . mt_rand ( 0 , mt_getrandmax ( ) ) ; if ( function_exists ( 'hash_algos' ) and in_array ( 'sha512' , hash_algos ( ) ) ) { $ token = hash ( 'sha512' , $ token_base ) ; } else { $ token = md5...
Generate new token . Based on an example from OWASP
58,749
public function setException ( $ path ) { $ pathException = ( ! is_array ( $ path ) ) ? array ( $ path ) : $ path ; $ this -> exceptions = array_merge ( $ this -> exceptions , $ pathException ) ; }
Add a variable name for an exception
58,750
public function setRestriction ( $ path ) { $ pathRestriction = ( ! is_array ( $ path ) ) ? array ( $ path ) : $ path ; $ this -> restrctions = array_merge ( $ this -> restrctions , $ pathRestriction ) ; }
Add a path to restrict the checking to
58,751
public function run ( Config $ configuration ) { $ this -> config = $ configuration ; $ this -> config -> set ( 'base' , str_replace ( 'app.php' , '' , $ _SERVER [ 'SCRIPT_NAME' ] ) ) ; try { $ request = $ this -> getRequest ( ) ; if ( ! $ this -> config -> get ( 'routes' ) ) { throw new Exception404 ( "No routes" , 1 ...
Executes application .
58,752
protected function findRoute ( $ request_id ) { $ routes = $ this -> config -> get ( 'routes' ) ; foreach ( $ routes as $ pattern => $ action ) { $ pattern = '/^' . $ pattern . '$/' ; if ( preg_match ( $ pattern , $ request_id , $ parameters ) ) { $ chunks = explode ( '::' , $ action ) ; $ controller_name = $ chunks [ ...
Finds the route for the current path .
58,753
protected function cleanParameters ( array $ parameters ) { foreach ( $ parameters as $ parameter => $ value ) { if ( is_int ( $ parameter ) ) { unset ( $ parameters [ $ parameter ] ) ; } } return $ parameters ; }
Clean parameters from integer keys .
58,754
public static function isBodyAllowed ( $ code ) { if ( ! isset ( self :: $ codesDescriptions [ $ code ] ) ) { throw new InvalidArgumentException ( "Invalid code $code specified" ) ; } return ( $ code >= self :: OK && $ code !== self :: NO_CONTENT && $ code !== self :: NOT_MODIFIED ) ; }
Provides information if provided code allow to contain body .
58,755
public function execute ( ) { $ resultPage = $ this -> _resultPageFactory -> create ( ) ; $ resultPage -> setActiveMenu ( 'WorldnetTPS_SecureCard::securecard_list' ) ; $ resultPage -> getConfig ( ) -> getTitle ( ) -> prepend ( __ ( 'WorldNetTPS SecureCard' ) ) ; return $ resultPage ; }
Grid List page .
58,756
public static function build ( $ name , $ type ) { $ factory = new BuildFactory ( self :: config ( $ name ) , $ type ) ; $ buildNode = $ factory -> build ( ) ; $ buildNode -> build ( ) ; return $ buildNode -> getNodes ( ) ; }
API for build node
58,757
public static function generate ( $ name , $ properties ) { $ factory = new GenerateFactory ( self :: config ( $ name ) , $ properties ) ; $ generateNode = $ factory -> generate ( ) ; $ generateNode -> generate ( ) ; return $ generateNode ; }
API for generate node
58,758
public function getById ( $ id , $ cascade = false ) { $ result = self :: getField ( $ this -> data , $ id , null ) ; if ( $ cascade && null !== $ result && isset ( $ this -> one [ $ id ] ) ) { foreach ( $ this -> one [ $ id ] as $ class => $ foreignId ) { $ result = array_merge ( $ class :: getInstance ( ) -> getById ...
Gets data by id
58,759
public function getAllWhichHasOne ( $ foreignId , JSONSimpleStorage $ object , $ cascade = false ) { $ result = [ ] ; if ( isset ( $ object -> many [ $ foreignId ] [ $ this -> class ] ) ) { foreach ( $ object -> many [ $ foreignId ] [ $ this -> class ] as $ id ) { if ( null !== ( $ item = $ this -> getById ( $ id , $ c...
Gets all records which has one object
58,760
public function hasOne ( $ id , JSONSimpleStorage $ object , $ foreignId ) { if ( ! isset ( $ this -> one [ $ id ] ) ) { $ this -> one [ $ id ] = [ ] ; } if ( ! isset ( $ object -> many [ $ foreignId ] ) ) { $ object -> many [ $ foreignId ] = [ ] ; $ object -> many [ $ foreignId ] [ $ this -> class ] = [ ] ; } else if ...
Sets relation has one
58,761
public function hasMany ( $ id , \ JSONSimpleStorage $ object , array $ foreignIds ) { foreach ( $ foreignIds as $ foreignId ) { $ object -> hasOne ( $ foreignId , $ this , $ id ) ; } }
Sets has many relation
58,762
private function store ( ) { file_put_contents ( $ this -> getFilename ( ) , json_encode ( [ self :: FIELD_IDGEN => $ this -> idGen , self :: FIELD_DATA => $ this -> data , self :: FIELD_MANY => $ this -> many , self :: FIELD_ONE => $ this -> one , ] ) ) ; }
Stores data in file
58,763
public function captureStart ( EventInterface $ event ) { ++ $ this -> index ; $ time = microtime ( true ) ; $ eventName = $ event -> getName ( ) ; if ( $ eventName ) { $ this -> timers [ $ eventName ] = [ 'start' => $ time , 'stop' => $ time ] ; return ; } $ this -> timers [ $ this -> index ] = [ 'start' => $ time , '...
Fixes the event start time .
58,764
public function captureStop ( EventInterface $ event ) { $ time = microtime ( true ) ; $ eventName = $ event -> getName ( ) ; if ( $ eventName && isset ( $ this -> timers [ $ eventName ] ) ) { $ this -> timers [ $ eventName ] [ 'stop' ] = $ time ; return ; } $ this -> timers [ $ this -> index ] [ 'stop' ] = $ time ; }
Fixes the event stop time .
58,765
public function readFile ( $ filename ) { if ( ! is_string ( $ filename ) ) throw new IniReadingException ( 'The expected type is string' ) ; if ( ! file_exists ( $ filename ) || ! is_readable ( $ filename ) ) throw new IniReadingException ( sprintf ( "The file %s doesn't exist or is not readable" , $ filename ) ) ; if...
Parse INI file .
58,766
public function readString ( $ string ) { if ( ! is_string ( $ string ) ) throw new IniReadingException ( 'The expected type is string' ) ; $ string .= "\n" ; $ data = @ parse_ini_string ( $ string , true ) ; if ( $ data === false ) { $ e = error_get_last ( ) ; throw new IniReadingException ( 'Syntax error in INI confi...
Parse INI string .
58,767
private function toCollection ( array $ array ) { $ collection = new IniCollection ( [ ] ) ; foreach ( $ array as $ k => $ v ) { if ( is_array ( $ array [ $ k ] ) ) $ collection -> set ( $ k , $ this -> toCollection ( $ array [ $ k ] ) -> toArray ( ) ) ; else $ collection -> set ( $ k , $ v ) ; } return $ collection ; ...
Transform array to IniCollection .
58,768
private function decode ( $ data , $ raw ) { if ( is_array ( $ data ) ) { foreach ( $ data as $ k => & $ v ) { $ v = $ this -> decode ( $ v , $ raw [ $ k ] ) ; } return $ data ; } $ data = $ this -> decodeBoolean ( $ data , $ raw ) ; $ data = $ this -> decodeNull ( $ data , $ raw ) ; if ( is_numeric ( $ data ) && ( ( s...
Detect and decode all value .
58,769
private function decodeBoolean ( $ data , $ rawValue ) { if ( $ data === '1' && ( $ rawValue === 'true' || $ rawValue === 'on' || $ rawValue === 'yes' ) ) return true ; elseif ( ( $ data === '0' || empty ( $ data ) ) && ( $ rawValue === 'false' || $ rawValue === 'off' || $ rawValue === 'no' ) ) return false ; return $ ...
Detect and decode boolean value .
58,770
public function detectChanges ( ) { $ this -> signalDispatcher -> connect ( FlowFileMonitor :: class , 'filesHaveChanged' , function ( string $ fileMonitorIdentifier , array $ changedFiles ) { if ( $ fileMonitorIdentifier === static :: FILE_MONITOR_IDENTIFIER ) { foreach ( $ changedFiles as $ changedFile => $ status ) ...
Detects react file changes
58,771
private function compilePath ( RouteInterface $ route , array $ parameters , $ host , $ type , $ name ) { if ( static :: RELATIVE_PATH === $ type && null !== $ route -> getHost ( ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Can\'t create relative path because route "%s" requires a deticated hostname.' , $ na...
Compiles a Route instance into a readable path or url .
58,772
public function add ( $ event ) { $ event -> setParent ( $ this -> _parent ) ; $ this -> _events [ $ event -> getName ( ) ] = $ event ; }
add an event to he pile
58,773
public function destroy ( $ name ) { if ( isset ( $ this -> _events [ $ name ] ) ) { unset ( $ this -> _events [ $ name ] ) ; $ this -> _events = array_values ( $ this -> _events ) ; } }
destroy an event
58,774
public function getResult ( $ name = '' ) { $ result = [ ] ; if ( $ name != '' ) { if ( isset ( $ this -> _events [ $ name ] ) ) { return $ this -> _events [ $ name ] -> getResult ( ) ; } else { return false ; } } else { foreach ( $ this -> _events as $ events ) { $ result [ $ events -> getName ( ) ] = $ events -> getR...
get result returned by the listener
58,775
public function setStatus ( $ name = '' , $ status = self :: START ) { if ( $ name != '' ) { if ( isset ( $ this -> _events [ $ name ] ) ) { $ this -> _events [ $ name ] -> setStatus ( $ status ) ; return true ; } else { return false ; } } else { return false ; } }
set the status
58,776
public function getStatus ( $ name = '' ) { if ( $ name != '' ) { if ( isset ( $ this -> _events [ $ name ] ) ) { return $ this -> _events [ $ name ] -> getStatus ( ) ; } else { return false ; } } else { return false ; } }
get the status of the event
58,777
public function removeElement ( $ element ) { $ key = array_search ( $ element , $ this -> getArrayCopy ( ) ) ; if ( false !== $ key ) { $ this -> remove ( $ key ) ; } }
Remove object from the collection
58,778
public function sendReconfirmationMessage ( User $ user , Token $ token ) { if ( $ token -> type == Token :: TYPE_CONFIRM_NEW_EMAIL ) { $ email = $ user -> unconfirmedEmail ; } else { $ email = $ user -> email ; } return $ this -> sendMessage ( $ email , $ this -> getReconfirmationSubject ( ) , 'reconfirmation' , [ 'us...
Sends an email to a user with reconfirmation link .
58,779
public function actionUpdate ( $ id ) { Url :: remember ( '' , 'actions-redirect' ) ; $ user = $ this -> findModel ( $ id ) ; $ user -> scenario = User :: SCENARIO_UPDATE ; $ event = $ this -> getUserEvent ( $ user ) ; $ this -> performAjaxValidation ( $ user ) ; $ this -> trigger ( self :: EVENT_BEFORE_UPDATE , $ even...
Updates an existing User model .
58,780
public function actionConfirm ( $ id ) { $ model = $ this -> findModel ( $ id ) ; $ event = $ this -> getUserEvent ( $ model ) ; $ this -> trigger ( self :: EVENT_BEFORE_CONFIRM , $ event ) ; $ model -> confirm ( ) ; $ this -> trigger ( self :: EVENT_AFTER_CONFIRM , $ event ) ; Yii :: $ app -> getSession ( ) -> setFlas...
Confirms the User .
58,781
protected function performAjaxValidation ( $ model ) { if ( Yii :: $ app -> request -> isAjax && ! Yii :: $ app -> request -> isPjax ) { if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) ) { Yii :: $ app -> response -> format = Response :: FORMAT_JSON ; echo json_encode ( ActiveForm :: validate ( $ model ) )...
Performs AJAX validation .
58,782
private function applyPatch ( $ patches ) : void { $ homeDir = $ this -> parameters -> get ( 'dotfiles.home_dir' ) ; $ this -> debug ( 'start applying patch to ' . $ homeDir ) ; $ fs = new Filesystem ( ) ; foreach ( $ patches as $ relPath => $ patch ) { $ contents = implode ( PHP_EOL , $ patch ) ; $ target = $ homeDir ...
Processing all registered patch .
58,783
public function indexAction ( ) { $ jobManager = $ this -> get ( 'phlexible_queue.job_manager' ) ; $ data = [ ] ; foreach ( $ jobManager -> findAll ( ) as $ job ) { $ data [ ] = [ 'id' => $ job -> getId ( ) , 'command' => $ job -> getCommand ( ) , 'arguments' => implode ( ' ' , $ job -> getArguments ( ) ) , 'priority' ...
Return queue status .
58,784
public function getDir ( ) { if ( $ this -> dir === null ) { $ rc = new \ ReflectionClass ( $ this ) ; $ this -> dir = dirname ( $ rc -> getFileName ( ) ) ; } return $ this -> dir ; }
Retuns the module directory
58,785
public function setResource ( $ id , $ resource ) { if ( ! ( $ resource instanceof Redis ) ) { throw new ArchException ( 'Not a valid redis resource' ) ; } $ this -> resources [ ( string ) $ id ] = [ 'persistent_id' => '' , 'lib_options' => [ ] , 'server' => [ ] , 'password' => '' , 'database' => 0 , 'resource' => $ re...
Set a resource
58,786
public static function getPaddingPluginManager ( ) { if ( static :: $ paddingPlugins === null ) { self :: setPaddingPluginManager ( new \ Zend \ Crypt \ Symmetric \ PaddingPluginManager ( ) ) ; } return static :: $ paddingPlugins ; }
Returns the padding plugin manager . If it doesn t exist it s created .
58,787
public static function setPaddingPluginManager ( $ plugins ) { if ( is_string ( $ plugins ) ) { if ( ! class_exists ( $ plugins ) ) { throw new \ Cityware \ Exception \ InvalidArgumentException ( sprintf ( 'Unable to locate padding plugin manager via class "%s"; class does not exist' , $ plugins ) ) ; } $ plugins = new...
Set the padding plugin manager
58,788
public function getKeySize ( ) { return mcrypt_get_key_size ( $ this -> supportedAlgos [ $ this -> algo ] , $ this -> supportedModes [ $ this -> mode ] ) ; }
Get the maximum key size for the selected cipher and mode of operation
58,789
public function getKey ( ) { if ( empty ( $ this -> key ) ) { return null ; } return substr ( $ this -> key , 0 , $ this -> getKeySize ( ) ) ; }
Get the encryption key
58,790
public function setPadding ( \ Zend \ Crypt \ Symmetric \ Padding \ PaddingInterface $ padding ) { $ this -> padding = $ padding ; return $ this ; }
Set the padding object
58,791
public function getCipherDataSalt ( $ data ) { if ( empty ( $ data ) ) { throw new \ Cityware \ Exception \ InvalidArgumentException ( 'The data to decrypt cannot be empty' ) ; } else { $ cipherData = base64_decode ( $ data ) ; } return substr ( $ cipherData , 0 , $ this -> getSaltSize ( ) ) ; }
Get the original salt value
58,792
public function setMode ( $ mode ) { if ( ! empty ( $ mode ) ) { $ mode = strtolower ( $ mode ) ; if ( ! array_key_exists ( $ mode , $ this -> supportedModes ) ) { throw new \ Cityware \ Exception \ InvalidArgumentException ( "The mode $mode is not supported by " . __CLASS__ ) ; } $ this -> mode = $ mode ; } return $ t...
Set the cipher mode
58,793
public function getBlockSize ( ) { return mcrypt_get_block_size ( $ this -> supportedAlgos [ $ this -> algo ] , $ this -> supportedModes [ $ this -> mode ] ) ; }
Get the block size
58,794
protected function _normalizeIterator ( $ iterable ) { if ( $ iterable instanceof stdClass ) { $ iterable = ( array ) $ iterable ; } if ( ! is_array ( $ iterable ) && ! ( $ iterable instanceof Traversable ) ) { throw $ this -> _createInvalidArgumentException ( $ this -> __ ( 'Invalid iterable' ) , null , null , $ itera...
Normalizes an iterable value into an iterator .
58,795
public function mockService ( $ service , $ singleton = true ) { $ mock = \ Mockery :: mock ( $ service ) -> makePartial ( ) ; $ this -> getContainer ( ) -> add ( $ service , $ mock , $ singleton ) ; return $ mock ; }
Mock service and add to container
58,796
public function get ( $ name ) { $ command = $ this -> driver -> factoryCommand ( 'cookie' , WebDriver_Command :: METHOD_GET ) ; $ value = $ this -> driver -> curl ( $ command ) [ 'value' ] ; $ search = array_filter ( $ value , function ( $ item ) use ( $ name ) { return ( $ item [ 'name' ] == $ name ) ; } ) ; $ search...
Retrieve one cookie visible to the current page .
58,797
public function getAll ( ) { $ command = $ this -> driver -> factoryCommand ( 'cookie' , WebDriver_Command :: METHOD_GET ) ; $ all = $ this -> driver -> curl ( $ command ) [ 'value' ] ; $ result = [ ] ; foreach ( $ all as $ value ) { $ result [ $ value [ 'value' ] ] = new WebDriver_Object_Cookie_CookieInfo ( $ value ) ...
Retrieve all cookies visible to the current page .
58,798
public function delete ( $ name ) { $ command = $ this -> driver -> factoryCommand ( "cookie/{$name}" , WebDriver_Command :: METHOD_DELETE ) ; $ this -> driver -> curl ( $ command ) ; }
Delete the cookie with the given name .
58,799
public function clearAll ( ) { $ command = $ this -> driver -> factoryCommand ( 'cookie' , WebDriver_Command :: METHOD_DELETE ) ; $ this -> driver -> curl ( $ command ) ; }
Delete all cookies visible to the current page .