idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
45,500 | protected function getPhpciConfigInformation ( InputInterface $ input , OutputInterface $ output ) { $ phpci = array ( ) ; $ dialog = $ this -> getHelperSet ( ) -> get ( 'dialog' ) ; $ urlValidator = function ( $ answer ) { if ( ! filter_var ( $ answer , FILTER_VALIDATE_URL ) ) { throw new Exception ( Lang :: get ( 'mu... | Load configuration for PHPCI form CLI options or ask info to user . |
45,501 | protected function getQueueInformation ( InputInterface $ input , OutputInterface $ output , DialogHelper $ dialog ) { if ( $ input -> getOption ( 'queue-disabled' ) ) { return null ; } $ rtn = [ ] ; $ helper = $ this -> getHelper ( 'question' ) ; $ question = new ConfirmationQuestion ( 'Use beanstalkd to manage build ... | If the user wants to use a queue get the necessary details . |
45,502 | protected function getDatabaseInformation ( InputInterface $ input , OutputInterface $ output ) { $ db = array ( ) ; $ dialog = $ this -> getHelperSet ( ) -> get ( 'dialog' ) ; if ( ! $ dbHost = $ input -> getOption ( 'db-host' ) ) { $ dbHost = $ dialog -> ask ( $ output , Lang :: get ( 'enter_db_host' ) , 'localhost' ... | Load configuration for DB form CLI options or ask info to user . |
45,503 | protected function verifyDatabaseDetails ( array $ db , OutputInterface $ output ) { try { $ pdo = new PDO ( 'mysql:host=' . $ db [ 'servers' ] [ 'write' ] . ';dbname=' . $ db [ 'name' ] , $ db [ 'username' ] , $ db [ 'password' ] , array ( \ PDO :: ATTR_PERSISTENT => false , \ PDO :: ATTR_ERRMODE => \ PDO :: ERRMODE_E... | Try and connect to MySQL using the details provided . |
45,504 | protected function writeConfigFile ( array $ config ) { $ dumper = new \ Symfony \ Component \ Yaml \ Dumper ( ) ; $ yaml = $ dumper -> dump ( $ config , 4 ) ; file_put_contents ( $ this -> configFilePath , $ yaml ) ; } | Write the PHPCI config . yml file . |
45,505 | protected function createAdminUser ( $ admin , $ output ) { try { $ this -> reloadConfig ( ) ; $ userStore = Factory :: getStore ( 'User' ) ; $ userService = new UserService ( $ userStore ) ; $ userService -> createUser ( $ admin [ 'name' ] , $ admin [ 'mail' ] , $ admin [ 'pass' ] , 1 ) ; $ output -> writeln ( '<info>... | Create admin user using information loaded before . |
45,506 | public function createUser ( $ name , $ emailAddress , $ password , $ isAdmin = false ) { $ user = new User ( ) ; $ user -> setName ( $ name ) ; $ user -> setEmail ( $ emailAddress ) ; $ user -> setHash ( password_hash ( $ password , PASSWORD_DEFAULT ) ) ; $ user -> setIsAdmin ( ( $ isAdmin ? 1 : 0 ) ) ; return $ this ... | Create a new user within PHPCI . |
45,507 | public function index ( ) { $ this -> requireAdmin ( ) ; $ groups = array ( ) ; $ groupList = $ this -> groupStore -> getWhere ( array ( ) , 100 , 0 , array ( ) , array ( 'title' => 'ASC' ) ) ; foreach ( $ groupList [ 'items' ] as $ group ) { $ thisGroup = array ( 'title' => $ group -> getTitle ( ) , 'id' => $ group ->... | List project groups . |
45,508 | public function edit ( $ groupId = null ) { $ this -> requireAdmin ( ) ; if ( ! is_null ( $ groupId ) ) { $ group = $ this -> groupStore -> getById ( $ groupId ) ; } else { $ group = new ProjectGroup ( ) ; } if ( $ this -> request -> getMethod ( ) == 'POST' ) { $ group -> setTitle ( $ this -> getParam ( 'title' ) ) ; $... | Add or edit a project group . |
45,509 | public function delete ( $ groupId ) { $ this -> requireAdmin ( ) ; $ group = $ this -> groupStore -> getById ( $ groupId ) ; $ this -> groupStore -> delete ( $ group ) ; $ response = new b8 \ Http \ Response \ RedirectResponse ( ) ; $ response -> setHeader ( 'Location' , PHPCI_URL . 'group' ) ; return $ response ; } | Delete a project group . |
45,510 | public function getLinePositions ( $ diff ) { if ( empty ( $ diff ) ) { return null ; } $ rtn = array ( ) ; $ diffLines = explode ( PHP_EOL , $ diff ) ; while ( count ( $ diffLines ) ) { $ line = array_shift ( $ diffLines ) ; if ( substr ( $ line , 0 , 2 ) == '@@' ) { array_unshift ( $ diffLines , $ line ) ; break ; } ... | Take a diff |
45,511 | public function getKnownBranches ( $ projectId ) { $ query = 'SELECT DISTINCT branch from build WHERE project_id = :pid' ; $ stmt = Database :: getConnection ( 'read' ) -> prepare ( $ query ) ; $ stmt -> bindValue ( ':pid' , $ projectId ) ; if ( $ stmt -> execute ( ) ) { $ res = $ stmt -> fetchAll ( \ PDO :: FETCH_ASSO... | Returns a list of all branch names PHPCI has run builds against . |
45,512 | public function getAll ( ) { $ query = 'SELECT * FROM `project` ORDER BY `title` ASC' ; $ stmt = Database :: getConnection ( 'read' ) -> prepare ( $ query ) ; if ( $ stmt -> execute ( ) ) { $ res = $ stmt -> fetchAll ( \ PDO :: FETCH_ASSOC ) ; $ map = function ( $ item ) { return new Project ( $ item ) ; } ; $ rtn = ar... | Get a list of all projects ordered by their title . |
45,513 | public function getByGroupId ( $ value , $ limit = 1000 , $ useConnection = 'read' ) { if ( is_null ( $ value ) ) { throw new \ Exception ( 'Value passed to ' . __FUNCTION__ . ' cannot be null.' ) ; } $ query = 'SELECT * FROM `project` WHERE `group_id` = :group_id ORDER BY title LIMIT :limit' ; $ stmt = Database :: get... | Get multiple Project by GroupId . |
45,514 | public static function createProcessControl ( ) { switch ( true ) { case PosixProcessControl :: isAvailable ( ) : return new PosixProcessControl ( ) ; case WindowsProcessControl :: isAvailable ( ) : return new WindowsProcessControl ( ) ; case UnixProcessControl :: isAvailable ( ) : return new UnixProcessControl ( ) ; }... | Create a ProcessControl depending on available extensions and the underlying OS . |
45,515 | protected function loadPluginInfo ( ) { $ this -> pluginInfo = array ( ) ; foreach ( $ this -> files as $ fileInfo ) { if ( $ fileInfo instanceof \ SplFileInfo ) { if ( $ fileInfo -> isFile ( ) && $ fileInfo -> getExtension ( ) == 'php' ) { $ this -> addPluginFromFile ( $ fileInfo ) ; } } } } | Load plugin information from a given list of files . |
45,516 | protected function addPluginFromFile ( \ SplFileInfo $ fileInfo ) { $ class = $ this -> getFullClassFromFile ( $ fileInfo ) ; if ( ! is_null ( $ class ) ) { $ newPlugin = new \ stdClass ( ) ; $ newPlugin -> class = $ class ; $ newPlugin -> source = "core" ; $ parts = explode ( '\\' , $ newPlugin -> class ) ; $ newPlugi... | Add a plugin to the list from a given file . |
45,517 | protected function getFullClassFromFile ( \ SplFileInfo $ fileInfo ) { $ contents = file_get_contents ( $ fileInfo -> getRealPath ( ) ) ; $ matches = array ( ) ; preg_match ( '#class +([A-Za-z]+) +implements#i' , $ contents , $ matches ) ; if ( isset ( $ matches [ 1 ] ) ) { $ className = $ matches [ 1 ] ; $ matches = a... | Determine plugin class name for a given file . |
45,518 | public function execute ( ) { $ url = PHPCI_URL . "build/view/" . $ this -> build -> getId ( ) ; $ message = str_replace ( "%buildurl%" , $ url , $ this -> message ) ; $ this -> joinRoom ( $ this -> roomId ) ; $ status = $ this -> speak ( $ message , $ this -> roomId ) ; $ this -> leaveRoom ( $ this -> roomId ) ; retur... | Run the Campfire plugin . |
45,519 | public function speak ( $ message , $ roomId , $ isPaste = false ) { $ page = '/room/' . $ roomId . '/speak.json' ; if ( $ isPaste ) { $ type = 'PasteMessage' ; } else { $ type = 'TextMessage' ; } return $ this -> getPageByPost ( $ page , array ( 'message' => array ( 'type' => $ type , 'body' => $ message ) ) ) ; } | Send a message to a campfire room . |
45,520 | private function getPageByPost ( $ page , $ data = null ) { $ url = $ this -> url . $ page ; $ json = json_encode ( $ data ) ; $ handle = curl_init ( ) ; curl_setopt ( $ handle , CURLOPT_URL , $ url ) ; curl_setopt ( $ handle , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ handle , CURLOPT_POST , 1 ) ; curl_setopt ... | Make a request to Campfire . |
45,521 | public function index ( ) { $ this -> requireAdmin ( ) ; $ this -> layout -> title = Lang :: get ( 'settings' ) ; $ this -> view -> settings = $ this -> settings ; $ basicSettings = array ( ) ; if ( isset ( $ this -> settings [ 'phpci' ] [ 'basic' ] ) ) { $ basicSettings = $ this -> settings [ 'phpci' ] [ 'basic' ] ; }... | Display settings forms . |
45,522 | public function github ( ) { $ this -> requireAdmin ( ) ; $ this -> settings [ 'phpci' ] [ 'github' ] [ 'id' ] = $ this -> getParam ( 'githubid' , '' ) ; $ this -> settings [ 'phpci' ] [ 'github' ] [ 'secret' ] = $ this -> getParam ( 'githubsecret' , '' ) ; $ error = $ this -> storeSettings ( ) ; $ response = new b8 \ ... | Save Github settings . |
45,523 | public function githubCallback ( ) { $ code = $ this -> getParam ( 'code' , null ) ; $ github = $ this -> settings [ 'phpci' ] [ 'github' ] ; if ( ! is_null ( $ code ) ) { $ http = new HttpClient ( ) ; $ url = 'https://github.com/login/oauth/access_token' ; $ params = array ( 'client_id' => $ github [ 'id' ] , 'client_... | Github redirects users back to this URL when t |
45,524 | protected function storeSettings ( ) { $ dumper = new Dumper ( ) ; $ yaml = $ dumper -> dump ( $ this -> settings , 4 ) ; file_put_contents ( PHPCI_CONFIG_FILE , $ yaml ) ; if ( error_get_last ( ) ) { $ error_get_last = error_get_last ( ) ; return $ error_get_last [ 'message' ] ; } } | Convert config to yaml and store to file . |
45,525 | protected function getGithubForm ( ) { $ form = new Form ( ) ; $ form -> setMethod ( 'POST' ) ; $ form -> setAction ( PHPCI_URL . 'settings/github' ) ; $ form -> addField ( new Form \ Element \ Csrf ( 'csrf' ) ) ; $ field = new Form \ Element \ Text ( 'githubid' ) ; $ field -> setRequired ( true ) ; $ field -> setPatte... | Get the Github settings form . |
45,526 | protected function getBuildForm ( $ values = array ( ) ) { $ form = new Form ( ) ; $ form -> setMethod ( 'POST' ) ; $ form -> setAction ( PHPCI_URL . 'settings/build' ) ; $ field = new Form \ Element \ Select ( 'failed_after' ) ; $ field -> setRequired ( false ) ; $ field -> setLabel ( Lang :: get ( 'failed_after' ) ) ... | Get the Build settings form . |
45,527 | protected function getBasicForm ( $ values = array ( ) ) { $ form = new Form ( ) ; $ form -> setMethod ( 'POST' ) ; $ form -> setAction ( PHPCI_URL . 'settings/basic' ) ; $ field = new Form \ Element \ Select ( 'language' ) ; $ field -> setRequired ( true ) ; $ field -> setLabel ( Lang :: get ( 'language' ) ) ; $ field... | Get the Basic settings form . |
45,528 | protected function getAuthenticationForm ( $ values = array ( ) ) { $ form = new Form ( ) ; $ form -> setMethod ( 'POST' ) ; $ form -> setAction ( PHPCI_URL . 'settings/authentication' ) ; $ form -> addField ( new Form \ Element \ Csrf ( 'csrf' ) ) ; $ field = new Form \ Element \ Checkbox ( 'disable_authentication' ) ... | Form for disabling user authentication while using a default user |
45,529 | public function execute ( ) { if ( ! file_exists ( $ this -> location ) ) { mkdir ( $ this -> location ) ; } if ( ! is_writable ( $ this -> location ) ) { throw new \ Exception ( sprintf ( 'The location %s is not writable or does not exist.' , $ this -> location ) ) ; } $ pdepend = $ this -> phpci -> findBinary ( 'pdep... | Runs Pdepend with the given criteria as arguments |
45,530 | protected function removeBuildArtifacts ( ) { foreach ( array ( $ this -> summary , $ this -> chart , $ this -> pyramid ) as $ file ) { if ( file_exists ( $ this -> location . DIRECTORY_SEPARATOR . $ file ) ) { unlink ( $ this -> location . DIRECTORY_SEPARATOR . $ file ) ; } } } | Remove files created from previous builds |
45,531 | public static function getBuild ( Build $ build ) { $ project = $ build -> getProject ( ) ; if ( ! empty ( $ project ) ) { switch ( $ project -> getType ( ) ) { case 'remote' : $ type = 'RemoteGitBuild' ; break ; case 'local' : $ type = 'LocalBuild' ; break ; case 'github' : $ type = 'GithubBuild' ; break ; case 'bitbu... | Takes a generic build and returns a type - specific build model . |
45,532 | public static function get ( $ string ) { $ vars = func_get_args ( ) ; if ( array_key_exists ( $ string , self :: $ strings ) ) { $ vars [ 0 ] = self :: $ strings [ $ string ] ; return call_user_func_array ( 'sprintf' , $ vars ) ; } return '%%MISSING STRING: ' . $ string . '%%' ; } | Get a specific string from the language file . |
45,533 | public static function setLanguage ( $ language ) { if ( in_array ( $ language , self :: $ languages ) ) { self :: $ language = $ language ; self :: $ strings = self :: loadLanguage ( ) ; return true ; } return false ; } | Try and load a language and if successful set it for use throughout the system . |
45,534 | public static function getLanguageOptions ( ) { $ languages = array ( ) ; foreach ( self :: $ languages as $ language ) { $ strings = array ( ) ; require ( PHPCI_DIR . 'PHPCI/Languages/lang.' . $ language . '.php' ) ; $ languages [ $ language ] = $ strings [ 'language_name' ] ; } return $ languages ; } | Return a list of available languages and their names . |
45,535 | public static function init ( Config $ config ) { self :: loadAvailableLanguages ( ) ; if ( isset ( $ _COOKIE ) && array_key_exists ( 'phpcilang' , $ _COOKIE ) && self :: setLanguage ( $ _COOKIE [ 'phpcilang' ] ) ) { return ; } if ( isset ( $ _SERVER ) && array_key_exists ( 'HTTP_ACCEPT_LANGUAGE' , $ _SERVER ) ) { $ la... | Initialise the Language helper try load the language file for the user s browser or the configured default . |
45,536 | protected static function loadLanguage ( ) { $ langFile = PHPCI_DIR . 'PHPCI/Languages/lang.' . self :: $ language . '.php' ; if ( ! file_exists ( $ langFile ) ) { return null ; } require ( $ langFile ) ; if ( is_null ( $ strings ) || ! is_array ( $ strings ) || ! count ( $ strings ) ) { return null ; } return $ string... | Load a specific language file . |
45,537 | protected static function loadAvailableLanguages ( ) { $ matches = array ( ) ; foreach ( glob ( PHPCI_DIR . 'PHPCI/Languages/lang.*.php' ) as $ file ) { if ( preg_match ( '/lang\.([a-z]{2}\-?[a-z]*)\.php/' , $ file , $ matches ) ) { self :: $ languages [ ] = $ matches [ 1 ] ; } } } | Load the names of all available languages . |
45,538 | public static function formatDateTime ( \ DateTime $ dateTime , $ format = 'lll' ) { return sprintf ( '<time datetime="%s" data-format="%s">%s</time>' , $ dateTime -> format ( \ DateTime :: ISO8601 ) , $ format , $ dateTime -> format ( \ DateTime :: RFC2822 ) ) ; } | Create a time tag for localization . |
45,539 | protected function setOptions ( $ options ) { foreach ( array ( 'directory' , 'path' , 'ignore' , 'allowed_errors' ) as $ key ) { if ( array_key_exists ( $ key , $ options ) ) { $ this -> { $ key } = $ options [ $ key ] ; } } } | Handle this plugin s options . |
45,540 | public function execute ( ) { $ success = true ; $ this -> phpci -> logExecOutput ( false ) ; $ errorCount = $ this -> getErrorList ( ) ; $ this -> phpci -> log ( "Found $errorCount instances of " . implode ( ', ' , $ this -> searches ) ) ; $ this -> build -> storeMeta ( 'technical_debt-warnings' , $ errorCount ) ; if ... | Runs the plugin |
45,541 | public function getErrorList ( ) { $ dirIterator = new \ RecursiveDirectoryIterator ( $ this -> directory ) ; $ iterator = new \ RecursiveIteratorIterator ( $ dirIterator , \ RecursiveIteratorIterator :: SELF_FIRST ) ; $ files = array ( ) ; $ ignores = $ this -> ignore ; $ ignores [ ] = 'phpci.yml' ; $ ignores [ ] = '.... | Gets the number and list of errors returned from the search |
45,542 | public function handleAction ( $ action , $ actionParams ) { $ response = new b8 \ Http \ Response \ JsonResponse ( ) ; try { $ data = parent :: handleAction ( $ action , $ actionParams ) ; if ( isset ( $ data [ 'responseCode' ] ) ) { $ response -> setResponseCode ( $ data [ 'responseCode' ] ) ; unset ( $ data [ 'respo... | Handle the action Ensuring to return a JsonResponse . |
45,543 | public function bitbucket ( $ projectId ) { $ project = $ this -> fetchProject ( $ projectId , 'bitbucket' ) ; if ( $ payload = $ this -> getParam ( 'payload' ) ) { return $ this -> bitbucketService ( json_decode ( $ payload , true ) , $ project ) ; } $ payload = json_decode ( file_get_contents ( "php://input" ) , true... | Called by Bitbucket . |
45,544 | protected function bitbucketWebhook ( $ payload , $ project ) { $ results = array ( ) ; $ status = 'failed' ; foreach ( $ payload [ 'push' ] [ 'changes' ] as $ commit ) { try { $ email = $ commit [ 'new' ] [ 'target' ] [ 'author' ] [ 'raw' ] ; $ email = substr ( $ email , 0 , strpos ( $ email , '>' ) ) ; $ email = subs... | Bitbucket webhooks . |
45,545 | protected function bitbucketService ( $ payload , $ project ) { $ payload = json_decode ( $ this -> getParam ( 'payload' ) , true ) ; $ results = array ( ) ; $ status = 'failed' ; foreach ( $ payload [ 'commits' ] as $ commit ) { try { $ email = $ commit [ 'raw_author' ] ; $ email = substr ( $ email , 0 , strpos ( $ em... | Bitbucket POST service . |
45,546 | protected function githubCommitRequest ( Project $ project , array $ payload ) { if ( array_key_exists ( 'after' , $ payload ) && $ payload [ 'after' ] === '0000000000000000000000000000000000000000' ) { return array ( 'status' => 'ignored' ) ; } if ( isset ( $ payload [ 'commits' ] ) && is_array ( $ payload [ 'commits'... | Handle the payload when Github sends a commit webhook . |
45,547 | protected function githubPullRequest ( Project $ project , array $ payload ) { if ( ! in_array ( $ payload [ 'action' ] , array ( 'opened' , 'synchronize' , 'reopened' ) ) ) { return array ( 'status' => 'ok' ) ; } $ headers = array ( ) ; $ token = \ b8 \ Config :: getInstance ( ) -> get ( 'phpci.github.token' ) ; if ( ... | Handle the payload when Github sends a Pull Request webhook . |
45,548 | protected function createBuild ( Project $ project , $ commitId , $ branch , $ committer , $ commitMessage , bool $ rebuild = false , array $ extra = null ) { if ( ! $ rebuild ) { $ builds = $ this -> buildStore -> getByProjectAndCommit ( $ project -> getId ( ) , $ commitId ) ; if ( $ builds [ 'count' ] ) { return arra... | Wrapper for creating a new build . |
45,549 | protected function fetchProject ( $ projectId , $ expectedType ) { $ project = $ this -> projectStore -> getById ( $ projectId ) ; if ( empty ( $ project ) ) { throw new Exception ( 'Project does not exist: ' . $ projectId ) ; } if ( is_array ( $ expectedType ) ? ! in_array ( $ project -> getType ( ) , $ expectedType )... | Fetch a project and check its type . |
45,550 | protected function execute ( InputInterface $ input , OutputInterface $ output ) { $ userService = new UserService ( $ this -> userStore ) ; $ dialog = $ this -> getHelperSet ( ) -> get ( 'dialog' ) ; $ mailValidator = function ( $ answer ) { if ( ! filter_var ( $ answer , FILTER_VALIDATE_EMAIL ) ) { throw new \ Invali... | Creates an admin user in the existing PHPCI database |
45,551 | public function getById ( $ value , $ useConnection = 'read' ) { if ( is_null ( $ value ) ) { throw new HttpException ( 'Value passed to ' . __FUNCTION__ . ' cannot be null.' ) ; } $ query = 'SELECT * FROM `build` WHERE `id` = :id LIMIT 1' ; $ stmt = Database :: getConnection ( $ useConnection ) -> prepare ( $ query ) ... | Get a single Build by Id . |
45,552 | public function getByProjectId ( $ value , $ limit = 1000 , $ useConnection = 'read' ) { if ( is_null ( $ value ) ) { throw new HttpException ( 'Value passed to ' . __FUNCTION__ . ' cannot be null.' ) ; } $ query = 'SELECT * FROM `build` WHERE `project_id` = :project_id LIMIT :limit' ; $ stmt = Database :: getConnectio... | Get multiple Build by ProjectId . |
45,553 | public function execute ( ) { $ body = $ this -> phpci -> interpolate ( $ this -> message ) ; $ client = new \ Maknz \ Slack \ Client ( $ this -> webHook ) ; $ message = $ client -> createMessage ( ) ; if ( ! empty ( $ this -> room ) ) { $ message -> setChannel ( $ this -> room ) ; } if ( ! empty ( $ this -> username )... | Run the Slack plugin . |
45,554 | public function execute ( ) { $ hipChat = new \ HipChat \ HipChat ( $ this -> authToken ) ; $ message = $ this -> phpci -> interpolate ( $ this -> message ) ; $ result = true ; if ( is_array ( $ this -> room ) ) { foreach ( $ this -> room as $ room ) { if ( ! $ hipChat -> message_room ( $ room , 'PHPCI' , $ message , $... | Run the HipChat plugin . |
45,555 | public function execute ( ) { $ curdir = getcwd ( ) ; chdir ( $ this -> phpci -> buildPath ) ; $ behat = $ this -> executable ; if ( ! $ behat ) { $ this -> phpci -> logFailure ( Lang :: get ( 'could_not_find' , 'behat' ) ) ; return false ; } $ success = $ this -> phpci -> executeCommand ( $ behat . ' %s' , $ this -> f... | Runs Behat tests . |
45,556 | public function parseBehatOutput ( ) { $ output = $ this -> phpci -> getLastOutput ( ) ; $ parts = explode ( '---' , $ output ) ; if ( count ( $ parts ) <= 1 ) { return array ( 0 , array ( ) ) ; } $ lines = explode ( PHP_EOL , $ parts [ 1 ] ) ; $ storeFailures = false ; $ data = array ( ) ; foreach ( $ lines as $ line ... | Parse the behat output and return details on failures |
45,557 | public function getPreviousBuild ( $ branch = 'master' ) { $ criteria = array ( 'branch' => $ branch , 'project_id' => $ this -> getId ( ) ) ; $ order = array ( 'id' => 'DESC' ) ; $ builds = Store \ Factory :: getStore ( 'Build' ) -> getWhere ( $ criteria , 1 , 1 , array ( ) , $ order ) ; if ( is_array ( $ builds [ 'it... | Return the previous build from a specific branch for this project . |
45,558 | public function setAccessInformation ( $ value ) { if ( is_array ( $ value ) ) { $ value = json_encode ( $ value ) ; } parent :: setAccessInformation ( $ value ) ; } | Store this project s access_information data |
45,559 | public function getAccessInformation ( $ key = null ) { $ info = $ this -> data [ 'access_information' ] ; if ( ! empty ( $ info ) && ! in_array ( substr ( $ info , 0 , 1 ) , array ( '{' , '[' ) ) ) { $ data = unserialize ( $ info ) ; } else { $ data = json_decode ( $ info , true ) ; } if ( is_null ( $ key ) ) { $ rtn ... | Get this project s access_information data . Pass a specific key or null for all data . |
45,560 | public function logout ( ) { unset ( $ _SESSION [ 'phpci_user' ] ) ; unset ( $ _SESSION [ 'phpci_user_id' ] ) ; session_destroy ( ) ; $ response = new b8 \ Http \ Response \ RedirectResponse ( ) ; $ response -> setHeader ( 'Location' , PHPCI_URL ) ; return $ response ; } | Handles user logout . |
45,561 | public function forgotPassword ( ) { if ( $ this -> request -> getMethod ( ) == 'POST' ) { $ email = $ this -> getParam ( 'email' , null ) ; $ user = $ this -> userStore -> getByEmail ( $ email ) ; if ( empty ( $ user ) ) { $ this -> view -> error = Lang :: get ( 'reset_no_user_exists' ) ; return $ this -> view -> rend... | Allows the user to request a password reset email . |
45,562 | public function resetPassword ( $ userId , $ key ) { $ user = $ this -> userStore -> getById ( $ userId ) ; $ userKey = md5 ( date ( 'Y-m-d' ) . $ user -> getHash ( ) ) ; if ( empty ( $ user ) || $ key != $ userKey ) { $ this -> view -> error = Lang :: get ( 'reset_invalid' ) ; return $ this -> view -> render ( ) ; } i... | Allows the user to change their password after a password reset email . |
45,563 | protected function getLoginRedirect ( ) { $ rtn = PHPCI_URL ; if ( ! empty ( $ _SESSION [ 'phpci_login_redirect' ] ) ) { $ rtn .= $ _SESSION [ 'phpci_login_redirect' ] ; $ _SESSION [ 'phpci_login_redirect' ] = null ; } return $ rtn ; } | Get the URL the user was trying to go to prior to being asked to log in . |
45,564 | protected function lintFile ( $ php , $ path ) { $ success = true ; if ( ! $ this -> phpci -> executeCommand ( $ php . ' -l "%s"' , $ this -> phpci -> buildPath . $ path ) ) { $ this -> phpci -> logFailure ( $ path ) ; $ success = false ; } return $ success ; } | Run php - l against a specific file . |
45,565 | public static function routes ( $ callback = null , array $ options = [ ] ) { if ( $ callback instanceof Application && preg_match ( '/5\.[5-8]\..*/' , $ callback -> version ( ) ) ) $ callback = $ callback -> router ; $ callback = $ callback ? : function ( $ router ) { $ router -> all ( ) ; } ; $ defaultOptions = [ 'pr... | Get a Passport route registrar . |
45,566 | protected function revokeOrDeleteAccessTokens ( Token $ token , $ tokenId ) { $ query = Token :: where ( 'user_id' , $ token -> user_id ) -> where ( 'client_id' , $ token -> client_id ) ; if ( $ tokenId ) { $ query -> where ( 'id' , '<>' , $ tokenId ) ; } if ( Passport :: $ pruneRevokedTokens ) { $ query -> delete ( ) ... | Revoke the user s other access tokens for the client . |
45,567 | public function getUrl ( ) { $ request = clone request ( ) ; $ request -> merge ( [ $ this -> getName ( ) => $ this -> getValue ( ) , 'page' => 1 , ] ) ; $ so = app ( 'sleeping_owl' ) ; return $ so -> getModel ( $ this -> getRelatedModel ( ) ) -> getDisplayUrl ( $ request -> all ( ) ) ; } | Get filter url . |
45,568 | public function initialize ( ) { parent :: initialize ( ) ; $ this -> setHtmlAttributes ( $ this -> getHtmlAttributes ( ) + [ 'name' => 'next_action' , 'class' => 'btn btn-danger btn-delete' , 'data-url' => $ this -> getModelConfiguration ( ) -> getDeleteUrl ( $ this -> getModel ( ) -> getKey ( ) ) , 'data-redirect' =>... | Init Delete Button . |
45,569 | public function canShow ( ) { if ( is_null ( $ this -> getModel ( ) -> getKey ( ) ) ) { return false ; } $ this -> show = ! $ this -> isTrashed ( ) && $ this -> getModelConfiguration ( ) -> isDeletable ( $ this -> getModel ( ) ) ; return parent :: canShow ( ) ; } | Show policy . |
45,570 | public function initialize ( ) { parent :: initialize ( ) ; $ this -> setHtmlAttributes ( $ this -> getHtmlAttributes ( ) + [ 'type' => 'submit' , 'name' => 'next_action' , 'class' => 'btn btn-warning' , 'data-url' => $ this -> getModelConfiguration ( ) -> getRestoreUrl ( $ this -> getModel ( ) -> getKey ( ) ) , 'data-... | Init Restore Button . |
45,571 | public function initialize ( ) { if ( is_null ( $ value = $ this -> getValue ( ) ) ) { $ value = request ( ) -> input ( $ this -> getAlias ( ) ) ; } $ this -> setValue ( $ value ) ; } | Initialize filter . |
45,572 | public static function registerRoutes ( Router $ router ) { $ routeName = 'admin.display.async' ; if ( ! $ router -> has ( $ routeName ) ) { $ router -> get ( '{adminModel}/async/{adminDisplayName?}' , [ 'as' => $ routeName , 'uses' => 'SleepingOwl\Admin\Http\Controllers\DisplayController@async' , ] ) ; } $ routeName =... | Register display routes . |
45,573 | public function renderAsync ( \ Illuminate \ Http \ Request $ request ) { $ query = $ this -> getRepository ( ) -> getQuery ( ) ; $ totalCount = $ query -> count ( ) ; $ filteredCount = 0 ; if ( ! is_null ( $ this -> distinct ) ) { $ filteredCount = $ query -> distinct ( ) -> count ( $ this -> getDistinct ( ) ) ; } $ t... | Render async request . |
45,574 | public function applyOffset ( $ query , \ Illuminate \ Http \ Request $ request ) { $ offset = $ request -> input ( 'start' , 0 ) ; $ limit = $ request -> input ( 'length' , 10 ) ; if ( $ limit == - 1 ) { return ; } $ query -> offset ( ( int ) $ offset ) -> limit ( ( int ) $ limit ) ; } | Apply offset and limit to the query . |
45,575 | public function applySearch ( Builder $ query , \ Illuminate \ Http \ Request $ request ) { $ search = $ request -> input ( 'search.value' ) ; if ( empty ( $ search ) ) { return ; } $ query -> where ( function ( Builder $ query ) use ( $ search ) { $ columns = $ this -> getColumns ( ) -> all ( ) ; foreach ( $ columns a... | Apply search to the query . |
45,576 | protected function prepareDatatablesStructure ( \ Illuminate \ Http \ Request $ request , Collection $ collection , $ totalCount , $ filteredCount ) { $ columns = $ this -> getColumns ( ) ; $ result = [ ] ; $ result [ 'draw' ] = $ request -> input ( 'draw' , 0 ) ; $ result [ 'recordsTotal' ] = $ totalCount ; $ result [... | Convert collection to the datatables structure . |
45,577 | public function getModelValue ( ) { if ( ! is_callable ( $ callback = $ this -> getCallback ( ) ) ) { throw new \ Exception ( 'Invalid custom column callback' ) ; } return call_user_func ( $ callback , $ this -> getModel ( ) ) ; } | Get value from callback . |
45,578 | public function setId ( $ id ) { if ( is_null ( $ this -> id ) && ! is_null ( $ id ) && ( $ model = $ this -> getRepository ( ) -> find ( $ id ) ) ) { $ this -> id = $ id ; parent :: setModel ( $ model ) ; $ this -> getButtons ( ) -> setModel ( $ model ) ; $ this -> setModelClass ( get_class ( $ model ) ) ; } } | Set currently loaded model id . |
45,579 | public function getModelConfiguration ( ) { $ class = $ this -> class ; if ( is_null ( $ class ) && $ this -> getModel ( ) instanceof Model ) { $ class = $ this -> getModel ( ) ; } return app ( 'sleeping_owl' ) -> getModel ( $ class ) ; } | Get related form model configuration . |
45,580 | public function saveForm ( \ Illuminate \ Http \ Request $ request , ModelConfigurationInterface $ modelConfiguration = null ) { if ( ! $ this -> validModelConfiguration ( $ modelConfiguration ) ) { return false ; } $ model = $ this -> getModel ( ) ; $ loaded = $ model -> exists ; if ( $ this -> getModelConfiguration (... | Save instance . |
45,581 | public function setFetchColumns ( $ columns ) { if ( ! is_array ( $ columns ) ) { $ columns = func_get_args ( ) ; } $ this -> fetchColumns = $ columns ; return $ this ; } | Set Only fetch columns . |
45,582 | public function getValidationRules ( ) { $ rules = parent :: getValidationRules ( ) ; foreach ( $ rules as & $ rule ) { if ( $ rule !== '_unique' ) { continue ; } $ model = $ this -> resolvePath ( ) ; $ table = $ model -> getTable ( ) ; $ rule = 'unique:' . $ table . ',' . $ this -> getModelAttributeKey ( ) ; if ( $ mo... | If FormElement has _unique rule it will get all appropriate validation rules based on underlying model . |
45,583 | public function resolvePath ( ) { $ model = $ this -> getModel ( ) ; $ relations = explode ( '.' , $ this -> getPath ( ) ) ; $ count = count ( $ relations ) ; if ( $ count === 1 ) { return $ model ; } foreach ( $ relations as $ relation ) { if ( $ count === 1 ) { return $ model ; } if ( $ model -> exists && ( $ value =... | Get model related to form element . |
45,584 | public function initialize ( ) { parent :: initialize ( ) ; $ this -> setUrl ( $ this -> getModelConfiguration ( ) -> getCancelUrl ( ) ) ; $ this -> setHtmlAttributes ( $ this -> getHtmlAttributes ( ) + [ 'class' => 'btn btn-warning' , ] ) ; } | Init Cancel Button . |
45,585 | public function addJs ( $ handle = false , $ src = null , $ dependency = null , $ footer = true ) { return parent :: addJs ( $ handle , $ src , $ dependency , $ footer ) ; } | Gets or sets javascript assets . |
45,586 | public function find ( $ id ) { $ query = $ this -> getQuery ( ) ; if ( $ this -> isRestorable ( ) ) { $ query -> withTrashed ( ) ; } return $ query -> find ( $ id ) ; } | Find model instance by id . |
45,587 | public function findMany ( array $ ids ) { $ query = $ this -> getQuery ( ) ; if ( $ this -> isRestorable ( ) ) { $ query -> withTrashed ( ) ; } return $ query -> whereIn ( $ this -> getModel ( ) -> getKeyName ( ) , $ ids ) -> get ( ) ; } | Find model instances by ids . |
45,588 | protected function getAliasesByExtendsNamespace ( ) { $ aliases = $ this -> getValidAliases ( ) ; $ aliases = $ aliases -> filter ( function ( Alias $ item ) { return ! collect ( [ 'MessageStack' , 'AdminSection' , 'AdminTemplate' , 'AdminNavigation' , 'AdminColumn' , 'AdminColumnEditable' , 'AdminColumnFilter' , 'Admi... | Regroup aliases by namespace of extended classes . |
45,589 | public function setModel ( Model $ model ) { if ( ( $ content = $ this -> getContent ( ) ) instanceof WithModelInterface ) { $ content -> setModel ( $ model ) ; } return $ this ; } | Set currently rendered instance . |
45,590 | protected function recursiveReorder ( $ root , $ parentId , $ left ) { $ right = $ left + 1 ; $ children = array_get ( $ root , 'children' , [ ] ) ; foreach ( $ children as $ child ) { $ right = $ this -> recursiveReorder ( $ child , $ root [ 'id' ] , $ right ) ; } $ this -> move ( $ root [ 'id' ] , $ parentId , $ left... | Recursive reorder nested - set tree type . |
45,591 | protected function move ( $ id , $ parentId , $ left , $ right ) { $ instance = $ this -> repository -> find ( $ id ) ; $ attributes = $ instance -> getAttributes ( ) ; $ attributes [ $ this -> getLeftColumn ( $ instance ) ] = $ left ; $ attributes [ $ this -> getRightColumn ( $ instance ) ] = $ right ; $ attributes [ ... | Move tree node in nested - set tree type . |
45,592 | protected function loadRelationOrder ( Builder $ query , $ direction ) { $ relations = collect ( explode ( '.' , $ this -> name ) ) ; $ loop = 0 ; if ( $ relations -> count ( ) >= 2 ) { $ query -> select ( $ query -> getModel ( ) -> getTable ( ) . '.*' ) ; do { $ model = ! $ loop ++ ? $ query -> getModel ( ) : $ relati... | Load Relations by this - > name . |
45,593 | protected function loadBelongsTo ( Collection $ relations , BelongsTo $ relationClass , Model $ relationModel , Model $ model , Builder $ query , $ direction ) { $ foreignKey = $ relationClass -> getOwnerKey ( ) ; $ ownerKey = $ relationClass -> getForeignKey ( ) ; $ ownerTable = $ model -> getTable ( ) ; $ foreignTabl... | Load keys for BelongsTo . |
45,594 | protected function prepareRequestToBeCopied ( Request $ request ) { $ remove = [ ] ; if ( $ request -> method ( ) === 'POST' && $ request -> input ( 'next_action' ) === 'save_and_create' ) { if ( ! $ this -> copyAfterSave ) { $ remove [ ] = $ this -> relationName ; } $ this -> makeCopyOfRelations ( $ request ) ; } retu... | Removes relation from request when it s in save_and_create mode . |
45,595 | protected function makeCopyOfRelations ( \ Illuminate \ Http \ Request $ request ) { $ newData = [ ] ; $ data = $ request -> input ( $ this -> relationName , [ ] ) ; $ counter = 1 ; $ newKey = static :: NEW_ITEM ; foreach ( $ data as $ key => $ values ) { $ newData [ "{$newKey}_{$counter}" ] = $ values ; $ counter ++ ;... | Creates a copy of form relations . |
45,596 | protected static function bootOrderableModel ( ) { static :: creating ( function ( Model $ row ) { $ row -> updateOrderFieldOnCreate ( ) ; } ) ; static :: deleted ( function ( Model $ row ) { $ row -> updateOrderFieldOnDelete ( ) ; } ) ; if ( in_array ( "Illuminate\Database\Eloquent\SoftDeletes" , trait_uses_recursive ... | Boot trait . |
45,597 | protected function updateOrderFieldOnDelete ( ) { static :: orderModel ( ) -> where ( $ this -> getOrderField ( ) , '>' , $ this -> getOrderValue ( ) ) -> decrement ( $ this -> getOrderField ( ) ) ; } | Update order field on delete . |
45,598 | protected function updateOrderFieldOnRestore ( ) { static :: orderModel ( ) -> where ( $ this -> getOrderField ( ) , '>' , $ this -> getOrderValue ( ) ) -> increment ( $ this -> getOrderField ( ) ) ; } | Update order field on restore . |
45,599 | public function scopeOrderModel ( $ query ) { $ parentFields = $ this -> getParentFieldName ( ) ; if ( $ parentFields ) { $ parentFields = ( array ) $ parentFields ; foreach ( $ parentFields as $ parentFieldName ) { $ query -> where ( $ parentFieldName , $ this -> { $ parentFieldName } ) ; } } return $ query -> orderBy... | Order scope . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.