idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
53,000
public function hmget ( $ key , ... $ dictionary ) { if ( count ( $ dictionary ) == 1 ) { $ dictionary = $ dictionary [ 0 ] ; } return array_values ( $ this -> command ( 'hmget' , [ $ key , $ dictionary ] ) ) ; }
Get the value of the given hash fields .
53,001
public function eval ( $ script , $ numberOfKeys , ... $ arguments ) { return $ this -> client -> eval ( $ script , $ arguments , $ numberOfKeys ) ; }
Evaluate a script and retunr its result .
53,002
public function read ( $ entityName ) { return new ReadQuery ( $ this -> connection , $ this -> models -> get ( $ entityName ) , $ this -> factory , $ this -> accessor , $ this -> dispatcher ) ; }
Sets read operation
53,003
public function readOne ( $ entityName ) { return new ReadOneQuery ( $ this -> connection , $ this -> models -> get ( $ entityName ) , $ this -> factory , $ this -> accessor , $ this -> dispatcher ) ; }
Sets read one operation
53,004
public function write ( $ instance , $ entity = null ) { list ( $ instance , $ entity ) = $ this -> reassignEntity ( $ instance , $ entity ) ; return new WriteQuery ( $ this -> connection , $ instance , $ this -> models -> get ( $ entity ) , $ this -> factory , $ this -> accessor , $ this -> dispatcher ) ; }
Sets write operation
53,005
public function update ( $ instance , $ entity = null ) { list ( $ instance , $ entity ) = $ this -> reassignEntity ( $ instance , $ entity ) ; return new UpdateQuery ( $ this -> connection , $ instance , $ this -> models -> get ( $ entity ) , $ this -> factory , $ this -> accessor , $ this -> dispatcher ) ; }
Sets update operation
53,006
public function insert ( $ instance , $ entity = null ) { list ( $ instance , $ entity ) = $ this -> reassignEntity ( $ instance , $ entity ) ; return new InsertQuery ( $ this -> connection , $ instance , $ this -> models -> get ( $ entity ) , $ this -> factory , $ this -> accessor , $ this -> dispatcher ) ; }
Sets insert operation
53,007
public function delete ( $ instance , $ entity = null ) { list ( $ instance , $ entity ) = $ this -> reassignEntity ( $ instance , $ entity ) ; return new DeleteQuery ( $ this -> connection , $ instance , $ this -> models -> get ( $ entity ) , $ this -> factory , $ this -> accessor , $ this -> dispatcher ) ; }
Sets delete operation
53,008
public function _initBaseException ( $ message = null , $ code = null , RootException $ previous = null ) { $ message = is_null ( $ message ) ? '' : $ this -> _normalizeString ( $ message ) ; $ code = is_null ( $ code ) ? 0 : $ this -> _normalizeInt ( $ code ) ; $ this -> _initParent ( $ message , $ code , $ previous )...
Initializes the base exception .
53,009
public function dateTransform ( $ date_value , $ format_origin = 'd/m/Y H:i:s' , $ format_destiny = 'Y-m-d H:i:s' ) { $ date = \ DateTime :: createFromFormat ( $ format_origin , $ date_value ) ; return $ date !== false ? $ date -> format ( $ format_destiny ) : '' ; }
Transforma uma data de um formato para outro
53,010
public static function validate_distance ( $ distance ) { $ valid = filter_var ( $ distance , FILTER_VALIDATE_INT , array ( 'options' => array ( 'min_range' => 1 , 'max_range' => PHP_INT_MAX ) ) ) ; return false !== $ valid ? true : false ; }
Validate distance .
53,011
public function diff ( DateTimeBase $ other , bool $ absolute = false ) { return $ this -> dateTime -> diff ( $ other -> dateTime , $ absolute ) ; }
Returns a diff of the supplied date time .
53,012
public function equals ( DateTimeBase $ other ) : bool { $ dateTime = $ this -> dateTime ; $ otherDateTime = $ other -> dateTime ; return $ dateTime == $ otherDateTime && $ dateTime -> getTimezone ( ) -> getName ( ) === $ otherDateTime -> getTimezone ( ) -> getName ( ) ; }
Returns whether the DateTimeBase is equal to the supplied date .
53,013
protected function buildTasks ( array $ configuration ) { $ this -> io -> text ( '- Building tasks...' ) ; $ builder = new TaskBuilder ( $ this -> debug ) ; $ tasks = $ builder -> build ( $ configuration ) ; $ this -> io -> text ( '- Tasks build !' ) ; $ this -> io -> newLine ( ) ; return $ tasks ; }
Build tasks from the configuration array .
53,014
protected function buildFilters ( array $ configuration ) { $ this -> io -> text ( '- Building filters...' ) ; $ builder = new FilterBuilder ( $ this -> eventDispatcher ) ; $ filters = $ builder -> build ( $ configuration ) ; $ this -> io -> text ( '- Filters build !' ) ; $ this -> io -> newLine ( ) ; return $ filters ...
Build the filter according to the configuration array .
53,015
protected function loadConfigurationFile ( $ configurationFile ) { if ( ! file_exists ( $ configurationFile ) ) { throw new Exception ( 'The configuration yml file ' . $ configurationFile . ' was not found' ) ; } $ configuration = Yaml :: parse ( file_get_contents ( $ configurationFile ) ) ; if ( empty ( $ configuratio...
Load the configuration from a yml file .
53,016
protected function loadConfiguration ( InputInterface $ input ) { $ loader = new ConfigurationLoader ( ) ; if ( $ input -> hasOption ( 'config' ) && $ file = $ input -> getOption ( 'config' ) ) { $ configuration = $ loader -> loadFromFile ( $ file ) ; } else { if ( null === $ this -> container ) { throw new Exception (...
Load the configuration from a yml file or the container according to the given option .
53,017
public function setContainer ( ContainerInterface $ container = null ) { $ this -> container = $ container ; $ this -> eventDispatcher = $ this -> container -> get ( 'event_dispatcher' ) ; }
Sets the container .
53,018
protected function sort ( ) { if ( ! empty ( $ this -> _callback_list ) ) { $ priority_list = $ this -> _priority_list ; asort ( $ priority_list ) ; $ tmp = $ this -> _callback_list ; $ this -> _callback_list = [ ] ; foreach ( $ priority_list as $ index => $ _ ) { $ this -> _callback_list [ ] = $ tmp [ $ index ] ; } $ ...
Sort callbacks based on their priority
53,019
public function createLoginToken ( $ userID ) { $ user = $ this -> getFind ( $ userID ) ; $ user -> login_token = hash_hmac ( 'sha256' , Str :: random ( 40 ) , 'secret' ) ; $ user -> login_token_created_at = Carbon :: now ( ) ; return $ user -> save ( ) ; }
UPDATE the users table with a login token
53,020
public function isLoginTokenExpired ( $ user ) { $ startTime = strtotime ( $ user -> login_token_created_at ) ; $ now = strtotime ( Carbon :: now ( ) ) ; $ timeDiff = ( $ now - $ startTime ) / 60 ; $ minutes2faFormIsLive = config ( 'lasallecmstokenbasedlogin.token_login_minutes_token_is_live' ) ; if ( $ timeDiff > $ mi...
Has a login token expired?
53,021
public function deleteUserLoginTokenFields ( $ userID ) { $ user = $ this -> getFind ( $ userID ) ; $ user -> login_token = '' ; $ user -> login_token_created_at = '' ; return $ user -> save ( ) ; }
Remove the login_token and login_token_created_at fields .
53,022
public function index ( ) { $ this -> data [ 'page' ] -> title = APP_NAME . ' Blog' ; $ this -> data [ 'page' ] -> seo -> description = '' ; $ this -> data [ 'page' ] -> seo -> keywords = '' ; $ page = $ this -> uri -> rsegment ( 3 ) ; $ perPage = appSetting ( 'home_per_page' , 'blog-' . $ this -> oBlog -> id ) ; $ per...
Browse all posts
53,023
public function rss ( ) { if ( ! appSetting ( 'rss_enabled' , 'blog-' . $ this -> oBlog -> id ) ) { show404 ( ) ; } $ data = array ( ) ; $ data [ 'include_body' ] = true ; $ data [ 'include_gallery' ] = appSetting ( 'home_show_gallery' , 'blog-' . $ this -> oBlog -> id ) ; $ data [ 'sort' ] = array ( 'bp.published' , '...
RSS Feed for the blog
53,024
protected function fetchSidebarWidgets ( ) { $ this -> data [ 'widget' ] = new stdClass ( ) ; if ( appSetting ( 'sidebar_latest_posts' , 'blog-' . $ this -> oBlog -> id ) ) { $ this -> data [ 'widget' ] -> latest_posts = $ this -> blog_widget_model -> latestPosts ( $ this -> oBlog -> id ) ; } if ( appSetting ( 'sidebar...
Loads all the enabled sidebar widgets
53,025
private function loadView ( $ sView , $ aData = array ( ) ) { $ oView = Factory :: service ( 'View' ) ; $ sFile = $ this -> oSkin -> path . 'views/' . $ sView ; if ( is_file ( $ sFile . '.php' ) ) { $ oView -> load ( $ sFile , $ aData ) ; } elseif ( ! empty ( $ this -> oSkinParent ) ) { $ sFile = $ this -> oSkinParent ...
Loads a view from the skin falls back tot he parent view if there is one .
53,026
public function _remap ( ) { $ method = $ this -> uri -> rsegment ( 3 ) ? $ this -> uri -> rsegment ( 3 ) : 'index' ; if ( method_exists ( $ this , $ method ) && substr ( $ method , 0 , 1 ) != '_' && $ this -> input -> get ( 'id' ) ) { $ this -> single ( $ this -> input -> get ( 'id' ) ) ; } elseif ( method_exists ( $ ...
Routes the URL
53,027
public function cmdGetReview ( ) { $ result = $ this -> getListReview ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableReview ( $ result ) ; $ this -> output ( ) ; }
Callback for review - get command
53,028
protected function setStatusReview ( $ status ) { $ id = $ this -> getParam ( 0 ) ; $ all = $ this -> getParam ( 'all' ) ; if ( ! isset ( $ id ) && empty ( $ all ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( isset ( $ id ) && ( empty ( $ id ) || ! is_numeric ( $ id ) ) ) { $ this -> err...
Sets status for one or several reviews
53,029
public function cmdUpdateReview ( ) { $ params = $ this -> getParam ( ) ; if ( empty ( $ params [ 0 ] ) || count ( $ params ) < 2 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( ! is_numeric ( $ params [ 0 ] ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ this -...
Callback for review - update command
53,030
protected function addReview ( ) { if ( ! $ this -> isError ( ) ) { $ id = $ this -> review -> add ( $ this -> getSubmitted ( ) ) ; if ( empty ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> line ( $ id ) ; } }
Add a new review
53,031
protected function submitAddReview ( ) { $ this -> setSubmitted ( null , $ this -> getParam ( ) ) ; $ this -> validateComponent ( 'review' ) ; $ this -> addReview ( ) ; }
Add a new review at once
53,032
protected function wizardAddReview ( ) { $ this -> validatePrompt ( 'user_id' , $ this -> text ( 'User' ) , 'review' ) ; $ this -> validatePrompt ( 'product_id' , $ this -> text ( 'Product' ) , 'review' ) ; $ this -> validatePrompt ( 'text' , $ this -> text ( 'Text' ) , 'review' ) ; $ this -> validatePrompt ( 'status' ...
Add a new review step by step
53,033
protected static function getTypeFinfoExt ( $ file ) { $ type = ( new \ finfo ( FILEINFO_MIME_TYPE ) ) -> file ( $ file ) ; if ( $ type ) { return $ type ; } else { return self :: getTypeFileExtList ( $ file ) ; } }
Gets the Mime Type using the Fileinfo Extension . If the Extension returns nothing the extension list is used .
53,034
protected static function getTypeFileExtList ( $ file ) { $ info = pathinfo ( strtolower ( $ file ) ) ; if ( isset ( self :: $ extensionToMime [ $ info [ 'extension' ] ] ) ) { return self :: $ extensionToMime [ $ info [ 'extension' ] ] ; } else { return self :: DEFAULT_MIME_TYPE ; } }
extracts the file extension and checks the extension array for the extension . If it is found it returns the MIME type . If not it returns the the default MIME type .
53,035
public static function getDefaultFileExtension ( $ mime ) { if ( empty ( self :: $ mimeToExtension ) ) { self :: $ mimeToExtension = array_flip ( self :: $ extensionToMime ) ; } return isset ( self :: $ mimeToExtension [ $ mime ] ) ? self :: $ mimeToExtension [ $ mime ] : '' ; }
returns a default extension by a given MIME type
53,036
protected function configure ( IConfig $ config ) { $ configuration = $ config -> get ( 'container' ) ; foreach ( $ configuration as $ name => $ group ) { switch ( $ name ) { case 'parameters' : $ this -> configureParameters ( $ group ) ; break ; case 'shared' : $ this -> configureShared ( $ group ) ; break ; case 'def...
Configure container .
53,037
public function cmdLineAuth ( ) { $ authUrl = $ this -> client -> createAuthUrl ( ) ; print "Please visit:\n$authUrl\n\n" ; print "Please enter the auth code:\n" ; $ authCode = trim ( fgets ( STDIN ) ) ; $ accessToken = $ this -> client -> authenticate ( $ authCode ) ; $ this -> client -> setAccessToken ( $ accessToken...
Auth over command line
53,038
public function make ( string $ title = null , string $ text = null ) : Notification { if ( self :: $ newNotificationCache === null ) { self :: $ newNotificationCache = new Notification ( ) ; } $ notification = clone ( self :: $ newNotificationCache ) ; if ( $ title !== null ) { $ notification -> title = $ title ; } if...
Constructs a new notification and returns it .
53,039
public function send ( string $ recipientID , Notification $ notification ) : void { $ app = App :: get ( ) ; if ( $ notification -> id === null ) { $ notification -> id = 'n' . uniqid ( ) . 'x' . base_convert ( rand ( 0 , 999999999 ) , 10 , 16 ) ; } if ( $ notification -> dateCreated === null ) { $ notification -> dat...
Sends a notification .
53,040
public function setOptsByArray ( $ options ) { foreach ( self :: $ _setableOptions as $ optionKey ) { if ( isset ( $ options [ $ optionKey ] ) ) { $ this -> $ optionKey = $ options [ $ optionKey ] ; } } return $ this ; }
Retrieve an option array and set valid keys as instance variables .
53,041
public function getScope ( ) { $ calledHere = $ this -> backTrace [ $ this -> backTraceOffset + 1 ] ; if ( isset ( $ calledHere [ 'class' ] ) ) { return ( object ) array ( 'type' => 'Method' , 'name' => $ calledHere [ 'class' ] . $ calledHere [ 'type' ] . $ calledHere [ 'function' ] ) ; } elseif ( isset ( $ calledHere ...
Get the current function or method scope according to the backtraceOffset
53,042
public function getID ( ) { if ( ! isset ( $ this -> ID ) ) { $ this -> ID = md5 ( $ this -> file . $ this -> line ) ; } return $ this -> ID ; }
Generate a hash from the file and line
53,043
public function setLineAndFile ( ) { if ( isset ( $ this -> backTrace [ $ this -> backTraceOffset ] ) ) { $ this -> ID = null ; $ calledHere = $ this -> backTrace [ $ this -> backTraceOffset ] ; if ( isset ( $ calledHere [ 'line' ] ) ) { $ this -> line = $ calledHere [ 'line' ] ; } if ( isset ( $ calledHere [ 'file' ] ...
Use the backTraceOffset and find the file and line in which the debug was called
53,044
public function put ( ) { X \ THEDEBUG :: i ( ) -> doCallback ( 'beforePut' , array ( & $ this ) ) ; $ this -> doCallback ( 'beforePut' , array ( & $ this ) ) ; switch ( strtolower ( $ this -> modus ) ) { case 'firephp' : $ this -> putFirePHP ( ) ; break ; case 'chromephp' : $ this -> putChromePHP ( ) ; break ; default...
fire the appropriate output method for the current modus
53,045
public function putChromePHP ( ) { $ ChromePHP = X \ THEDEBUG :: getChromePHP ( ) ; $ ChromePHP -> backtrace = $ this -> file . ': ' . $ this -> line ; $ this -> _improveVar ( ) ; $ args = array ( ) ; if ( ! empty ( $ this -> name ) ) { $ args [ ] = $ this -> name . ':' ; } $ args [ ] = $ this -> variable ; call_user_f...
Pass the debug to ChromePHP
53,046
public function putFirePHP ( ) { $ FirePHP = X \ THEDEBUG :: getFirePHP ( ) ; $ this -> _improveVar ( ) ; call_user_func_array ( array ( $ FirePHP , $ this -> _getMethod ( ) ) , array ( $ this -> variable , $ this -> name , array ( 'File' => $ this -> file , 'Line' => $ this -> line ) ) ) ; }
Pass the debug to firePHP
53,047
private function _improveVar ( ) { switch ( $ this -> variableType ) { case 'boolean' : $ this -> variable = '(boolean) ' . ( $ this -> variable ? 'true' : 'false' ) ; break ; case 'NULL' : $ this -> variable = '(null) NULL' ; break ; case 'string' : $ this -> variable = '"' . $ this -> variable . '"' ; default : break...
Make our variable more understandable .
53,048
private function _allocateArgs ( $ arguments ) { if ( empty ( $ arguments ) ) { return ; } $ this -> variable = $ arguments [ 0 ] ; $ this -> variableType = gettype ( $ this -> variable ) ; for ( $ i = 1 ; $ i < 3 ; $ i ++ ) { if ( ! isset ( $ arguments [ $ i ] ) ) { return ; } if ( is_string ( $ arguments [ $ i ] ) ) ...
Check which arguments were passed and name them .
53,049
protected function _dereferenceTokens ( $ value ) { if ( is_scalar ( $ value ) && ! is_string ( $ value ) ) { return $ value ; } try { $ value = $ this -> _normalizeString ( $ value ) ; } catch ( InvalidArgumentException $ e ) { return $ value ; } $ container = $ this -> _getContainer ( ) ; $ tokenStart = $ this -> _ge...
Replaces tokens with their values .
53,050
public static function translate ( \ Exception $ e ) : \ Exception { if ( $ e instanceof \ Doctrine \ DBAL \ Exception \ ConnectionException ) { return new \ Caridea \ Dao \ Exception \ Unreachable ( "System unreachable or connection timed out" , $ e -> getCode ( ) , $ e ) ; } elseif ( $ e instanceof \ Doctrine \ ORM \...
Translates a Doctrine exception .
53,051
public function toSQL ( Parameters $ params , bool $ inner_clause ) { $ drv = $ params -> getDriver ( ) ; $ clauses = $ this -> getClauses ( ) ; $ strs = array ( ) ; foreach ( $ clauses as $ clause ) $ strs [ ] = $ drv -> toSQL ( $ params , $ clause ) ; if ( count ( $ strs ) === 0 ) return ; return "ORDER BY " . implod...
Write a order clause as SQL query syntax
53,052
protected function retrieveBundleInfoFromGeneratedFile ( SplFileInfo $ generatedFile , Inflector $ inflector ) { if ( $ generatedFile -> getExtension ( ) !== 'php' ) { throw new UnsupportedFileForContentModifierException ( sprintf ( 'This content modifier requires to be used on a PHP file, "%s" is not a PHP file.' , $ ...
Retrieve information of the Bundle which contains the given file .
53,053
public function createInvitationTimelineEntries ( EntityPublishedEvent $ published_event ) : void { $ event = $ published_event -> getObject ( ) ; if ( ! $ event instanceof Event ) { return ; } $ author = $ this -> user_provider -> loadUserByUsername ( $ event -> getAuthor ( ) ) ; $ event_component = $ this -> action_m...
Create invited timeline events .
53,054
public function createScheduleTimelineEntry ( EntityPublishedEvent $ event ) : void { $ schedule = $ event -> getObject ( ) ; if ( ! $ schedule instanceof Schedule ) { return ; } $ author = $ this -> user_provider -> loadUserByUsername ( $ schedule -> getAuthor ( ) ) ; $ schedule_component = $ this -> action_manager ->...
Create the schedule timeline entry .
53,055
public function normalisePropertyName ( $ propertyName ) { if ( ( strlen ( $ propertyName ) > 1 ) && ( ( ord ( $ propertyName [ 1 ] ) >= ord ( "a" ) ) || is_numeric ( $ propertyName [ 1 ] ) ) ) { $ propertyName = strtolower ( $ propertyName [ 0 ] ) . substr ( $ propertyName , 1 ) ; } return $ propertyName ; }
Normalise the property name using the standard rules we might expect .
53,056
public function select ( $ columns = "*" ) : QueryBuilder { $ this -> _query [ ] = "SELECT" ; if ( is_array ( $ columns ) ) { $ select_columns = "" ; $ size = sizeof ( $ columns ) ; for ( $ i = 0 ; $ i < $ size ; $ i ++ ) { if ( $ i > 0 ) { $ select_columns .= ', ' ; } $ select_columns .= '`' . $ this -> sanitize ( ( s...
Begins the select query .
53,057
public function insert ( string $ table ) : QueryBuilder { $ this -> _query [ ] = "INSERT INTO" ; $ this -> _query [ ] = "`" . $ this -> sanitize ( $ table ) . "`" ; return $ this ; }
Begins the insert query
53,058
public function update ( string $ table ) : QueryBuilder { $ this -> _query [ ] = "UPDATE" ; $ this -> _query [ ] = "`" . $ this -> sanitize ( $ table ) . "`" ; return $ this ; }
Begins the update query
53,059
public function delete ( string $ table ) : QueryBuilder { $ this -> _query [ ] = "DELETE FROM" ; $ this -> _query [ ] = "`" . $ this -> sanitize ( $ table ) . "`" ; return $ this ; }
Begins the delete query
53,060
public function from ( string $ tables ) : QueryBuilder { $ this -> _query [ ] = "FROM" ; $ this -> _query [ ] = '`' . $ this -> sanitize ( $ tables ) . '`' ; return $ this ; }
Begins the FORM part of the query
53,061
public function where ( array $ condition ) : QueryBuilder { $ this -> _query [ ] = "WHERE" ; foreach ( $ condition as $ key => $ value ) { $ this -> _query [ ] = $ this -> parseTags ( [ $ key , $ value ] ) ; } return $ this ; }
Begins the WHERE statement of the query
53,062
public function order ( string $ column , string $ method = "DESC" ) : QueryBuilder { $ this -> _query [ ] = "ORDER BY" ; $ this -> _query [ ] = "`" . $ this -> sanitize ( $ column ) . "`" ; $ this -> _query [ ] = ( strtoupper ( $ method ) === "DESC" ) ? "DESC" : "ASC" ; return $ this ; }
Begins the ORDER BY part of the query
53,063
public function limit ( $ limit ) : QueryBuilder { $ this -> _query [ ] = "LIMIT" ; if ( is_array ( $ limit ) ) { $ this -> _query [ ] = $ this -> getQuoted ( $ limit [ 0 ] ) . "," ; $ this -> _query [ ] = $ this -> getQuoted ( $ limit [ 1 ] ) ; return $ this ; } $ this -> _query [ ] = $ this -> getQuoted ( $ limit ) ;...
Begins the LIMIT part of the query
53,064
public function offset ( int $ offset ) : QueryBuilder { $ this -> _query [ ] = "OFFSET" ; $ this -> _query [ ] = $ offset ; return $ this ; }
Begins the OFFSET part of the query
53,065
public function set ( array $ values ) : QueryBuilder { $ this -> _query [ ] = "SET" ; $ set = [ ] ; foreach ( $ values as $ key => $ val ) { $ set [ ] = $ this -> parseTags ( [ $ key , $ val ] ) ; } $ this -> _query [ ] = implode ( ", " , $ set ) ; return $ this ; }
Begins the SET part of the query
53,066
public function values ( array $ values ) : QueryBuilder { $ args = func_get_args ( ) ; $ columns = [ ] ; $ _values = [ ] ; foreach ( $ values as $ key => $ value ) { preg_match ( "/\(JSON\)\s*([\w]+)/i" , $ key , $ jsonTag ) ; if ( is_array ( $ value ) || is_object ( $ value ) ) { if ( isset ( $ jsonTag [ 0 ] ) ) { $ ...
Begins the VALUES part of the query
53,067
public function sanitize ( string $ input ) : string { $ input = $ this -> _connection -> getConnection ( ) -> quote ( $ input ) ; return substr ( $ input , 1 , - 1 ) ; }
Sanitizes the input .
53,068
public function write ( Command $ command , Option $ option = NULL ) { $ output = PHP_EOL ; $ output .= '-----------------------------------------------------' . PHP_EOL ; $ output .= $ command -> name . ' ' . $ command -> version . PHP_EOL ; $ output .= '-----------------------------------------------------' . PHP_EOL...
This method writes the help to the console .
53,069
private function _getUsageExample ( Command $ command ) { $ name = strtolower ( str_replace ( 'Command' , '' , get_class ( $ command ) ) ) ; if ( FALSE !== strstr ( $ name , "\\" ) ) { $ pts = explode ( "\\" , $ name ) ; $ name = $ pts [ count ( $ pts ) - 1 ] ; } $ usage = './' . $ name . ' --' . $ command -> options [...
Prepares the command usage example .
53,070
public function registerDoctrineLazyLoader ( $ entityClass , LazyLoaderInterface $ loader ) { if ( ! is_a ( $ entityClass , LazyPropertiesInterface :: class , true ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Class %s has to implement %s to be able to lazy load her properties.' , $ entityClass , LazyProperti...
Register a loader for given entity class .
53,071
public function postLoad ( LifecycleEventArgs $ event ) { if ( ! $ loader = $ this -> getLoader ( $ entity = $ event -> getEntity ( ) ) ) { return ; } if ( isset ( $ proxies [ $ loaderClass = static :: class ] ) ) { @ trigger_error ( sprintf ( 'Global loader delegate is deprecated and will be removed in 2.0. Make "%s" ...
postLoad Doctrine event handler notify loaders if define for given event related entity .
53,072
private function createConnection ( array $ persisterConfig , $ configName ) { $ options = isset ( $ persisterConfig [ 'parameters' ] [ 'options' ] ) && is_array ( $ persisterConfig [ 'parameters' ] [ 'options' ] ) ? $ persisterConfig [ 'parameters' ] [ 'options' ] : [ ] ; $ definition = new Definition ( 'Doctrine\Mong...
Creates the connection service definition .
53,073
private function createDataCollector ( ) { $ definition = new Definition ( Utility :: getBundleClass ( 'DataCollector\MongoDb\PrettyDataCollector' ) ) ; $ definition -> addTag ( 'data_collector' , [ 'id' => 'as3persistermongodb' , 'template' => 'As3ModlrBundle:Collector:mongodb' ] ) ; $ definition -> setPublic ( false ...
Creates the persistence data collector service definition .
53,074
private function createMongoDbPersister ( $ persisterName , array $ persisterConfig , ContainerBuilder $ container ) { $ smfName = sprintf ( '%s.metadata' , $ persisterName ) ; $ definition = $ this -> createSmf ( ) ; $ container -> setDefinition ( $ smfName , $ definition ) ; $ configName = sprintf ( '%s.configuration...
Creates the MongoDB persister service definition . Will also load support services .
53,075
private function createSmf ( ) { $ definition = new Definition ( Utility :: getLibraryClass ( 'Persister\MongoDb\StorageMetadataFactory' ) , [ new Reference ( Utility :: getAliasedName ( 'util.entity' ) ) ] ) ; $ definition -> setPublic ( false ) ; return $ definition ; }
Creates the storage metadata factory service definition .
53,076
public function indexAction ( ) { $ em = $ this -> getDoctrineManager ( ) ; $ sakonninTemplates = $ em -> getRepository ( 'BisonLabSakonninBundle:SakonninTemplate' ) -> findAll ( ) ; return $ this -> render ( 'BisonLabSakonninBundle:SakonninTemplate:index.html.twig' , array ( 'sakonninTemplates' => $ sakonninTemplates ...
Lists all sakonninTemplate entities .
53,077
public function newAction ( Request $ request ) { $ sakonninTemplate = new Sakonnintemplate ( ) ; $ default_lang_code = $ this -> container -> get ( 'translator' ) -> getLocale ( ) ; $ sakonninTemplate -> setLangCode ( $ default_lang_code ) ; $ form = $ this -> createForm ( 'BisonLab\SakonninBundle\Form\SakonninTemplat...
Creates a new sakonninTemplate entity .
53,078
public function showAction ( SakonninTemplate $ sakonninTemplate ) { $ deleteForm = $ this -> createDeleteForm ( $ sakonninTemplate ) ; return $ this -> render ( 'BisonLabSakonninBundle:SakonninTemplate:show.html.twig' , array ( 'sakonninTemplate' => $ sakonninTemplate , 'delete_form' => $ deleteForm -> createView ( ) ...
Finds and displays a sakonninTemplate entity .
53,079
public function editAction ( Request $ request , SakonninTemplate $ sakonninTemplate ) { $ deleteForm = $ this -> createDeleteForm ( $ sakonninTemplate ) ; $ editForm = $ this -> createForm ( 'BisonLab\SakonninBundle\Form\SakonninTemplateType' , $ sakonninTemplate ) ; $ editForm -> handleRequest ( $ request ) ; if ( $ ...
Displays a form to edit an existing sakonninTemplate entity .
53,080
public function deleteAction ( Request $ request , SakonninTemplate $ sakonninTemplate ) { $ form = $ this -> createDeleteForm ( $ sakonninTemplate ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ em = $ this -> getDoctrineManager ( ) ; $ em -> remove ( $ sakonni...
Deletes a sakonninTemplate entity .
53,081
private function createDeleteForm ( SakonninTemplate $ sakonninTemplate ) { return $ this -> createFormBuilder ( ) -> setAction ( $ this -> generateUrl ( 'sakonnintemplate_delete' , array ( 'id' => $ sakonninTemplate -> getId ( ) ) ) ) -> setMethod ( 'DELETE' ) -> getForm ( ) ; }
Creates a form to delete a sakonninTemplate entity .
53,082
public function toSQL ( Parameters $ params , bool $ inner_clause ) { $ drv = $ params -> getDriver ( ) ; $ table = $ drv -> toSQL ( $ params , $ this -> getTable ( ) ) ; $ condition = $ drv -> toSQL ( $ params , $ this -> getCondition ( ) ) ; return $ this -> getType ( ) . " JOIN " . $ table . " ON " . $ condition ; }
Write a JOIN clause to SQL query syntax
53,083
public function download ( $ ftkey , $ size , $ passthru = false ) { $ this -> init ( $ ftkey ) ; if ( $ passthru ) { return $ this -> passthru ( $ size ) ; } $ buff = new String ( "" ) ; $ size = intval ( $ size ) ; $ pack = 4096 ; Signal :: getInstance ( ) -> emit ( "filetransferDownloadStarted" , $ ftkey , count ( $...
Returns the content of a downloaded file as a String object .
53,084
static public function isValid ( $ direction , $ throw = false ) { $ valid = in_array ( $ direction , [ static :: NONE , static :: ASC , static :: DESC , ] , true ) ; if ( ! $ valid && $ throw ) { throw new InvalidArgumentException ( sprintf ( "The direction '%s' is not valid." , $ direction ) ) ; } return $ valid ; }
Returns whether the given direction is valid .
53,085
public static function configure ( $ object , $ properties ) { foreach ( $ properties as $ name => $ value ) { if ( ! property_exists ( $ object , $ name ) ) { throw new InvalidConfigException ( sprintf ( 'Property %s in class %s not found.' , $ name , \ get_class ( $ object ) ) ) ; } $ object -> $ name = $ value ; } r...
Configures an object with the initial property values . Inspired by Yii2 .
53,086
public static function createObject ( $ type ) { if ( \ is_string ( $ type ) ) { return static :: get ( $ type ) ; } elseif ( \ is_array ( $ type ) ) { if ( ! isset ( $ type [ 'class' ] ) ) { throw new InvalidConfigException ( 'Object configuration must be an array containing a "class" element.' ) ; } $ class = $ type ...
Creates a new object using the given configuration . Inspired by Yii2 .
53,087
public static function get ( string $ class , array $ config = [ ] ) { $ reflection = new \ ReflectionClass ( $ class ) ; if ( ! $ reflection -> isInstantiable ( ) ) { throw new \ ReflectionException ( sprintf ( '`%s` is not instantiable.' , $ reflection -> name ) ) ; } if ( $ reflection -> implementsInterface ( IConfi...
Creates an instance of the specified class . Inspired by Yii2 di .
53,088
public function generate ( $ length = 16 , $ alpha = 0.6 , $ numeric = 0.2 , $ other = 0.2 ) { $ chars = array ( ) ; for ( $ index = 0 , $ max = ceil ( $ alpha * $ length ) ; $ index < $ max ; $ index ++ ) { if ( ( bool ) rand ( 0 , 1 ) ) { $ char = rand ( 65 , 90 ) ; } else { $ char = rand ( 97 , 122 ) ; } $ chars [ ]...
Generate password of given length .
53,089
protected function configureOptions ( InputInterface $ input ) { if ( $ input -> getOption ( 'path' ) ) { $ this -> finder -> setPath ( $ input -> getOption ( 'path' ) ) ; $ this -> locator -> setParams ( array ( 'path' => $ input -> getOption ( 'path' ) ) ) ; } }
Configure input options
53,090
protected function display ( OutputInterface $ output , array $ rows = array ( ) , array $ failed = array ( ) ) { $ this -> getApplication ( ) -> getHelperSet ( ) -> get ( 'table' ) -> setHeaders ( array ( 'Name' , 'Scripts' , 'Rollbacks' , 'Status' ) ) -> setRows ( $ rows ) -> render ( $ output ) ; if ( ! empty ( $ fa...
Display result as a table
53,091
public static function toRoute ( $ route , $ scheme = false ) { $ route = ( array ) $ route ; $ route [ 0 ] = static :: normalizeRoute ( $ route [ 0 ] ) ; if ( $ scheme ) { return Yii :: $ app -> getUrlManager ( ) -> createAbsoluteUrl ( $ route , is_string ( $ scheme ) ? $ scheme : null ) ; } else { return Yii :: $ app...
Creates a URL for the given route .
53,092
public static function to ( $ url = '' , $ scheme = false ) { if ( is_array ( $ url ) ) { return static :: toRoute ( $ url , $ scheme ) ; } $ url = Yii :: getAlias ( $ url ) ; if ( $ url === '' ) { $ url = Yii :: $ app -> getRequest ( ) -> getUrl ( ) ; } if ( ! $ scheme ) { return $ url ; } if ( strncmp ( $ url , '//' ...
Creates a URL based on the given parameters .
53,093
public function buildRepository ( string $ key ) { $ repositoryInfo = $ this -> get ( $ key ) ; if ( is_null ( $ repositoryInfo ) ) { throw new \ Nuki \ Exceptions \ Base ( vsprintf ( '%1$s is not a registered repository' , [ $ key ] ) ) ; } $ this -> validate ( $ repositoryInfo , $ key ) ; $ repository = new $ reposit...
Build a repository by its key and additional options
53,094
private function validate ( array $ repository = [ ] , $ key ) { if ( ! isset ( $ repository [ 'Providers' ] ) || empty ( $ repository [ 'Providers' ] ) ) { throw new \ Nuki \ Exceptions \ Base ( vsprintf ( '%1$s does not have any providers' , [ $ key ] ) ) ; } if ( ! class_exists ( $ repository [ 'Location' ] ) ) { th...
Validate repository info
53,095
public function getConnection ( $ name = null ) { if ( $ name === null ) { reset ( $ this -> config ) ; $ name = key ( $ this -> config ) ; } if ( ! isset ( $ this -> config [ $ name ] ) ) { throw new \ Exception ( 'Configuration name does not exists !' ) ; } if ( ! isset ( $ this -> config [ $ name ] [ 'engine' ] ) ) ...
Create or get existing connection .
53,096
protected function getPDO ( $ name ) { if ( ! isset ( $ this -> config [ $ name ] ) || ! is_array ( $ this -> config [ $ name ] ) ) { throw new \ Exception ( 'Config not found ! (config: ' . $ name . ')' ) ; } $ config = $ this -> config [ $ name ] ; if ( ! isset ( $ config [ 'dsn' ] ) ) { throw new \ Exception ( '"dsn...
Create new PDO connection
53,097
private function registerDefaultServices ( $ userSettings ) { $ defaultSettings = $ this -> defaultSettings ; $ this [ 'settings' ] = function ( ) use ( $ userSettings , $ defaultSettings ) { return new Collection ( array_merge ( $ defaultSettings , $ userSettings ) ) ; } ; $ defaultProvider = new DefaultServicesProvid...
This function registers the default services that Mbh needs to work .
53,098
public function splitInner ( array $ arguments = array ( ) ) { if ( is_null ( $ this -> _InnerSplitter ) ) { return new ArrayIterator ( array ( $ arguments ) ) ; } return $ this -> _InnerSplitter -> split ( $ arguments ) ; }
Returns iterator over arguments splitted by inner splitter
53,099
public function connect ( ) { $ this -> link = mysql_connect ( $ this -> addr , $ this -> user , $ this -> passwd ) ; if ( $ this -> link === false ) { throw new Klarna_DatabaseException ( 'Failed to connect to database! (' . mysql_error ( ) . ')' ) ; } }
Establish a connection to the DB