idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
60,300
public static function isGitClone ( $ path = null ) { if ( is_null ( $ path ) || empty ( $ path ) ) { return false ; } $ dir_path = self :: slashDirname ( $ path ) . '.git' ; return ( bool ) ( file_exists ( $ dir_path ) && is_dir ( $ dir_path ) ) ; }
Test if a path seems to be a git clone
60,301
public static function isDotPath ( $ path = null ) { if ( is_null ( $ path ) || empty ( $ path ) ) { return false ; } return ( bool ) ( '.' === substr ( basename ( $ path ) , 0 , 1 ) ) ; }
Test if a filename seems to have a dot as first character
60,302
public static function remove ( $ path , $ parent = true ) { $ ok = true ; if ( true === self :: ensureExists ( $ path ) ) { if ( false === @ is_dir ( $ path ) || true === is_link ( $ path ) ) { return @ unlink ( $ path ) ; } $ iterator = new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ path ) , \...
Try to remove a path
60,303
public static function parseIni ( $ path ) { if ( true === @ file_exists ( $ path ) ) { $ data = parse_ini_file ( $ path , true ) ; if ( $ data && ! empty ( $ data ) ) { return $ data ; } } return false ; }
Read and parse a INI content file
60,304
public static function parseJson ( $ path ) { if ( true === @ file_exists ( $ path ) ) { $ ctt = file_get_contents ( $ path ) ; if ( $ ctt !== false ) { $ data = json_decode ( $ ctt , true ) ; if ( $ data && ! empty ( $ data ) ) { return $ data ; } } } return false ; }
Read and parse a JSON content file
60,305
protected function create ( Array $ arguments = [ ] ) { $ migrationsDirectory = $ this -> cmd -> getConfigOpt ( 'migrations_storage' ) ; $ templateTags = [ ] ; $ migrationName = $ this -> cmd -> question ( 'Migration filename?' ) ; $ filename = trim ( $ migrationName ) ; $ path = $ migrationsDirectory . '/' . $ filenam...
Creates a migration .
60,306
protected function processMigration ( Array $ arguments ) { $ migrationClass = $ arguments [ 0 ] ; $ migration = Model :: findByclass_name ( $ migrationClass ) ; if ( ! $ migration ) { throw new MigrationClassNotFoundException ( sprintf ( 'Migration class [%s] does not exist' , $ migrationClass ) ) ; } if ( isset ( $ a...
Processes a specific migration .
60,307
protected function getCacheModificationDate ( $ file ) { $ storageKey = $ this -> getStorageKey ( ) . '.lasmodified' ; $ filemtime = filemtime ( $ file ) ; $ lastmodified = $ this -> storage -> has ( $ storageKey ) ? $ this -> storage -> get ( $ storageKey ) : $ filemtime - 1 ; return array ( $ filemtime , $ lastmodifi...
Returns the modification date of a given file and the the date of the last cache write .
60,308
public function create ( array $ metadata = array ( ) ) { if ( is_file ( $ this -> file ) ) { return false ; } $ this -> createTemporaryFolder ( ) ; file_put_contents ( $ this -> file , $ this -> placeholderContent ( $ metadata ) , LOCK_EX ) ; return true ; }
Creates the file . It creates a placeholder file with some metadata on it and will create all the temporary files and folders .
60,309
protected function createTemporaryFolder ( ) { Util :: mkdir ( $ this -> blocks ) ; Util :: mkdir ( dirname ( $ this -> file ) ) ; file_put_contents ( $ this -> tmp . '.lock' , '' , LOCK_EX ) ; }
Creates the needed temporary files and folders in prepartion for the file writer .
60,310
public function getWroteBlocks ( ) { if ( ! is_dir ( $ this -> blocks ) ) { throw new RuntimeException ( "cannot obtain the blocks ({$this->blocks})" ) ; } $ files = array_filter ( array_map ( function ( $ file ) { $ basename = basename ( $ file ) ; if ( ! is_numeric ( $ basename ) ) { return false ; } return [ 'offset...
Returns all the wrote blocks of files . All the blocks are sorted by their offset .