idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
7,500
protected function getParentClasses ( $ name ) { $ parentClasses = array ( ) ; foreach ( array_reverse ( class_parents ( $ name ) ) as $ parentClass ) { if ( ! $ this -> driver -> isTransient ( $ parentClass ) ) { $ parentClasses [ ] = $ parentClass ; } } return $ parentClasses ; }
Get array of parent classes for the given entity class
7,501
private function completeMappingTypeValidation ( $ className , ClassMetadataInfo $ class ) { foreach ( $ class -> fieldMappings as $ fieldName => $ mapping ) { if ( Type :: hasType ( $ mapping [ 'type' ] ) ) { continue ; } if ( ! $ this -> hasMetadataFor ( $ mapping [ 'type' ] ) && ! $ this -> getMetadataFor ( $ mappin...
Complete and validate type mappings
7,502
private function completeIdGeneratorMapping ( ClassMetadataInfo $ class ) { $ idGenType = $ class -> generatorType ; if ( $ idGenType == ClassMetadata :: GENERATOR_TYPE_AUTO ) { $ class -> setIdGeneratorType ( ClassMetadataInfo :: GENERATOR_TYPE_NONE ) ; } switch ( $ class -> generatorType ) { case ClassMetadataInfo ::...
Completes the ID generator mapping . If auto is specified we choose the generator most appropriate .
7,503
public function insert ( ClassMetadataInfo $ classMetadata , $ id , $ xmlContent ) { $ this -> prepareStoragePathForClass ( $ this -> resolveClassName ( $ classMetadata ) ) ; $ filePath = $ this -> getFilename ( $ classMetadata , $ id ) ; $ result = file_put_contents ( $ filePath , $ xmlContent ) ; if ( false === $ res...
Insert the XML into the filesystem with a specific identifier
7,504
private function prepareStoragePathForClass ( $ className ) { $ filePath = $ this -> buildStoragePath ( $ className ) ; if ( ! file_exists ( $ filePath ) ) { mkdir ( $ filePath , $ this -> fileModeBits , true ) ; } return $ filePath ; }
Build the realpath to save the xml in a specific folder
7,505
public function getRepositories ( $ user = '' , $ sort = 'created' , $ direction = 'desc' ) { $ allowedSort = array ( 'created' , 'updated' ) ; $ allowedDir = array ( 'asc' , 'desc' ) ; if ( ! \ in_array ( $ sort , $ allowedSort ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The sorting value is invalid. Allow...
List repositories being starred .
7,506
public function getMapHeadings ( ) { if ( ! $ this -> headings && ! $ this -> mappablecols ) { return ; } $ out = new Arraylist ( ) ; foreach ( $ this -> headings as $ heading ) { $ dropdown = $ this -> createHeadingDropdown ( $ heading ) ; if ( is_array ( $ this -> mappingvalues ) && isset ( $ this -> mappingvalues [ ...
Provide heading dropdowns for creating mappings
7,507
public function get ( string $ identifier = '' ) : Normalize { if ( ! $ this -> exists ( $ identifier ) ) { throw new NotFound ( "No instance found with the name '{$identifier}'" ) ; } return $ this -> instances [ $ identifier ] ; }
Get existing normalize instance
7,508
public function createAndAdd ( array $ rules = [ ] , string $ identifier = '' , string $ chain = null ) : Manager { return $ this -> add ( $ this -> create ( $ rules ) , $ identifier , $ chain ) ; }
Create and add Normalize object
7,509
protected function databaseSupportsUtf8Mb4 ( string $ databaseVersion ) : bool { if ( strpos ( $ databaseVersion , '-MariaDB' ) !== false && version_compare ( $ databaseVersion , self :: MINIMUM_MARIA_DB_VERSION ) === - 1 ) { return false ; } if ( preg_match ( '([a-zA-Z])' , $ databaseVersion ) === 0 && version_compare...
Check if MySQL based database supports utf8mb4 character set .
7,510
public function create ( $ org , $ name , array $ repoNames = array ( ) , $ permission = '' ) { $ path = '/orgs/' . $ org . '/teams' ; $ data = array ( 'name' => $ name , ) ; if ( $ repoNames ) { $ data [ 'repo_names' ] = $ repoNames ; } if ( $ permission ) { if ( \ in_array ( $ permission , array ( 'pull' , 'push' , '...
Create team .
7,511
public function edit ( $ id , $ name , $ permission = '' ) { $ path = '/teams/' . ( int ) $ id ; $ data = array ( 'name' => $ name , ) ; if ( $ permission ) { if ( \ in_array ( $ permission , array ( 'pull' , 'push' , 'admin' ) ) == false ) { throw new \ UnexpectedValueException ( 'Permissions must be either "pull", "p...
Edit team .
7,512
public function filterNullValuesFromArray ( array $ arr ) : array { foreach ( $ arr as $ key => $ value ) { if ( $ value === null ) { unset ( $ arr [ $ key ] ) ; } if ( is_array ( $ value ) ) { $ arr [ $ key ] = $ this -> filterNullValuesFromArray ( $ value ) ; } } return $ arr ; }
Filters null values from an array .
7,513
public static function toArrayRecursive ( $ collection ) { $ arr = $ collection ; if ( is_object ( $ collection ) && method_exists ( $ collection , 'toArray' ) ) { $ arr = $ collection -> toArray ( ) ; } return array_map ( function ( $ v ) { if ( is_object ( $ v ) && method_exists ( $ v , 'toArray' ) ) { return static ...
Recursively exports a collection to an array
7,514
protected static function initStableRelease ( ) { $ releasePathStable = '' ; $ path = \ Deployer \ get ( 'deploy_path' ) ; $ hasStableRelease = \ Deployer \ test ( "[ -d $path/current/ ]" ) ; if ( $ hasStableRelease ) { $ readlinkBin = \ Deployer \ get ( 'readlink_bin' ) ; if ( is_array ( $ readlinkBin ) ) { $ readlink...
Detect the path to current release before actual deployment starts
7,515
protected static function initReleaseName ( ) { $ release = \ Deployer \ get ( 'release_name' ) ; $ isVersion = version_compare ( $ release , '0.0.1' , '>=' ) ; if ( $ isVersion === true ) { $ releaseName = self :: getUniqueReleaseName ( $ release ) ; } else { $ releaseClean = self :: cleanString ( $ release ) ; $ doUs...
Initialize a unique release - name checking if the release - name already exists and then postfixing it
7,516
protected static function getUniqueReleaseName ( $ release ) { $ i = 0 ; $ releaseName = $ release ; $ cmdTemplate = '[ -d {{deploy_path}}/releases/%s ]' ; $ cmd = sprintf ( $ cmdTemplate , $ releaseName ) ; while ( \ Deployer \ test ( $ cmd ) ) { $ releaseName = $ release . '-' . ++ $ i ; $ cmd = sprintf ( $ cmdTempla...
Determines a unique release - name
7,517
public function getContentHtmlAttribute ( ) { if ( $ this -> is_html ) { return $ this -> content ; } return static :: $ formatter -> render ( $ this -> attributes [ 'content' ] , $ this ) ; }
Get the content rendered as HTML .
7,518
public function getList ( $ owner , $ repo , $ sha = '' , $ ref = '' , $ task = '' , $ environment = '' , $ page = 0 , $ limit = 0 ) { $ path = "/repos/$owner/$repo/deployments" ; $ uri = new Uri ( $ this -> fetchUrl ( $ path , $ page , $ limit ) ) ; if ( $ sha ) { $ uri -> setVar ( 'sha' , $ sha ) ; } if ( $ ref ) { $...
List Deployments .
7,519
public function create ( $ owner , $ repo , $ ref , $ task = '' , $ autoMerge = true , $ requiredContexts = null , $ payload = '' , $ environment = '' , $ description = '' ) { $ path = "/repos/$owner/$repo/deployments" ; $ data = array ( 'ref' => $ ref , 'auto_merge' => $ autoMerge , ) ; if ( $ task ) { $ data [ 'task'...
Create a Deployment .
7,520
public function getDeploymentStatuses ( $ owner , $ repo , $ id , $ page = 0 , $ limit = 0 ) { $ path = "/repos/$owner/$repo/deployments/" . ( int ) $ id . '/statuses' ; return $ this -> processResponse ( $ this -> client -> get ( $ this -> fetchUrl ( $ path , $ page , $ limit ) ) ) ; }
List Deployment Statuses .
7,521
public function createStatus ( $ owner , $ repo , $ id , $ state , $ targetUrl = '' , $ description = '' ) { $ allowedStates = array ( 'pending' , 'success' , 'error' , 'failure' ) ; $ path = "/repos/$owner/$repo/deployments/" . ( int ) $ id . '/statuses' ; if ( ! \ in_array ( $ state , $ allowedStates ) ) { throw new ...
Create a Deployment Status .
7,522
private function executeDestroy ( $ ids ) { $ models = User :: find ( $ ids ) ; User :: destroy ( $ ids ) ; event ( new UserRemoved ( $ models -> toJson ( ) ) ) ; return Response :: json ( [ 'deleted' => true ] ) ; }
Execute destroy .
7,523
public function start ( ) { declare ( ticks = 1 ) ; register_shutdown_function ( array ( $ this , "shutdown" ) ) ; pcntl_signal ( SIGTERM , array ( $ this , "signalHandler" ) ) ; pcntl_signal ( SIGINT , array ( $ this , "signalHandler" ) ) ; $ this -> output -> writeln ( "<info>Starting <comment>" . $ this -> config ->...
Starts running worker .
7,524
public function shutdown ( ) { if ( $ this -> masterPid === posix_getpid ( ) && ! $ this -> finished ) { $ this -> dispatcher -> dispatch ( WorkerEvents :: SHUTTING_DOWN , new WorkerShuttingDownEvent ( $ this ) ) ; $ this -> output -> writeln ( "<info>Shutdown <comment>" . $ this -> config -> getName ( ) . "</comment>....
Shoutdown process .
7,525
public function upload ( SS_HTTPRequest $ request ) { $ field = $ this -> getUploadField ( ) ; $ uploadResponse = $ field -> upload ( $ request ) ; $ body = Convert :: json2array ( $ uploadResponse -> getBody ( ) ) ; $ body = array_shift ( $ body ) ; $ body [ 'import_url' ] = Controller :: join_links ( $ this -> Link (...
Upload the given file and import or start preview .
7,526
public function preview ( SS_HTTPRequest $ request ) { $ file = File :: get ( ) -> byID ( $ request -> param ( 'FileID' ) ) ; if ( ! $ file ) { return "file not found" ; } $ mapper = new CSVFieldMapper ( $ file -> getFullPath ( ) ) ; $ mapper -> setMappableCols ( $ this -> getMappableColumns ( ) ) ; if ( $ cachedmappin...
Action for getting preview interface .
7,527
public function MapperForm ( ) { $ fields = new FieldList ( CheckboxField :: create ( "HasHeader" , "This data includes a header row." , true ) ) ; if ( $ this -> component -> getCanClearData ( ) ) { $ fields -> push ( CheckboxField :: create ( "ClearData" , "Remove all existing records before import." ) ) ; } $ action...
The import form for creating mapping and choosing options .
7,528
public function import ( SS_HTTPRequest $ request ) { $ hasheader = ( bool ) $ request -> postVar ( 'HasHeader' ) ; $ cleardata = $ this -> component -> getCanClearData ( ) ? ( bool ) $ request -> postVar ( 'ClearData' ) : false ; if ( $ request -> postVar ( 'action_import' ) ) { $ file = File :: get ( ) -> byID ( $ re...
Import the current file
7,529
public function importFile ( $ filepath , $ colmap = null , $ hasheader = true , $ cleardata = false ) { $ loader = $ this -> component -> getLoader ( $ this -> gridField ) ; $ loader -> deleteExistingRecords = $ cleardata ; if ( is_array ( $ colmap ) ) { $ loader -> columnMap = $ loader -> columnMap ? array_merge ( $ ...
Do the import using the configured importer .
7,530
protected function cacheMapping ( $ mapping ) { $ mapping = array_filter ( $ mapping ) ; if ( $ mapping && ! empty ( $ mapping ) ) { $ cache = SS_Cache :: factory ( 'gridfieldimporter' ) ; $ cache -> save ( serialize ( $ mapping ) , $ this -> cacheKey ( ) ) ; } }
Store the user defined mapping for future use .
7,531
protected function getCachedMapping ( ) { $ cache = SS_Cache :: factory ( 'gridfieldimporter' ) ; if ( $ result = $ cache -> load ( $ this -> cacheKey ( ) ) ) { return unserialize ( $ result ) ; } }
Look for a previously stored user defined mapping .
7,532
protected function getBackURL ( SS_HTTPRequest $ request ) { $ controller = $ this -> getToplevelController ( ) ; $ url = method_exists ( $ this -> requestHandler , "Link" ) ? $ this -> requestHandler -> Link ( ) : $ controller -> Link ( ) ; if ( $ request -> requestVar ( 'BackURL' ) ) { $ url = $ request -> requestVar...
Get s the previous URL that lead up to the current request .
7,533
public function getIterator ( ) { if ( ! file_exists ( $ this -> filepath ) ) { return null ; } $ header = $ this -> hasheader ? $ this -> getFirstRow ( ) : null ; $ output = array ( ) ; $ config = new LexerConfig ( ) ; $ config -> setDelimiter ( $ this -> delimiter ) ; $ config -> setEnclosure ( $ this -> enclosure ) ...
Get a new CSVParser using defined settings .
7,534
public function index ( User $ user ) { $ data = [ ] ; if ( $ user -> id ) { if ( $ user -> identifiableName ( ) === Auth :: user ( ) -> id || Auth :: user ( ) -> can ( 'see-other-users-profile' ) ) { $ data = $ user -> toArray ( ) ; } else { abort ( 403 ) ; } } return view ( 'acacha_users::profile' , $ data ) ; }
Show user profile .
7,535
protected function registerGoogleServiceProvider ( ) { $ this -> app -> register ( GoogleServiceProvider :: class ) ; $ this -> app -> booting ( function ( ) { $ loader = AliasLoader :: getInstance ( ) ; $ loader -> alias ( 'Google' , Google :: class ) ; } ) ; app ( ) -> extend ( \ PulkitJalan \ Google \ Client :: clas...
Register Google Service Provider .
7,536
protected function defineRoutes ( ) { if ( ! $ this -> app -> routesAreCached ( ) ) { $ router = app ( 'router' ) ; $ this -> defineWebRoutes ( $ router ) ; $ this -> defineApiRoutes ( $ router ) ; } }
Define the AdminLTETemplate routes .
7,537
protected function removeUserModel ( $ directory ) { $ modelFile = $ directory . '/app/User.php' ; if ( is_file ( $ modelFile ) ) { @ chmod ( $ modelFile , 0777 ) ; @ unlink ( $ modelFile ) ; } return $ this ; }
Delete old model User . php
7,538
public function accept ( Request $ request ) { if ( ! $ request -> has ( 'token' ) ) abort ( 404 ) ; if ( ! $ invitation = $ this -> validateToken ( $ request -> input ( 'token' ) ) ) abort ( 404 ) ; return $ this -> showAcceptUserInvitationForm ( $ invitation ) ; }
Accept user invitation .
7,539
public function postAccept ( CreateUserWithTokenRequest $ request ) { if ( ! $ request -> has ( 'token' ) ) abort ( 403 ) ; if ( ! $ invitation = $ this -> validateToken ( $ request -> input ( 'token' ) ) ) abort ( 403 ) ; $ user = User :: create ( [ 'name' => $ request -> input ( 'name' ) , 'email' => $ request -> inp...
Process accept user invitation form .
7,540
public static function updateMagentoConfig ( ) { $ env = \ Deployer \ get ( 'config_store_env' ) ; if ( empty ( $ env ) ) { $ env = \ Deployer \ input ( ) -> getArgument ( 'stage' ) ; } $ dir = \ Deployer \ get ( 'config_store_dir' ) ; if ( empty ( $ dir ) ) { $ dir = '{{release_path}}/config/store' ; } \ Deployer \ cd...
Import the Magento Config using the config data files
7,541
public function add ( $ element , $ index = null ) { if ( $ index === null ) { $ this -> collection [ $ this -> size ( ) ] = $ element ; } else { array_splice ( $ this -> collection , $ index , 0 , $ element ) ; } return $ this ; }
Adds an element to that list
7,542
public function remove ( $ element ) { $ index = array_search ( $ element , $ this -> collection , true ) ; if ( $ index !== null ) { unset ( $ this -> collection [ $ index ] ) ; } return $ this ; }
Removes an element from the list
7,543
public function getFeeds ( ) { $ path = '/feeds' ; return $ this -> processResponse ( $ this -> client -> get ( $ this -> fetchUrl ( $ path ) ) ) ; }
List Feeds .
7,544
public function getByTag ( $ user , $ repo , $ tag ) { $ path = "/repos/$user/$repo/releases/tags/$tag" ; return $ this -> processResponse ( $ this -> client -> get ( $ this -> fetchUrl ( $ path ) ) ) ; }
Get a release by tag name .
7,545
public function getListAssets ( $ user , $ repo , $ releaseId , $ page = 0 , $ limit = 0 ) { $ path = '/repos/' . $ user . '/' . $ repo . '/releases/' . ( int ) $ releaseId . '/assets' ; return $ this -> processResponse ( $ this -> client -> get ( $ this -> fetchUrl ( $ path , $ page , $ limit ) ) ) ; }
List assets for a release .
7,546
public function getAsset ( $ user , $ repo , $ assetId ) { $ path = '/repos/' . $ user . '/' . $ repo . '/releases/assets/' . ( int ) $ assetId ; return $ this -> processResponse ( $ this -> client -> get ( $ this -> fetchUrl ( $ path ) ) ) ; }
Get a single release asset .
7,547
public function editAsset ( $ user , $ repo , $ assetId , $ name , $ label = '' ) { $ path = '/repos/' . $ user . '/' . $ repo . '/releases/assets/' . ( int ) $ assetId ; $ data = array ( 'name' => $ name , ) ; if ( $ label ) { $ data [ 'label' ] = $ label ; } return $ this -> processResponse ( $ this -> client -> patc...
Edit a release asset .
7,548
public function deleteAsset ( $ user , $ repo , $ assetId ) { $ path = '/repos/' . $ user . '/' . $ repo . '/releases/assets/' . ( int ) $ assetId ; $ this -> processResponse ( $ this -> client -> delete ( $ this -> fetchUrl ( $ path ) ) , 204 ) ; return true ; }
Delete a release asset .
7,549
public function handle ( ComponentContext $ componentContext ) { $ configurationSource = $ this -> objectManager -> get ( \ Neos \ Flow \ Configuration \ Source \ YamlSource :: class ) ; $ routesConfiguration = $ configurationSource -> load ( $ this -> packageManager -> getPackage ( 'Neos.Setup' ) -> getConfigurationPa...
Set the routes configuration for the Neos setup and configures the routing component to skip initialisation which would overwrite the specific settings again .
7,550
public function losePermissions ( $ permissions ) : void { if ( ! is_array ( $ permissions ) && ! $ permissions instanceof Collection ) { $ permissions = func_get_args ( ) ; } foreach ( $ permissions as $ permission ) { $ permission = $ this -> resolvePermission ( $ permission ) ; $ this -> permissions ( ) -> detach ( ...
Remove given permissions from the user .
7,551
public function hasPermission ( string $ permission , ? Model $ model = null , string $ userForeignKey = 'user_id' ) : bool { if ( $ model && $ model -> { $ userForeignKey } == $ this -> id ) { return true ; } if ( $ this -> permissions -> pluck ( 'code' ) -> contains ( $ permission ) ) { return true ; } return $ this ...
Check whether the user has given permission .
7,552
public function makeLeaderOf ( $ group ) : void { $ group = $ this -> resolveGroup ( $ group ) ; $ this -> leadingGroups ( ) -> attach ( $ group ) ; }
Make the user leader of a group .
7,553
public function isLeaderOf ( $ group ) : bool { $ group = $ this -> resolveGroup ( $ group ) ; return $ this -> leadingGroups ( ) -> where ( 'group_id' , is_int ( $ group ) ? $ group : $ group -> id ) -> exists ( ) ; }
Determine whether a given user is leader of the group .
7,554
public function getFormattedNameAttribute ( ) : string { $ nameField = \ Config :: get ( 'membership.users.name_column' ) ; if ( ! $ this -> primary_group_id ) { return $ this -> { $ nameField } ; } return $ this -> primaryGroup -> open_tag . $ this -> { $ nameField } . $ this -> primaryGroup -> close_tag ; }
Get user s formatted name according to his primary group tags .
7,555
protected function processAll ( $ filepath , $ preview = false ) { if ( ! $ this -> source ) { user_error ( "No source has been configured for the bulk loader" , E_USER_WARNING ) ; } $ results = new BetterBulkLoader_Result ( ) ; $ iterator = $ this -> getSource ( ) -> getIterator ( ) ; foreach ( $ iterator as $ record ...
Import all records from the source .
7,556
protected function processRecord ( $ record , $ columnMap , & $ results , $ preview = false ) { if ( ! is_array ( $ record ) || empty ( $ record ) || ! array_filter ( $ record ) ) { $ results -> addSkipped ( "Empty/invalid record data." ) ; return ; } $ record = $ this -> columnMapRecord ( $ record ) ; if ( ! $ this ->...
Import the given record
7,557
protected function columnMapRecord ( $ record ) { $ adjustedmap = $ this -> columnMap ; $ newrecord = array ( ) ; foreach ( $ record as $ field => $ value ) { if ( isset ( $ adjustedmap [ $ field ] ) ) { $ newrecord [ $ adjustedmap [ $ field ] ] = $ value ; } else { $ newrecord [ $ field ] = $ value ; } } return $ newr...
Convert the record s keys to appropriate columnMap keys .
7,558
protected function hasRequiredData ( $ mappedrecord ) { if ( ! is_array ( $ mappedrecord ) || empty ( $ mappedrecord ) || ! array_filter ( $ mappedrecord ) ) { return false ; } foreach ( $ this -> transforms as $ field => $ t ) { if ( is_array ( $ t ) && isset ( $ t [ 'required' ] ) && $ t [ 'required' ] === true && ( ...
Check if the given mapped record has the required data .
7,559
protected function isRelation ( $ field ) { if ( strpos ( $ field , '.' ) !== false ) { list ( $ field , $ columnName ) = explode ( '.' , $ field ) ; } $ has_ones = singleton ( $ this -> objectClass ) -> has_one ( ) ; return isset ( $ has_ones [ $ field ] ) ; }
Detect if a given record field is a relation field .
7,560
protected function getRelationName ( $ recordField ) { $ relationName = null ; if ( isset ( $ this -> relationCallbacks [ $ recordField ] ) ) { $ relationName = $ this -> relationCallbacks [ $ recordField ] [ 'relationname' ] ; } if ( strpos ( $ recordField , '.' ) !== false ) { list ( $ relationName , $ columnName ) =...
Given a record field name find out if this is a relation name and return the name .
7,561
public function getMappableColumns ( ) { if ( ! empty ( $ this -> mappableFields ) ) { return $ this -> mappableFields ; } $ scaffolded = $ this -> scaffoldMappableFields ( ) ; if ( ! empty ( $ this -> transforms ) ) { $ transformables = array_keys ( $ this -> transforms ) ; $ transformables = array_combine ( $ transfo...
Get the field - label mapping of fields that data can be mapped into .
7,562
public static function getConverterVersion ( ) { $ command = self :: getConverterPath ( ) . ' -version' ; $ output = shell_exec ( $ command ) ; $ ouput = preg_match ( "/ffmpeg version (?P<major>[0-9]{0,3}).(?P<minor>[0-9]{0,3}).(?P<revision>[0-9]{0,3})/" , $ output , $ parsed ) ; if ( $ output === false || $ output == ...
Returns installed ffmpeg version
7,563
public static function getSupportedFormats ( ) { $ command = self :: getConverterPath ( ) . ' -formats' ; $ output = shell_exec ( $ command ) ; $ output = preg_match_all ( "/(?P<mux>(D\s|\sE|DE))\s(?P<format>\S{3,11})\s/" , $ output , $ parsed ) ; if ( $ output === false || $ output == 0 ) { return false ; } $ formats ...
Returns all formats ffmpeg supports
7,564
public static function getSupportedVideoDecoders ( ) { $ command = self :: getConverterPath ( ) . ' -decoders' ; $ output = shell_exec ( $ command ) ; $ output = preg_match_all ( "/[V]([.]|\w)([.]|\w)([.]|\w)([.]|\w)([.]|\w)\s(?P<format>\w{3,20})\s/" , $ output , $ parsed ) ; if ( $ output === false || $ output == 0 ) ...
Returns all video formats ffmpeg can decode
7,565
public static function canEncode ( $ format ) { $ formats = array_merge ( self :: getSupportedAudioEncoders ( ) , self :: getSupportedVideoEncoders ( ) ) ; if ( ! in_array ( $ format , $ formats ) ) { return false ; } else { return true ; } }
Returns boolean if ffmpeg is able to encode to this format
7,566
public static function canDecode ( $ format ) { $ formats = array_merge ( self :: getSupportedAudioDecoders ( ) , self :: getSupportedVideoDecoders ( ) ) ; if ( ! in_array ( $ format , $ formats ) ) { return false ; } else { return true ; } }
Returns boolean if ffmpeg is able to decode to this format
7,567
public static function getMediaInfo ( $ input , $ type = null ) { if ( substr ( $ input , 0 , 2 ) == '-i' ) { $ input = substr ( $ input , 3 ) ; } switch ( $ type ) { case 'json' : $ command = self :: getProbePath ( ) . ' -v quiet -print_format json -show_format -show_streams -pretty -i ' . $ input . ' 2>&1' ; $ output...
Returns array with file information
7,568
public function overwrite ( $ var = true ) { switch ( $ var ) { case true : array_push ( $ this -> parameters , '-y' ) ; return $ this ; break ; case false : array_push ( $ this -> parameters , '-n' ) ; return $ this ; break ; default : return false ; break ; } }
Overwrite output file if it exists
7,569
public function bitrate ( $ var , $ type = 'audio' ) { if ( ! is_numeric ( $ var ) ) { return false ; } switch ( $ type ) { case 'audio' : array_push ( $ this -> parameters , '-b:a ' . $ var . 'k' ) ; return $ this ; break ; case 'video' : array_push ( $ this -> parameters , '-b:v ' . $ var . 'k' ) ; return $ this ; br...
Sets the constant bitrate
7,570
public static function getProgress ( $ job , $ format = null ) { $ tmpdir = self :: getTempPath ( ) ; $ content = @ file_get_contents ( $ tmpdir . $ job . '.sonustmp' ) ; if ( $ content ) { preg_match ( "/Duration: (.*?), start:/" , $ content , $ matches ) ; $ rawDuration = $ matches [ 1 ] ; $ ar = array_reverse ( expl...
Returns given job progress
7,571
public static function destroyProgress ( $ job ) { $ file = $ tmpdir . $ job . '.sonustmp' ; if ( is_file ( $ file ) ) { $ output = unlink ( $ tmpdir . $ job . '.sonustmp' ) ; return $ output ; } else { return false ; } }
Deletes job temporary file
7,572
public static function destroyAllProgress ( ) { $ files = glob ( $ tmpdir . '*' ) ; $ output = array ( ) ; foreach ( $ files as $ file ) { if ( is_file ( $ file ) ) { $ result = unlink ( $ file ) ; array_push ( $ output , var_export ( $ result , true ) ) ; } } if ( array_search ( 'false' , $ output ) ) { return false ;...
Deletes all temporary files
7,573
protected function getDefaultParametersFromContext ( $ context = null ) { if ( count ( $ this -> defaultParameters [ 'contexts' ] ) ) { if ( $ context === null ) { $ context = $ this -> defaultParameters [ 'default' ] [ 'context' ] ; } if ( array_key_exists ( $ context , $ this -> defaultParameters [ 'contexts' ] ) ) {...
Get the configuration for the given context .
7,574
public function getLoader ( GridField $ gridField ) { if ( ! $ this -> loader ) { $ this -> loader = $ this -> scaffoldLoader ( $ gridField ) ; } return $ this -> loader ; }
Get the BulkLoader
7,575
public function scaffoldLoader ( GridField $ gridField ) { $ gridlist = $ gridField -> getList ( ) ; $ class = ( $ gridlist instanceof HasManyList ) ? "ListBulkLoader" : "BetterBulkLoader" ; $ arg = ( $ class === "ListBulkLoader" || is_subclass_of ( $ class , "ListBulkLoader" ) ) ? $ gridlist : $ gridField -> getModelC...
Scaffold a bulk loader if none is provided
7,576
public function getUploadField ( GridField $ gridField ) { $ uploadField = UploadField :: create ( $ gridField -> Name . "_ImportUploadField" , 'Upload CSV' ) -> setForm ( $ gridField -> getForm ( ) ) -> setConfig ( 'url' , $ gridField -> Link ( 'importer/upload' ) ) -> setConfig ( 'edit_url' , $ gridField -> Link ( 'i...
Return a configured UploadField instance
7,577
public function handleImporter ( $ gridField , $ request = null ) { $ controller = $ gridField -> getForm ( ) -> getController ( ) ; $ handler = new GridFieldImporter_Request ( $ gridField , $ this , $ controller ) ; return $ handler -> handleRequest ( $ request , DataModel :: inst ( ) ) ; }
Pass importer requests to a new GridFieldImporter_Request
7,578
protected function getAvailableDrivers ( ) { $ supportedDrivers = [ 'pdo_mysql' => 'MySQL/MariaDB via PDO' , 'mysqli' => 'MySQL/MariaDB via mysqli' , 'pdo_pgsql' => 'PostgreSQL via PDO' ] ; $ availableDrivers = [ ] ; foreach ( $ supportedDrivers as $ driver => $ label ) { if ( extension_loaded ( $ driver ) ) { $ availa...
Return an array with driver .
7,579
public function check ( $ owner , $ repo , $ assignee ) { $ path = '/repos/' . $ owner . '/' . $ repo . '/assignees/' . $ assignee ; try { $ response = $ this -> client -> get ( $ this -> fetchUrl ( $ path ) ) ; if ( $ response -> code == 204 ) { return true ; } throw new UnexpectedResponseException ( $ response , 'Inv...
Check assignee .
7,580
public function add ( $ owner , $ repo , $ number , array $ assignees ) { $ path = "/repos/$owner/$repo/issues/$number/assignees" ; $ data = json_encode ( array ( 'assignees' => $ assignees , ) ) ; return $ this -> processResponse ( $ this -> client -> post ( $ this -> fetchUrl ( $ path ) , $ data ) , 201 ) ; }
Add assignees to an Issue
7,581
public function remove ( $ owner , $ repo , $ number , array $ assignees ) { $ path = "/repos/$owner/$repo/issues/$number/assignees" ; $ data = json_encode ( array ( 'assignees' => $ assignees , ) ) ; return $ this -> processResponse ( $ this -> client -> delete ( $ this -> fetchUrl ( $ path ) , array ( ) , null , $ da...
Remove assignees from an Issue
7,582
public function setInitialState ( ) { $ this -> setAttribute ( $ this -> getStateColumn ( ) , $ this -> getInitialState ( ) ) ; $ this -> token = hash_hmac ( 'sha256' , str_random ( 40 ) , env ( 'APP_KEY' ) ) ; }
Set the initial state .
7,583
public function create ( $ user , $ repo , $ title , $ body = null , $ assignee = null , $ milestone = null , array $ labels = array ( ) , array $ assignees = array ( ) ) { $ path = '/repos/' . $ user . '/' . $ repo . '/issues' ; if ( ! empty ( $ labels ) ) { $ labels = array_values ( $ labels ) ; } $ data = array ( 't...
Create an issue .
7,584
public function edit ( $ user , $ repo , $ issueId , $ state = null , $ title = null , $ body = null , $ assignee = null , $ milestone = null , array $ labels = null ) { $ path = '/repos/' . $ user . '/' . $ repo . '/issues/' . ( int ) $ issueId ; $ data = new \ stdClass ; if ( isset ( $ title ) ) { $ data -> title = $...
Edit an issue .
7,585
public function getList ( $ filter = null , $ state = null , $ labels = null , $ sort = null , $ direction = null , \ DateTime $ since = null , $ page = 0 , $ limit = 0 ) { $ uri = new Uri ( $ this -> fetchUrl ( '/issues' , $ page , $ limit ) ) ; if ( $ filter ) { $ uri -> setVar ( 'filter' , $ filter ) ; } if ( $ stat...
List issues .
7,586
public function getListByRepository ( $ user , $ repo , $ milestone = null , $ state = null , $ assignee = null , $ mentioned = null , $ labels = null , $ sort = null , $ direction = null , \ DateTime $ since = null , $ page = 0 , $ limit = 0 ) { $ path = '/repos/' . $ user . '/' . $ repo . '/issues' ; $ uri = new Uri ...
List issues for a repository .
7,587
public function lock ( $ user , $ repo , $ issueId ) { $ path = "/repos/$user/$repo/issues/" . ( int ) $ issueId . '/lock' ; return $ this -> processResponse ( $ this -> client -> put ( $ this -> fetchUrl ( $ path ) , array ( ) ) , 204 ) ; }
Lock an issue .
7,588
public function unlock ( $ user , $ repo , $ issueId ) { $ path = "/repos/$user/$repo/issues/" . ( int ) $ issueId . '/lock' ; return $ this -> processResponse ( $ this -> client -> delete ( $ this -> fetchUrl ( $ path ) ) , 204 ) ; }
Unlock an issue .
7,589
public function createCsvResponse ( ) { $ handle = fopen ( 'php://memory' , 'r+' ) ; fputcsv ( $ handle , array ( 'Date' , 'City' , 'Temperature' , 'Description' ) ) ; foreach ( $ this -> weathers as $ weather ) { fputcsv ( $ handle , array ( $ weather -> getWdate ( ) , $ weather -> getCity ( ) , $ weather -> getTemper...
Creates CSV Response of Weathers
7,590
public static function addServerToRoles ( $ server , array $ roles ) { foreach ( $ roles as $ role ) { self :: $ roles [ $ role ] [ ] = $ server ; } }
Asign a Server to a Role
7,591
public function create ( $ user , $ repo , $ title , $ base , $ head , $ body = '' ) { $ path = '/repos/' . $ user . '/' . $ repo . '/pulls' ; $ data = json_encode ( array ( 'title' => $ title , 'base' => $ base , 'head' => $ head , 'body' => $ body , ) ) ; return $ this -> processResponse ( $ this -> client -> post ( ...
Create a pull request .
7,592
public function edit ( $ user , $ repo , $ pullId , $ title = null , $ body = null , $ state = null , $ base = null ) { $ path = '/repos/' . $ user . '/' . $ repo . '/pulls/' . ( int ) $ pullId ; $ data = new \ stdClass ; if ( isset ( $ title ) ) { $ data -> title = $ title ; } if ( isset ( $ body ) ) { $ data -> body ...
Update a pull request .
7,593
public function getCommits ( $ user , $ repo , $ pullId , $ page = 0 , $ limit = 0 ) { $ path = '/repos/' . $ user . '/' . $ repo . '/pulls/' . ( int ) $ pullId . '/commits' ; return $ this -> processResponse ( $ this -> client -> get ( $ this -> fetchUrl ( $ path , $ page , $ limit ) ) ) ; }
List commits on a pull request .
7,594
public function issues ( $ owner , $ repo , $ state , $ keyword ) { if ( \ in_array ( $ state , array ( 'open' , 'close' ) ) == false ) { throw new \ UnexpectedValueException ( 'State must be either "open" or "closed"' ) ; } $ path = '/legacy/issues/search/' . $ owner . '/' . $ repo . '/' . $ state . '/' . $ keyword ; ...
Search issues .
7,595
public function generateCsvAction ( $ city , $ days ) { if ( $ this -> getParameter ( 'pianosolo.weather.options.download_csv' ) === TRUE ) { $ weatherHandler = $ this -> get ( 'pianosolo.weather' ) ; $ weathers = $ weatherHandler -> getForecastObject ( $ city , $ days ) ; if ( ! empty ( $ weathers ) ) { $ csvResponse ...
Downloads Weather List of City as CSV
7,596
public function update ( LoggedUserUpdate $ request ) { $ user = Auth :: user ( ) ; $ user -> update ( $ request -> only ( [ 'name' , 'email' , 'password' ] ) ) ; return $ user ; }
Update logged user .
7,597
public static function execute ( ) { $ release = null ; $ input = \ Deployer \ input ( ) ; if ( $ input -> hasOption ( 'branch' ) ) { $ branch = $ input -> getOption ( 'branch' ) ; if ( ! empty ( $ branch ) ) { $ release = $ branch ; } } if ( $ release !== null ) { return $ release ; } $ input = \ Deployer \ input ( ) ...
Determine the release name by branch or tag otherwise uses datetime string
7,598
public function set ( $ key , $ element ) { $ key = $ this -> extractKey ( $ key ) ; $ this -> collection [ $ key ] = $ element ; return $ this ; }
Sets an element with the given key on that map
7,599
public function get ( $ key , $ default = null ) { $ key = $ this -> extractKey ( $ key ) ; if ( isset ( $ this -> collection [ $ key ] ) ) { return $ this -> collection [ $ key ] ; } else { return $ default ; } }
Returns the element for the given key or your value if the key doesn t exist .