idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
235,700
public function move ( $ toDir , $ fileName = null , $ mode = 0775 ) { if ( $ this -> hasError ( ) ) { throw new \ Exception ( 'Cannot move file, the file has not been correctly uploaded!' ) ; } $ fileName = ( empty ( $ fileName ) ? $ this -> get ( 'name' ) : $ fileName ) ; if ( ! file_exists ( $ toDir ) && ! mkdir ( $...
Move uploaded file .
235,701
public function actionView ( $ id ) { if ( ! empty ( $ id ) ) { $ model = Order :: findOne ( $ id ) ; if ( empty ( $ model ) ) { $ model = new Order ( ) ; } if ( Yii :: $ app -> user -> can ( 'changeOrderStatus' ) ) { if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) ) { $ this -> trigger ( self :: EVENT_BEF...
Displays a single Order model and changes status for this model .
235,702
public function actionDeleteProduct ( $ id ) { if ( ( $ model = OrderProduct :: findOne ( $ id ) ) !== null ) { $ model -> delete ( ) ; } else { throw new NotFoundHttpException ( 'The requested page does not exist.' ) ; } return $ this -> redirect ( \ Yii :: $ app -> request -> referrer ) ; }
Deletes product from existing Order model . If deletion is successful the browser will be redirected to the view page .
235,703
private function calculateSelectOptionsSize ( $ aElements , $ aFeatures = [ ] ) { $ selectSize = $ this -> calculateSelectOptionsSizeForced ( $ aElements , $ aFeatures ) ; if ( ( in_array ( 'include_null' , $ aFeatures ) ) && ( $ selectSize != '1' ) ) { $ selectSize ++ ; } return $ selectSize ; }
Calculate the optimal for all options within a select tag
235,704
private function setOptionsForSelect ( $ aElements , $ sDefaultValue , $ featArray = null ) { if ( is_null ( $ featArray ) ) { $ featArray = [ ] ; } $ sReturn = [ ] ; $ crtGroup = null ; foreach ( $ aElements as $ key => $ value ) { $ aFH = $ this -> setOptionGroupFooterHeader ( $ featArray , $ value , $ crtGroup ) ; $...
Creates all the child tags required to populate a SELECT tag
235,705
public static function getValueByPath ( $ dataTree , $ path ) { $ pathParts = explode ( "." , $ path ) ; foreach ( $ pathParts as $ name ) { if ( ! isset ( $ dataTree -> { $ name } ) ) { return null ; } $ dataTree = $ dataTree -> { $ name } ; } return $ dataTree ; }
Get the value of the property in the data tree specified by the dotted path .
235,706
public static function setValueByPath ( $ dataTree , $ path , $ value , $ add ) { $ pathParts = explode ( "." , $ path ) ; $ name = $ pathParts [ 0 ] ; if ( ! $ add and ! isset ( $ dataTree -> { $ name } ) ) { return false ; } if ( count ( $ pathParts ) == 1 ) { $ dataTree -> { $ name } = $ value ; return true ; } if (...
Set the value of the property specified by the given path in the data tree .
235,707
public static function removeValueByPath ( $ dataTree , $ path ) { $ pathParts = explode ( "." , $ path ) ; $ name = $ pathParts [ 0 ] ; if ( ! isset ( $ dataTree -> { $ name } ) ) { return false ; } if ( count ( $ pathParts ) == 1 ) { unset ( $ dataTree -> { $ name } ) ; return true ; } return ValueByPath :: removeVal...
Remove the value of the property specified by the given path in the data tree .
235,708
public function getDriver ( $ libraryName , array $ parameters = null , array $ directory = null , $ newInstance = false ) { if ( empty ( $ libraryName ) ) { throw new LibraryException ( "Could not load driver. No name provided" , 1 ) ; } if ( ! class_exists ( 'FuzeWorks\FW_Driver_Library' , false ) ) { require_once ( ...
Driver Library Loader
235,709
protected function loadLibrary ( $ libraryName , $ parameters = null , array $ directory = null , $ newInstance = false ) { $ directories = ( is_null ( $ directory ) ? $ this -> libraryPaths : $ directory ) ; $ class = trim ( $ libraryName , '/' ) ; if ( ( $ last_slash = strrpos ( $ class , '/' ) ) !== FALSE ) { $ subd...
Internal Library Loader
235,710
protected function loadAppLibrary ( $ class , $ subdir , array $ parameters = null , array $ directories , $ newInstance = false ) { if ( ! is_array ( $ directories ) ) { throw new LibraryException ( "Could not load library. \$directory variable was not an array" , 1 ) ; } foreach ( $ directories as $ directory ) { if ...
Application Library Loader
235,711
public function removeLibraryPath ( $ directory ) { if ( ( $ key = array_search ( $ directory , $ this -> libraryPaths ) ) !== false ) { unset ( $ this -> libraryPaths [ $ key ] ) ; } }
Remove a path where libraries can be found
235,712
function find ( array $ logic = null ) { $ logic != null or $ logic = [ ] ; $ opt = [ ] ; foreach ( [ '%fields' , '%order_by' , '%limit' , '%offset' ] as $ key ) { if ( isset ( $ logic [ $ key ] ) ) { $ opt [ $ key ] = $ logic [ $ key ] ; unset ( $ logic [ $ key ] ) ; } else { $ opt [ $ key ] = [ ] ; } } $ entries = $ ...
You can specify fields via %fields You can specify limit via %limit and offset via %offset You can specify order rules via %order_by
235,713
protected function sqlinsert ( array $ fields , array $ nums = null , array $ bools = null ) { $ db = $ this -> db ; $ nums != null or $ nums = [ ] ; $ bools != null or $ bools = [ ] ; $ keys = array_keys ( $ fields ) ; $ strs = array_diff ( $ keys , $ bools , $ nums ) ; $ key_fields = \ hlin \ Arr :: join ( ', ' , $ k...
Inserts fields if bools or nums are specified the fields mentioned are treated as strings .
235,714
protected function sqlupdate ( array $ fields , array $ nums = null , array $ bools = null ) { $ db = $ this -> db ; $ idfield = $ this -> idfield ( ) ; $ nums != null or $ nums = [ ] ; $ bools != null or $ bools = [ ] ; $ keys = array_diff ( array_keys ( $ fields ) , [ $ idfield ] ) ; $ strs = array_diff ( array_keys ...
Update fields if bools or nums are specified the fields mentioned are treated as strings
235,715
protected function sqlentry ( $ entry_id ) { $ res = $ this -> sqlfind ( [ $ this -> idfield ( ) => $ entry_id ] , null , null , 1 ) ; if ( empty ( $ res ) ) { return null ; } else { return $ res [ 0 ] ; } }
Mostly an alias to sqlsearch on id with limit of 1 .
235,716
public static function factory ( $ config = array ( ) ) { $ default = array ( 'base_url' => 'https://api.runkeeper.com' , 'logger' => FALSE , ) ; $ required = array ( 'base_url' ) ; $ config = Collection :: fromConfig ( $ config , $ default , $ required ) ; $ client = new self ( $ config -> get ( 'base_url' ) ) ; $ cli...
Factory method to create a new HealthGraphClient
235,717
public function headers ( ) : array { return collect ( $ this -> request -> getHeaders ( ) ) -> mapWithKeys ( function ( $ values , $ header ) { return [ $ header => $ values [ 0 ] ] ; } ) -> all ( ) ; }
Gets all header values .
235,718
public function build ( ) : string { if ( count ( $ this -> parameters ) === 0 ) { return '' ; } $ queryString = '' ; foreach ( $ this -> parameters as $ name => $ value ) { $ queryString .= $ this -> buildQuery ( $ name , $ value ) ; } return substr ( $ queryString , 1 ) ; }
build the query from parameters
235,719
protected function buildQuery ( string $ name , $ value , string $ postfix = '' ) : string { $ query = '' ; if ( is_array ( $ value ) ) { foreach ( $ value as $ k => $ v ) { if ( is_int ( $ k ) ) { $ query .= $ this -> buildQuery ( '' , $ v , $ postfix . $ name . '[]' ) ; } else { $ query .= $ this -> buildQuery ( '' ,...
Calculates query string
235,720
public function addParam ( string $ name , $ value ) : self { if ( ! is_array ( $ value ) && ! is_scalar ( $ value ) && null !== $ value ) { if ( is_object ( $ value ) && method_exists ( $ value , '__toString' ) ) { $ value = ( string ) $ value ; } else { throw new \ InvalidArgumentException ( 'Argument 2 passed to ' ....
add a parameter
235,721
public function removeParam ( string $ name ) : self { if ( array_key_exists ( $ name , $ this -> parameters ) ) { unset ( $ this -> parameters [ $ name ] ) ; } return $ this ; }
remove a param
235,722
final public function __isset ( $ prop ) { $ this -> magicPropConvert ( $ prop ) ; return is_array ( $ this -> { $ this :: MAGIC_PROPERTY } ) ? array_key_exists ( $ prop , $ this -> { $ this :: MAGIC_PROPERTY } ) : isset ( $ this -> { $ this :: MAGIC_PROPERTY } -> $ prop ) ; }
Magic isset metod .
235,723
public function next ( ) { $ this -> valid = ! $ this -> inputStream -> eof ( ) ; $ this -> currentLine = $ this -> inputStream -> readLine ( ) ; $ this -> lineNumber ++ ; }
moves forward to next line
235,724
public function rewind ( ) { if ( ! ( $ this -> inputStream instanceof Seekable ) ) { return ; } $ this -> inputStream -> seek ( 0 , Seekable :: SET ) ; $ this -> lineNumber = 0 ; $ this -> currentLine = null ; $ this -> next ( ) ; }
rewinds to first line
235,725
public function addDebug ( $ message , array $ context = array ( ) ) { return $ this -> _instance -> addRecord ( \ Monolog \ Logger :: DEBUG , $ message , $ context ) ; }
Adds a log record at the DEBUG level .
235,726
public function addInfo ( $ message , array $ context = array ( ) ) { return $ this -> _instance -> addRecord ( \ Monolog \ Logger :: INFO , $ message , $ context ) ; }
Adds a log record at the INFO level .
235,727
public function addNotice ( $ message , array $ context = array ( ) ) { return $ this -> _instance -> addRecord ( \ Monolog \ Logger :: NOTICE , $ message , $ context ) ; }
Adds a log record at the NOTICE level .
235,728
public function addCritical ( $ message , array $ context = array ( ) ) { return $ this -> _instance -> addRecord ( \ Monolog \ Logger :: CRITICAL , $ message , $ context ) ; }
Adds a log record at the CRITICAL level .
235,729
public function addAlert ( $ message , array $ context = array ( ) ) { return $ this -> _instance -> addRecord ( \ Monolog \ Logger :: ALERT , $ message , $ context ) ; }
Adds a log record at the ALERT level .
235,730
public function warn ( $ message , array $ context = array ( ) ) { return $ this -> _instance -> addRecord ( \ Monolog \ Logger :: WARNING , $ message , $ context ) ; }
Adds a log record at the WARNING level .
235,731
public function err ( $ message , array $ context = array ( ) ) { return $ this -> _instance -> addRecord ( \ Monolog \ Logger :: ERROR , $ message , $ context ) ; }
Adds a log record at the ERROR level .
235,732
public function emergency ( $ message , array $ context = array ( ) ) { return $ this -> _instance -> addRecord ( \ Monolog \ Logger :: EMERGENCY , $ message , $ context ) ; }
Adds a log record at the EMERGENCY level .
235,733
protected function addPointToUser ( $ number , $ beforePoint , $ afterPoint ) { if ( $ this -> pointNotIsset ( ) ) $ point = $ this -> createPointToUser ( ) ; else $ point = Point :: where ( 'user_id' , $ this -> id ) -> where ( 'rule_id' , $ this -> ruleId ) -> first ( ) ; $ this -> logPoint ( $ point -> id , $ number...
update user point
235,734
private function createPointToUser ( $ number = null ) { return Point :: create ( [ 'user_id' => $ this -> id , 'rule_id' => $ this -> ruleId , 'number' => $ number ] ) ; }
create point to user
235,735
public static function command ( string $ command , bool $ passThrough = false ) : CommandResultInterface { return new CommandResult ( new static ( $ command , $ passThrough ) ) ; }
Creates new instance of self and passes it to new instance of CommandResult
235,736
public function convertFrom ( $ source , $ targetType , array $ convertedChildProperties = [ ] , PropertyMappingConfigurationInterface $ configuration = null ) { $ result = [ ] ; $ array = ( 'array' === $ targetType ) ? $ source : $ convertedChildProperties ; foreach ( $ array as $ name => $ subProperty ) { $ result [ ...
Converts into an array leaving child properties types .
235,737
public function showAction ( $ id , $ extra ) { $ entity = $ this -> container -> get ( "layout.read_handler" ) -> get ( $ id ) ; $ delete_form = $ this -> container -> get ( "layout.form_handler" ) -> createDeleteForm ( $ id ) ; $ layout = str_replace ( ":show.html.twig" , ":display.html.twig" , $ this -> container ->...
Finds and displays a layout entity .
235,738
public static function render ( $ m , $ rowLength = 16 , $ fillChar = ' ' , $ showOffset = true ) { $ res = '' ; $ rowOffset = 0 ; $ bytes = '' ; $ hex = '' ; $ j = 0 ; for ( $ i = 0 ; $ i < strlen ( $ m ) ; $ i ++ ) { $ x = substr ( $ m , $ i , 1 ) ; $ bytes .= self :: decodeReadable ( $ x ) ; $ hex .= bin2hex ( $ x )...
Prints hex dump of a binary string similar to xxd
235,739
protected function setFooterCommon ( $ footerInjected = null ) { $ sHK = $ this -> tCmnSuperGlobals -> get ( 'specialHook' ) ; if ( ! is_null ( $ sHK ) && ( in_array ( 'noHeader' , $ sHK ) ) ) { return '' ; } return $ this -> setFooterCommonInjected ( $ footerInjected ) . '</body></html>' ; }
Outputs an HTML footer
235,740
protected function setHeaderCommon ( $ headerFeatures = [ ] ) { $ sReturn = [ ] ; $ this -> initializeSprGlbAndSession ( ) ; $ sHK = $ this -> tCmnSuperGlobals -> get ( 'specialHook' ) ; if ( ! is_null ( $ sHK ) && ( in_array ( 'noHeader' , $ sHK ) ) ) { return '' ; } $ fixedHeaderElements = [ 'start' => '<!DOCTYPE htm...
Outputs an HTML header
235,741
public function scan ( $ filepath ) { $ proc = new Process ( sprintf ( '%s %s --Output=XML --Full' , $ this -> path , $ filepath ) ) ; $ proc -> run ( ) ; if ( ! $ proc -> isSuccessful ( ) ) { throw new \ RuntimeException ( $ proc -> getErrorOutput ( ) ) ; } $ result = $ proc -> getOutput ( ) ; $ xml = simplexml_load_s...
Scans a file to return any structured metadata .
235,742
public static function fullUrl ( ) { $ s = empty ( $ _SERVER [ "HTTPS" ] ) ? '' : ( $ _SERVER [ "HTTPS" ] == "on" ) ? "s" : "" ; $ protocol = StringUtils :: strLeft ( strtolower ( $ _SERVER [ "SERVER_PROTOCOL" ] ) , "/" ) . $ s ; $ port = ( $ _SERVER [ "SERVER_PORT" ] == "80" || $ _SERVER [ "SERVER_PORT" ] == "443" ) ?...
Returns the current full url
235,743
public static function safeUrl ( $ url ) { if ( empty ( $ url ) ) return '' ; if ( ! preg_match ( "/^(https?):\/\//" , $ url ) ) $ url = 'http://' . $ url ; if ( ! self :: isURL ( $ url ) ) $ url = '' ; return filter_var ( $ url , FILTER_SANITIZE_URL ) ; }
Outputs a safe url stripped of xss autolink on domain and stripped of invalid chars
235,744
public static function resolveContextVariables ( $ value , $ object ) { $ value = str_replace ( array ( '%PATH_BUILD%' , '%CONTEXT%' , '%REWRITE_BASE%' , '%SERVER_NAME%' , '%DEVICE_VIEW%' , '%DESIGN%' , '%DOMAIN%' , '%DOMAIN_BASE_URI%' , '%DEPLOYMENT_BASE_PATH%' ) , array ( PATH_BUILD , ( $ object instanceof ContextObj...
Replace variables inside a value using the object as an originating reference
235,745
public static function resolveSiteFromArray ( $ siteArray , $ useDomainAlias = false ) { $ site = new Site ( ) ; return self :: resolveSiteContextObject ( $ site , $ siteArray , $ useDomainAlias ) ; }
Creates a Site object from an array originating from the environments . xml
235,746
public static function resolveContextFromArray ( $ contextArray , $ useDomainAlias = false ) { $ context = new ContextObject ( ) ; return self :: resolveSiteContextObject ( $ context , $ contextArray , $ useDomainAlias ) ; }
Creates a ContextObject object from an array originating from the environments . xml
235,747
public function create ( $ request , $ match , $ p ) { if ( isset ( $ match [ 'collectionId' ] ) ) { $ collectionId = $ match [ 'collectionId' ] ; $ request -> REQUEST [ 'collection' ] = $ collectionId ; } else { $ collectionId = $ request -> REQUEST [ 'collection' ] ; } Pluf_Shortcuts_GetObjectOr404 ( 'Collection_Coll...
Creates new instance of a document
235,748
public function get ( $ request , $ match ) { if ( isset ( $ match [ 'collectionId' ] ) ) { $ collectionId = $ match [ 'collectionId' ] ; } else { $ collectionId = $ request -> REQUEST [ 'collectionId' ] ; } $ collection = Pluf_Shortcuts_GetObjectOr404 ( 'Collection_Collection' , $ collectionId ) ; $ document = Pluf_Sh...
Gets a document
235,749
public function find ( $ request , $ match ) { if ( isset ( $ match [ 'collectionId' ] ) ) { $ collectionId = $ match [ 'collectionId' ] ; } elseif ( isset ( $ request -> REQUEST [ 'collectionId' ] ) ) { $ collectionId = $ request -> REQUEST [ 'collectionId' ] ; } $ document = new Collection_Document ( ) ; $ paginator ...
Search for an document
235,750
public function remove ( $ request , $ match ) { if ( isset ( $ match [ 'collectionId' ] ) ) { $ collectionId = $ match [ 'collectionId' ] ; } else { $ collectionId = $ request -> REQUEST [ 'collectionId' ] ; } $ collection = Pluf_Shortcuts_GetObjectOr404 ( 'Collection_Collection' , $ collectionId ) ; if ( isset ( $ ma...
Removes a document
235,751
public function update ( $ request , $ match , $ p ) { if ( isset ( $ match [ 'collectionId' ] ) ) { $ collectionId = $ match [ 'collectionId' ] ; $ request -> REQUEST [ 'collection' ] = $ collectionId ; } else { $ collectionId = $ request -> REQUEST [ 'collection' ] ; } $ collection = Pluf_Shortcuts_GetObjectOr404 ( '...
Updates a document
235,752
public function putMap ( $ request , $ match ) { if ( isset ( $ match [ 'collectionId' ] ) ) { $ collectionId = $ match [ 'collectionId' ] ; } else { $ collectionId = $ request -> REQUEST [ 'collectionId' ] ; } if ( isset ( $ match [ 'documentId' ] ) ) { $ documentId = $ match [ 'documentId' ] ; } else { $ documentId =...
Puts attributes of a document
235,753
private function connect ( ) { $ this -> sessionLink = mysqli_connect ( $ this -> host_master , $ this -> user , $ this -> password , $ this -> name ) or die ( "Error " . mysqli_error ( $ this -> sessionLink ) ) ; }
NOT WORKING!!! Lazy - connects to the database .
235,754
public function getKeyedByPropertyMulti ( $ property ) { $ keyed = [ ] ; foreach ( $ this as $ model ) { if ( empty ( $ keyed [ $ model -> $ property ] ) ) { $ keyed [ $ model -> $ property ] = [ ] ; } $ keyed [ $ model -> $ property ] [ ] = $ model ; } return $ keyed ; }
key the iterator by the specified property but go 2 levels
235,755
public function loadFromArray ( array $ data , $ useKeys = true ) { $ this -> items = array ( ) ; foreach ( $ data as $ key => $ item ) { $ this -> items [ ] = $ item ; } }
Loads collection values from the given array
235,756
public static function getDefinitionFormContainer ( CompilerExtension $ compilerExtension , $ indexConfig = 'formContainer' , $ prefixName = 'formContainer' ) : ServiceDefinition { $ builder = $ compilerExtension -> getContainerBuilder ( ) ; $ config = $ compilerExtension -> getConfig ( ) ; return $ builder -> addDefin...
Get definition form container .
235,757
public static function getDefinitionEventContainer ( CompilerExtension $ compilerExtension , $ indexConfig = 'events' ) : array { $ builder = $ compilerExtension -> getContainerBuilder ( ) ; $ config = $ compilerExtension -> getConfig ( ) ; $ events = [ ] ; foreach ( $ config [ $ indexConfig ] as $ index => $ event ) {...
Get definition event container .
235,758
public function chainSaving ( array & $ tasks , $ key ) { if ( $ this -> isNew ( ) or $ this -> isChanged ( ) ) { $ tasks [ $ key ] = $ this ; } }
Add a object to the chain task array if it is changed or new Required for ChainSavingInterface
235,759
public function md5 ( ) { if ( isset ( $ this -> filePath ) ) { return md5_file ( $ this -> filePath ) ; } elseif ( $ this -> oid ) { $ query = new Query ( "SELECT common.md5( %oid:oid|cast% );" , array ( 'oid' => $ this -> oid ) ) ; return $ this -> oid -> pg -> query ( $ query ) -> fetch ( Result :: FETCH_SINGLE ) ; ...
Return the MD5 hash of the data
235,760
public function data ( ) { if ( isset ( $ this -> filePath ) ) { return file_get_contents ( $ this -> filePath ) ; } elseif ( $ this -> oid ) { $ pg = $ this -> oid -> pg ; $ pg -> query ( new Query ( 'BEGIN' ) ) ; $ handle = pg_lo_open ( $ pg -> resource -> get ( ) , $ this -> oid -> oid , 'r' ) ; $ result = '' ; whil...
Get the data stored in the large object resource .
235,761
public function export ( $ destination , $ overwriteIfExists = false ) { if ( ! is_string ( $ destination ) ) { throw new \ RuntimeException ( sprintf ( 'Expected $destination to be a string, got type: %s' , gettype ( $ destination ) ) ) ; } if ( file_exists ( $ destination ) and ! $ overwriteIfExists ) { throw new \ R...
Export the data stored in the large object resource to the specified file .
235,762
public function stream ( ) { if ( isset ( $ this -> filePath ) ) { return readfile ( $ this -> filePath ) ; } elseif ( $ this -> oid ) { $ pg = $ this -> oid -> pg ; $ pg -> query ( new Query ( 'BEGIN' ) ) ; $ handle = pg_lo_open ( $ pg -> resource -> get ( ) , $ this -> oid -> oid , 'r' ) ; pg_lo_read_all ( $ handle )...
Output the data stored in the large object resource to stdout .
235,763
public function run ( ) { if ( ! isset ( $ this -> configs [ 'instances' ] ) || ! Any :: isArray ( $ this -> configs [ 'instances' ] ) ) { return null ; } $ time = time ( ) ; $ log = [ ] ; foreach ( $ this -> configs [ 'instances' ] as $ callback => $ delay ) { if ( ( ( int ) $ this -> configs [ 'log' ] [ $ callback ] ...
Run cron task . Attention - this method is too fat to run from any app s
235,764
public function remove ( $ class , $ method ) { $ callback = $ class . '::' . $ method ; if ( isset ( $ this -> configs [ 'instances' ] [ $ callback ] ) ) { unset ( $ this -> configs [ 'instances' ] [ $ callback ] , $ this -> configs [ 'log' ] [ $ callback ] ) ; App :: $ Properties -> writeConfig ( 'Cron' , $ this -> c...
Remove registered cron task from configs
235,765
public function create ( $ classToMock ) { $ mockBuilder = new \ PHPUnit_Framework_MockObject_MockBuilder ( $ this -> testCase , $ classToMock ) ; $ mockBuilder -> disableOriginalConstructor ( ) ; return $ mockBuilder -> getMock ( ) ; }
Creates simple PHPUnit Mock Object with disabled original constructor
235,766
private function _parse_routes ( ) { $ uri = implode ( '/' , $ this -> uri -> segments ( ) ) ; if ( isset ( $ this -> router [ $ uri ] ) ) { return $ this -> _set_request ( explode ( '/' , $ this -> router [ $ uri ] ) ) ; } foreach ( $ this -> router as $ key => $ val ) { $ key = str_replace ( ':any' , '.+' , str_repla...
disini mo ba atur akan apa mo kamana
235,767
private function registerLaravelSeoPackage ( ) { $ this -> registerProvider ( LaravelSeoServiceProvider :: class ) ; $ this -> app -> booting ( function ( ) { Seo :: setConfig ( 'database' , config ( 'arcanesoft.seo.database' ) ) ; Seo :: setConfig ( 'metas' , config ( 'arcanesoft.seo.metas' ) ) ; Seo :: setConfig ( 'r...
Register Laravel Seo package .
235,768
public function verifyWebhookSignature ( ) { $ timestamp = $ this -> request -> input ( 'timestamp' ) ; $ token = $ this -> request -> input ( 'token' ) ; $ signature = $ this -> request -> input ( 'signature' ) ; $ configMailgun = config ( 'services.mailgun' ) ; $ hmac = hash_hmac ( 'sha256' , $ timestamp . $ token , ...
Ensure the authenticity of inbound Mailgun request
235,769
public function isInboundEmailToEmailAddressMapToUser ( ) { $ mappedRoutes = config ( 'lasallecmsmailgun.inbound_map_mailgun_routes_with_user_email_address' ) ; foreach ( $ mappedRoutes as $ route => $ user ) { if ( $ this -> request -> input ( 'recipient' ) == $ route ) { return true ; } } return false ; }
Does the recipient s email address map to an email address in the users database table?
235,770
public function isMappedUserExistInUsersTable ( ) { $ mappedRoutes = config ( 'lasallecmsmailgun.inbound_map_mailgun_routes_with_user_email_address' ) ; foreach ( $ mappedRoutes as $ route => $ user ) { if ( $ this -> request -> input ( 'recipient' ) == $ route ) { $ userEmailAddress = $ user ; } } if ( $ this -> userR...
Does the mapped user actually exist in the users db table?
235,771
private static function staticTranslate ( $ source , $ target , $ string ) { self :: checkStaticInstance ( ) ; try { $ result = self :: $ staticInstance -> setSource ( $ source ) -> setTarget ( $ target ) -> translate ( $ string ) ; } catch ( Exception $ e ) { throw $ e ; } return $ result ; }
Translate text statically .
235,772
public function setLemma ( \ Innova \ LexiconBundle \ Entity \ Lemma $ lemma = null ) { $ this -> lemma = $ lemma ; return $ this ; }
Set lemma .
235,773
public function setNumber ( \ Innova \ LexiconBundle \ Entity \ Number $ number = null ) { $ this -> number = $ number ; return $ this ; }
Set number .
235,774
public function setGender ( \ Innova \ LexiconBundle \ Entity \ Gender $ gender = null ) { $ this -> gender = $ gender ; return $ this ; }
Set gender .
235,775
public function setTense ( \ Innova \ LexiconBundle \ Entity \ Tense $ tense = null ) { $ this -> tense = $ tense ; return $ this ; }
Set tense .
235,776
public function setPerson ( \ Innova \ LexiconBundle \ Entity \ Person $ person = null ) { $ this -> person = $ person ; return $ this ; }
Set person .
235,777
public function setMood ( \ Innova \ LexiconBundle \ Entity \ Mood $ mood = null ) { $ this -> mood = $ mood ; return $ this ; }
Set mood .
235,778
public static function decode ( $ string , $ returnArrays = false ) { $ result = json_decode ( $ string , $ returnArrays ) ; if ( function_exists ( 'json_last_error' ) ) { switch ( json_last_error ( ) ) { case JSON_ERROR_NONE : return $ result ; case JSON_ERROR_DEPTH : throw new JSONException ( 'json_decode - Maximum s...
Performs a JSON decode of the string
235,779
public static function encode ( $ obj , $ pretty = false , $ html = false ) { $ s = json_encode ( $ obj ) ; if ( $ pretty ) { return self :: format ( $ s , $ html ) ; } return $ s ; }
Encodes the object in json
235,780
public static function format ( $ json , $ html = false ) { $ format = str_replace ( [ ' ' , '\/' , ] , [ ' ' , '/' , ] , json_encode ( json_decode ( str_replace ( [ "\n" , ' ' , ', }' , ', ]' , ',}' , ',]' , ] , [ '' , '' , '}' , '}' , '}' , ']' , ] , $ json ) ) , JSON_PRETTY_PRINT ) ) ; if ( $ html ) { return st...
Indents a flat JSON string to make it more human - readable Use php function JSON_PRETTY_PRINT . Require php > = 5 . 4
235,781
public function isRequestedUrlClean ( Request \ Web $ request ) { $ server = $ request -> getServer ( ) ; if ( ! isset ( $ server [ 'REQUEST_URI' ] ) ) { throw new Exception ( 'REQUEST_URI is not set' ) ; } return strpos ( $ server [ 'REQUEST_URI' ] , $ this -> entryPoint ) !== 0 ; }
Check that requested URL is clean
235,782
protected function validateRouteMapping ( Route \ Mapping $ mapping ) { if ( ! class_exists ( $ mapping -> controller ( ) ) ) { throw new Exception ( "Controller '{$mapping->controller()}' not found" ) ; } if ( ! method_exists ( $ mapping -> controller ( ) , $ mapping -> action ( ) ) ) { throw new Exception ( "Action '...
Validate Route Mapping
235,783
public function TimezoneToInterval ( ) { $ timezone = $ this -> Value -> getTimezone ( ) -> getName ( ) ; if ( $ timezone == "Z" || $ timezone == "+00:00" || $ timezone == date_default_timezone_get ( ) ) { return DayTimeDurationValue :: Parse ( "PT0S" ) ; } if ( ! preg_match ( "/(?<sign>[+-])(?<hours>\d{2,2}):(?<minute...
Create a DayTimeDurationValue representation of the timezone offset
235,784
public function actionLogin ( ) { if ( ! \ Yii :: $ app -> user -> isGuest ) { \ Yii :: $ app -> getResponse ( ) -> redirect ( Url :: to ( [ \ Yii :: $ app -> getHomeUrl ( ) ] ) ) ; } $ model = \ Yii :: createObject ( LoginForm :: className ( ) ) ; $ event = $ this -> getFormEvent ( $ model ) ; $ this -> performAjaxVal...
Displays the login page .
235,785
public function actionLogout ( ) { $ event = $ this -> getUserEvent ( \ Yii :: $ app -> user -> identity ) ; $ this -> trigger ( self :: EVENT_BEFORE_LOGOUT , $ event ) ; \ Yii :: $ app -> getUser ( ) -> logout ( ) ; $ this -> trigger ( self :: EVENT_AFTER_LOGOUT , $ event ) ; \ Yii :: $ app -> getResponse ( ) -> redir...
Logs the user out and then redirects to the homepage .
235,786
protected function askToSkip ( ) { $ question = 'This part is optional. Do you like to configure it? [y|N]:' ; $ answer = strtolower ( IO :: in ( $ question ) ) ; switch ( $ answer ) { case 'yes' : case 'y' : case '1' : case 'true' : return false ; case 'no' : case 'n' : case '0' : case 'false' : case '' : return true ...
Ask to skip optional part
235,787
protected function askForString ( $ key , $ required = false , $ default = null , array $ values = [ ] , $ minLength = 0 ) { $ question = sprintf ( 'What is the value for configuration setting "%s"' , $ key ) ; if ( count ( $ values ) > 0 ) { $ question .= sprintf ( ' (%s)' , implode ( ', ' , $ values ) ) ; } $ questio...
Ask user for a value which should be a string
235,788
protected function askForBoolean ( $ key , $ required = false , $ default = null ) { $ question = sprintf ( 'Enable configuration setting "%s"?' , $ key ) ; if ( isset ( $ default ) ) { switch ( $ default ) { case true : $ question .= ' [Y|n]:' ; break ; case false : $ question .= ' [y|N]:' ; break ; } } $ answer = str...
Ask user for a value which should be a boolean
235,789
protected function askForMixed ( $ key , $ required = false , $ default = null , array $ values = [ ] ) { $ question = sprintf ( 'What is the value for configuration setting "%s"' , $ key ) ; $ options = [ ] ; if ( count ( $ values ) > 0 ) { foreach ( $ values as $ value ) { switch ( gettype ( $ value ) ) { case 'boole...
Ask user for a value but the data type doesn t matter
235,790
protected function containsRecursive ( & $ array , & $ value ) { if ( ! is_array ( $ array ) ) { return false ; } foreach ( $ array as $ sub ) { if ( is_string ( $ sub ) && ! strcasecmp ( $ sub , $ value ) ) { return true ; } if ( is_array ( $ sub ) && $ this -> containsRecursive ( $ sub , $ value ) ) { return true ; }...
Checks whether some array contains the given data in a recursive fashion .
235,791
public function registerTriggers ( $ triggers , $ channel ) { if ( ! is_array ( $ triggers ) ) { $ triggers = array ( $ triggers ) ; } $ fmt = $ this -> getFormatter ( false ) ; $ translator = $ fmt -> getTranslator ( ) ; if ( ! is_string ( $ channel ) ) { throw new \ Erebot \ InvalidValueException ( $ fmt -> _ ( 'Inva...
Registers a series of triggers either globally or for a specific channel .
235,792
public function getChanTriggers ( $ channel ) { if ( ! isset ( $ this -> triggers [ $ channel ] ) ) { $ fmt = $ this -> getFormatter ( false ) ; throw new \ Erebot \ NotFoundException ( $ fmt -> _ ( 'No triggers found for channel "<var name="chan"/>"' , array ( 'chan' => $ channel ) ) ) ; } return $ this -> triggers [ ...
Returns a list of all triggers registered for a given channel .
235,793
public function getTriggers ( $ token ) { $ fmt = $ this -> getFormatter ( false ) ; if ( ! is_string ( $ token ) || strpos ( $ token , ' ' ) === false ) { throw new \ Erebot \ InvalidValueException ( $ fmt -> _ ( 'Invalid token' ) ) ; } list ( $ chan , $ pos ) = explode ( ' ' , $ token ) ; if ( ! isset ( $ this -> tri...
Returns a list of all triggers associated with the given key .
235,794
public function my ( ) { $ profile = $ this -> Profiles -> find ( ) -> where ( [ 'Profiles.user_id' => $ this -> Auth -> user ( 'id' ) ] ) -> contain ( 'Users' ) -> first ( ) ; $ this -> set ( 'profile' , $ profile ) ; $ this -> set ( '_serialize' , [ 'profile' ] ) ; }
Shows current user profile
235,795
public function tearDown ( ) { $ seconds = time ( ) - $ this -> start ; switch ( $ seconds ) { case 1 : $ this -> log -> debug ( 'This took 1 second.' ) ; break ; default : $ this -> log -> debug ( 'This took %s seconds.' , $ seconds ) ; break ; } $ prettifyUnit = function ( $ bytes ) { $ unit = [ 'B' , 'KiB' , 'MiB' ,...
Process some routines after executing command
235,796
protected function getQuery ( ) { $ query = '' ; foreach ( $ this -> config [ 'args' ] as $ index => $ arg ) { if ( array_key_exists ( 'command' , $ this -> config ) && $ arg === $ this -> config [ 'command' ] && array_key_exists ( ( $ index + 1 ) , $ this -> config [ 'args' ] ) ) { $ query = $ this -> config [ 'args' ...
Looks for a query from given arguments
235,797
public function getName ( ) { foreach ( $ this -> config [ 'commands' ] as $ command => $ details ) { if ( strpos ( $ details [ 'class' ] , get_class ( $ this ) ) !== false ) { return $ command ; } } return '' ; }
Get command name
235,798
protected function _get ( \ Throwable $ e ) { $ path_to_root = $ _SERVER [ 'DOCUMENT_ROOT' ] ; $ rows = array ( ) ; $ rows [ ] = [ str_replace ( $ path_to_root . '/' , '' , $ e -> getFile ( ) ) , $ e -> getLine ( ) , "throw new " . get_class ( $ e ) , "" ] ; foreach ( $ e -> getTrace ( ) as $ trace ) { $ rows [ ] = [ s...
Get a 2 - dimensions array with exception stack trace
235,799
public function translateByNumber ( int $ number , string $ defaultTranslation , ... $ args ) : string { $ transStr = $ this -> _source -> getTranslation ( $ number , $ defaultTranslation ) ; if ( \ count ( $ args ) < 1 ) { return $ transStr ; } return \ sprintf ( $ transStr , $ args ) ; }
Gets the translation by an numeric identifier .