idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
54,000 | public function nexmo ( Request $ request ) { $ this -> validate ( $ request , [ 'nexmo_phone' => 'required|string' , 'nexmo_api_key' => 'required|string' , 'nexmo_api_secret' => 'required|string' , 'low' => 'required|boolean' , 'medium' => 'required|boolean' , 'high' => 'required|boolean' , ] ) ; Recipient :: create (... | Create a Nexmo recipient . |
54,001 | public function history ( ) { if ( is_null ( $ this -> history ) ) { $ this -> history = History :: where ( 'meta' , $ this -> getSafeName ( ) ) -> latest ( ) -> get ( ) ; } return $ this -> history ; } | Return an eloquent respresentation of the Witness history . |
54,002 | public function saveHistory ( $ status ) { try { History :: create ( [ 'type' => 'custom' , 'meta' => $ this -> getSafeName ( ) , 'value' => $ this -> getValue ( ) , 'record' => [ 'status' => $ status ] , ] ) ; } catch ( Exception $ e ) { $ this -> eye -> logger ( ) -> error ( 'Custom witness history save failed' , $ e... | Save the custom witness history . |
54,003 | public function checkHealth ( $ status ) { if ( $ status ) { if ( $ this -> eye -> status ( ) -> isSick ( 'custom_' . $ this -> getSafeName ( ) ) ) { $ this -> recovering ( ) ; $ this -> eye -> notifier ( ) -> alert ( new Passed ( $ this ) ) ; } $ this -> eye -> status ( ) -> setHealthy ( 'custom_' . $ this -> getSafeN... | Check the health of the custom witness . |
54,004 | public function debug ( $ message , $ data = null ) { if ( config ( 'eyewitness.debug' , false ) ) { Log :: debug ( 'Eyewitness: ' . $ message , [ 'data' => $ data ] ) ; } } | Capture a debug issue relating to Eyewitness . |
54,005 | public function show ( $ id ) { $ scheduler = Scheduler :: findOrFail ( $ id ) ; return view ( 'eyewitness::scheduler.show' ) -> withEye ( app ( Eye :: class ) ) -> withScheduler ( $ scheduler ) -> withHistories ( $ scheduler -> history ( ) -> simplePaginate ( config ( 'eyewitness.pagination_size' , 50 ) ) ) -> withTra... | Show the scheduler . |
54,006 | public function update ( Request $ request , $ id ) { $ scheduler = Scheduler :: findOrFail ( $ id ) ; $ this -> validate ( $ request , [ 'alert_on_missed' => 'required|boolean' , 'alert_on_fail' => 'required|boolean' , 'alert_run_time_greater_than' => 'required|numeric|min:0|max:9999' , 'alert_run_time_less_than' => '... | Update the scheduler . |
54,007 | public function destroy ( $ id ) { $ scheduler = Scheduler :: findOrFail ( $ id ) ; $ scheduler -> history ( ) -> delete ( ) ; $ scheduler -> delete ( ) ; return redirect ( route ( 'eyewitness.dashboard' ) . '#scheduler' ) -> withSuccess ( 'The scheduler has been deleted.' ) ; } | Destroy the scheduler . |
54,008 | public function handle ( ) { $ this -> info ( 'Starting Custom Witness command...' ) ; foreach ( $ this -> eye -> getCustomWitnesses ( true ) as $ witness ) { $ this -> info ( 'Running: ' . $ witness -> getSafeName ( ) ) ; $ status = $ this -> runWitness ( $ witness ) ; $ witness -> saveHistory ( $ status ) ; $ witness... | Execute the custom console command . |
54,009 | protected function runWitness ( $ witness ) { try { $ status = $ witness -> run ( ) ; $ status = ( $ status ) ? : false ; } catch ( Throwable $ t ) { $ status = false ; } return $ status ; } | Run the custom witness . |
54,010 | public function poll ( ) { $ latest = $ this -> eye -> api ( ) -> composer ( ) ; if ( is_null ( $ latest ) ) { return ; } History :: where ( 'type' , 'composer' ) -> delete ( ) ; History :: create ( [ 'type' => 'composer' , 'meta' => 'composer' , 'record' => $ latest ] ) ; if ( $ latest === [ ] ) { if ( $ this -> eye -... | Poll the Composer for its checks . |
54,011 | protected function filterResponse ( $ response ) { $ contentType = $ response -> getHeader ( 'Content-Type' ) ; if ( ! $ contentType || false === strpos ( $ contentType , 'charset=' ) ) { if ( preg_match ( '/\<meta[^\>]+charset *= *["\']?([a-zA-Z\-0-9]+)/i' , $ response -> getContent ( ) , $ matches ) ) { $ headers = $... | Reads response meta tags to guess content - type charset . |
54,012 | public function loadPhpFiles ( $ dir ) { $ files = Finder :: create ( ) -> files ( ) -> name ( '*.php' ) -> in ( $ dir ) ; foreach ( $ files as $ file ) { $ this -> loadFile ( $ file -> getRealpath ( ) ) ; } } | Scans a directory provided and includes all PHP files from it . All files will be parsed and aspects will be added . |
54,013 | public function verifyInvoked ( $ name , $ params = null ) { $ calls = $ this -> getCallsForMethod ( $ name ) ; $ separator = $ this -> callSyntax ( $ name ) ; if ( empty ( $ calls ) ) throw new fail ( sprintf ( $ this -> invokedFail , $ this -> className . $ separator . $ name , '' ) ) ; if ( is_array ( $ params ) ) {... | Verifies a method was invoked at least once . In second argument you can specify with which params method expected to be invoked ; |
54,014 | public function verifyNeverInvoked ( $ name , $ params = null ) { $ calls = $ this -> getCallsForMethod ( $ name ) ; $ separator = $ this -> callSyntax ( $ name ) ; if ( is_array ( $ params ) ) { if ( empty ( $ calls ) ) { return ; } foreach ( $ calls as $ args ) { if ( $ this -> onlyExpectedArguments ( $ params , $ ar... | Verifies that method was not called . In second argument with which arguments is not expected to be called . |
54,015 | public function redirect ( $ url , $ statusCode = 302 ) { $ context = Context :: getInstance ( ) ; header ( HTTPToolkit :: statusCodeHeader ( $ statusCode ) ) ; header ( HTTPToolkit :: locationHeader ( $ url ) ) ; throw new InterruptedActionException ( 'Interrupted action after a redirection' , $ context -> getModuleNa... | Redirect using the TAO FlowController implementation |
54,016 | public function forwardUrl ( $ url ) { $ uri = new Uri ( $ url ) ; $ query = $ uri -> getQuery ( ) ; $ queryParams = [ ] ; if ( strlen ( $ query ) > 0 ) { parse_str ( $ query , $ queryParams ) ; } switch ( $ this -> getPsrRequest ( ) -> getMethod ( ) ) { case 'GET' : $ params = $ this -> getPsrRequest ( ) -> getQueryPa... | Forward the action to execute regarding a URL The forward runs into tha same HTTP request unlike redirect . |
54,017 | public function searchInstances ( $ propertyFilters = [ ] , core_kernel_classes_Class $ topClazz = null , $ options = [ ] ) { $ returnValue = [ ] ; if ( ! is_null ( $ topClazz ) ) { $ returnValue = $ topClazz -> searchInstances ( $ propertyFilters , $ options ) ; } return ( array ) $ returnValue ; } | search the instances matching the filters in parameters |
54,018 | public function createInstance ( core_kernel_classes_Class $ clazz , $ label = '' ) { if ( empty ( $ label ) ) { $ label = $ this -> createUniqueLabel ( $ clazz ) ; } return core_kernel_classes_ResourceFactory :: create ( $ clazz , $ label , '' ) ; } | Instantiate an RDFs Class |
54,019 | public function createUniqueLabel ( core_kernel_classes_Class $ clazz , $ subClassing = false ) { if ( $ subClassing ) { $ labelBase = $ clazz -> getLabel ( ) . '_' ; $ count = count ( $ clazz -> getSubClasses ( ) ) + 1 ; } else { $ labelBase = $ clazz -> getLabel ( ) . ' ' ; $ count = count ( $ clazz -> getInstances (... | Short description of method createUniqueLabel |
54,020 | public function createSubClass ( core_kernel_classes_Class $ parentClazz , $ label = '' ) { if ( empty ( $ label ) ) { $ label = $ this -> createUniqueLabel ( $ parentClazz , true ) ; } return $ parentClazz -> createSubClass ( $ label , '' ) ; } | Subclass an RDFS Class |
54,021 | public function bindProperties ( core_kernel_classes_Resource $ instance , $ properties = [ ] ) { $ binder = new \ tao_models_classes_dataBinding_GenerisInstanceDataBinder ( $ instance ) ; $ binder -> bind ( $ properties ) ; return $ instance ; } | bind the given RDFS properties to the RDFS resource in parameter |
54,022 | public function cloneInstance ( core_kernel_classes_Resource $ instance , core_kernel_classes_Class $ clazz = null ) { if ( is_null ( $ clazz ) ) { $ types = $ instance -> getTypes ( ) ; $ clazz = current ( $ types ) ; } $ returnValue = $ this -> createInstance ( $ clazz ) ; if ( ! is_null ( $ returnValue ) ) { $ prope... | duplicate a resource |
54,023 | public function cloneClazz ( core_kernel_classes_Class $ sourceClazz , core_kernel_classes_Class $ newParentClazz = null , core_kernel_classes_Class $ topLevelClazz = null ) { $ returnValue = null ; if ( ! is_null ( $ sourceClazz ) && ! is_null ( $ newParentClazz ) ) { if ( ( is_null ( $ topLevelClazz ) ) ) { $ propert... | Clone a Class and move it under the newParentClazz |
54,024 | public function getPropertyDiff ( core_kernel_classes_Class $ sourceClass , core_kernel_classes_Class $ destinationClass ) { $ returnValue = array ( ) ; $ sourceProperties = $ sourceClass -> getProperties ( true ) ; $ destinationProperties = $ destinationClass -> getProperties ( true ) ; foreach ( $ sourceProperties as... | get the properties of the source class that are not in the destination |
54,025 | public function getTranslatedProperties ( core_kernel_classes_Resource $ instance , $ lang ) { $ returnValue = array ( ) ; try { foreach ( $ instance -> getTypes ( ) as $ clazz ) { foreach ( $ clazz -> getProperties ( true ) as $ property ) { if ( $ property -> isLgDependent ( ) || $ property -> getUri ( ) == OntologyR... | get the properties of an instance for a specific language |
54,026 | public function toArray ( core_kernel_classes_Class $ clazz ) { $ returnValue = array ( ) ; $ properties = $ clazz -> getProperties ( false ) ; foreach ( $ clazz -> getInstances ( false ) as $ instance ) { $ data = array ( ) ; foreach ( $ properties as $ property ) { $ data [ $ property -> getLabel ( ) ] = null ; $ val... | Format an RDFS Class to an array |
54,027 | public function toTree ( core_kernel_classes_Class $ clazz , array $ options = array ( ) ) { $ searchOptions = [ ] ; $ instances = ( isset ( $ options [ 'instances' ] ) ) ? $ options [ 'instances' ] : true ; $ chunk = ( isset ( $ options [ 'chunk' ] ) ) ? $ options [ 'chunk' ] : false ; $ browse = ( isset ( $ options [... | Format an RDFS Class to an array to be interpreted by the client tree This is a closed array format . |
54,028 | static public function getIndexById ( $ identifier ) { $ indexClass = new core_kernel_classes_Class ( OntologyIndex :: RDF_TYPE ) ; $ resources = $ indexClass -> searchInstances ( array ( OntologyIndex :: PROPERTY_INDEX_IDENTIFIER => $ identifier ) , array ( 'like' => false ) ) ; if ( count ( $ resources ) > 1 ) { thro... | Get an index by its unique index id |
54,029 | static public function getIndexes ( \ core_kernel_classes_Property $ property ) { $ indexUris = $ property -> getPropertyValues ( new \ core_kernel_classes_Property ( OntologyIndex :: PROPERTY_INDEX ) ) ; $ indexes = array ( ) ; foreach ( $ indexUris as $ indexUri ) { $ indexes [ ] = new OntologyIndex ( $ indexUri ) ; ... | Get all indexes of a property |
54,030 | protected function fetchUploadedFile ( $ form ) { $ file = '' ; if ( $ form instanceof \ tao_helpers_form_Form ) { $ fileInfo = $ form -> getValue ( 'source' ) ; $ file = $ form -> getValue ( 'importFile' ) ? : $ fileInfo [ 'uploaded_file' ] ; } else if ( isset ( $ form [ 'uploaded_file' ] ) ) { $ file = $ this -> getU... | Helps to get the uploaded file data during upload or during processing of the import task . |
54,031 | private function transfromArray ( $ values ) { if ( count ( $ values ) > 1 ) { $ encoded = array ( ) ; foreach ( $ values as $ value ) { $ encoded [ ] = $ this -> encodeValue ( $ value ) ; } return $ encoded ; } else { return $ this -> encodeValue ( reset ( $ values ) ) ; } } | Encode a values array |
54,032 | protected function encodeValue ( $ value , $ propertyUri = '' ) { $ value = $ this -> applyEncoder ( $ value , $ propertyUri ) ; return is_string ( $ value ) ? $ value : ( ( is_object ( $ value ) && $ value instanceof \ core_kernel_classes_Resource ) ? $ value -> getUri ( ) : ( string ) $ value ) ; } | Encode the value in a json - ld compatible way |
54,033 | protected function generateId ( $ uri ) { $ property = new \ core_kernel_classes_Property ( $ uri ) ; $ label = strtolower ( trim ( $ property -> getLabel ( ) ) ) ; $ label = preg_replace ( array ( '/\s/' , '[^a-z\-]' ) , array ( '-' , '' ) , $ label ) ; return empty ( $ label ) ? 'key' : $ label ; } | Generate a key for the property to use during export |
54,034 | protected function applyEncoder ( $ value , $ propertyUri = '' ) { if ( empty ( $ propertyUri ) === false ) { $ encoders = $ this -> getEncoders ( ) ; if ( isset ( $ encoders [ $ propertyUri ] ) === true ) { $ encodedValue = call_user_func ( $ encoders [ $ propertyUri ] , $ value ) ; return $ encodedValue ; } } return ... | Attempt to apply a specific value encoder . |
54,035 | public function getFileNameFromReport ( ) { $ filename = '' ; if ( $ this -> getStatus ( ) -> isFailed ( ) || is_null ( $ this -> getReport ( ) ) ) { return $ filename ; } foreach ( $ this -> getReport ( ) -> getSuccesses ( ) as $ successReport ) { $ data = $ successReport -> getData ( ) ; if ( is_string ( $ data ) ) {... | Returns the file name from the generated report . |
54,036 | public function completed ( ) { $ resource = $ this -> getActionExecution ( ) ; if ( $ resource === null ) { $ requiredActionClass = new \ core_kernel_classes_Class ( self :: CLASS_URI ) ; $ resource = $ requiredActionClass -> createInstanceWithProperties ( array ( self :: PROPERTY_SUBJECT => $ this -> getUser ( ) -> g... | Mark rule as executed and save time of completed . |
54,037 | protected function getExecutionTime ( ) { if ( $ this -> executionTime === null ) { $ resource = $ this -> getActionExecution ( ) ; if ( $ resource !== null ) { $ time = ( string ) $ resource -> getOnePropertyValue ( new \ core_kernel_classes_Property ( self :: PROPERTY_EXECUTION_TIME ) ) ; if ( ! empty ( $ time ) ) { ... | Get last execution time . If an action was not executed before returns null |
54,038 | public function actionSetConfig ( ) { $ configValue = $ this -> options [ 'configValue' ] ; $ configParam = $ this -> options [ 'configParameter' ] ; $ extensionId = $ this -> options [ 'extension' ] ; try { $ ext = common_ext_ExtensionsManager :: singleton ( ) -> getExtensionById ( $ extensionId ) ; $ currentConfig = ... | Sets a configuration parameter of an extension . The configuration to change is provided with the configParameter CLI argument and its is provided with the configValue CLI argument . The extension on which want to change a parameter value is provided with the extension CLI |
54,039 | public function error ( $ message , $ stopExec = false ) { if ( $ stopExec == true ) { $ this -> disconnect ( ) ; } $ this -> err ( $ message , $ stopExec ) ; } | Display an error message . If the stopExec parameter is set to true the of the script stops and the currently connected user is disconnected if It overrides the Runner - > err method for this purpose . |
54,040 | public function connect ( $ user , $ password ) { $ returnValue = ( bool ) false ; $ userService = tao_models_classes_UserService :: singleton ( ) ; $ returnValue = $ userService -> loginUser ( $ user , $ password ) ; $ this -> setConnected ( $ returnValue ) ; return ( bool ) $ returnValue ; } | Connect to the generis API by using the CLI arguments user and It returns true or false depending on the connection establishement . |
54,041 | public function disconnect ( ) { if ( $ this -> isConnected ( ) ) { $ this -> outVerbose ( "Disconnecting user..." ) ; $ userService = tao_models_classes_UserService :: singleton ( ) ; if ( $ userService -> logout ( ) == true ) { $ this -> outVerbose ( "User gracefully disconnected from TAO API." ) ; $ this -> setConne... | Disconnect the currently connected user . |
54,042 | public function actionInstall ( ) { $ extensionId = $ this -> options [ 'extension' ] ; $ importLocalData = $ this -> options [ 'data' ] ; try { $ this -> outVerbose ( "Locating extension '${extensionId}'..." ) ; $ extensionManager = common_ext_ExtensionsManager :: singleton ( ) ; $ ext = $ extensionManager -> getExten... | Short description of method actionInstall |
54,043 | public function checkInstallInput ( ) { $ defaults = array ( 'extension' => null , 'data' => true ) ; $ this -> options = array_merge ( $ defaults , $ this -> options ) ; if ( $ this -> options [ 'extension' ] == null ) { $ this -> error ( "Please provide the 'extension' parameter." , true ) ; } } | Short description of method checkInstallInput |
54,044 | public function validateMultiple ( $ xsds = array ( ) ) { $ returnValue = '' ; foreach ( $ xsds as $ xsd ) { $ this -> errors = array ( ) ; if ( $ this -> validate ( $ xsd ) ) { $ returnValue = $ xsd ; break ; } } return $ returnValue ; } | Excecute parser validation and stops at the first valid one and returns the identified schema |
54,045 | public function displayErrors ( $ htmlOutput = true ) { $ returnValue = ( string ) '' ; foreach ( $ this -> errors as $ error ) { $ returnValue .= $ error [ 'message' ] ; if ( isset ( $ error [ 'file' ] ) && isset ( $ error [ 'line' ] ) ) { $ returnValue .= ' in file ' . $ error [ 'file' ] . ', line ' . $ error [ 'line... | Short description of method displayErrors |
54,046 | protected function addError ( $ error ) { $ this -> valid = false ; if ( $ error instanceof Exception ) { $ this -> errors [ ] = array ( 'file' => $ error -> getFile ( ) , 'line' => $ error -> getLine ( ) , 'message' => "[" . get_class ( $ error ) . "] " . $ error -> getMessage ( ) ) ; } elseif ( $ error instanceof Lib... | Short description of method addError |
54,047 | public function getContent ( $ refresh = false ) { if ( $ this -> content === null || $ refresh ) { try { switch ( $ this -> sourceType ) { case self :: SOURCE_FILE : if ( ! file_exists ( $ this -> source ) ) { throw new Exception ( "File {$this->source} not found." ) ; } if ( ! is_readable ( $ this -> source ) ) { thr... | Get XML content . |
54,048 | public function getReport ( ) { if ( $ this -> isValid ( ) ) { return common_report_Report :: createSuccess ( '' ) ; } else { $ report = new common_report_Report ( '' ) ; foreach ( $ this -> getErrors ( ) as $ error ) { $ report -> add ( common_report_Report :: createFailure ( $ error [ 'message' ] ) ) ; } return $ rep... | Creates a report without title of the parsing result |
54,049 | public function completed ( $ context = null ) { $ rules = $ this -> getRules ( ) ; foreach ( $ rules as $ rule ) { $ rule -> completed ( $ context ) ; } } | Mark action as completed . |
54,050 | protected function checkRules ( $ context = null ) { $ rules = $ this -> getRules ( ) ; $ result = false ; foreach ( $ rules as $ rule ) { if ( $ rule -> check ( $ context ) ) { $ result = true ; break ; } } return $ result ; } | Check rules whether action must be performed . If at least one rule returns true the action will be performed . If result is true then action must be performed . |
54,051 | public function isLocked ( core_kernel_classes_Resource $ resource ) { $ values = $ resource -> getPropertyValues ( $ this -> getLockProperty ( ) ) ; if ( ( is_array ( $ values ) ) && ( count ( $ values ) > 0 ) ) { return true ; } return false ; } | return true is the resource is locked else otherwise |
54,052 | public function getLockData ( core_kernel_classes_Resource $ resource ) { $ values = $ resource -> getPropertyValues ( $ this -> getLockProperty ( ) ) ; if ( ( is_array ( $ values ) ) && ( count ( $ values ) == 1 ) ) { return OntoLockData :: getLockData ( array_pop ( $ values ) ) ; } else { return null ; } } | Return lock details |
54,053 | private function applyDataTableFilters ( ) { $ filters = $ this -> request -> getFilters ( ) ; foreach ( $ filters as $ fieldName => $ filterValue ) { if ( empty ( $ filterValue ) ) { continue ; } if ( is_array ( $ filterValue ) ) { $ this -> taskLogFilter -> in ( $ fieldName , $ filterValue ) ; continue ; } $ this -> ... | Add filter values from request to the taskLogFilter . |
54,054 | protected function setCookie ( $ name , $ value = null , $ expire = null , $ domainPath = null , $ https = null , $ httpOnly = null ) { return setcookie ( $ name , $ value , $ expire , $ domainPath , $ https , $ httpOnly ) ; } | Set cookie by setting the HTTP response header set - cookie |
54,055 | protected function setContentHeader ( $ contentType , $ charset = 'UTF-8' ) { $ this -> response = $ this -> getPsrResponse ( ) -> withHeader ( 'content-type' , $ contentType . ';' . $ charset ) ; return $ this ; } | Set content - type by setting the HTTP response header content - type |
54,056 | public static function getForm ( $ name = '' , array $ options = array ( ) ) { $ returnValue = null ; switch ( self :: $ renderMode ) { case 'xhtml' : $ myForm = new tao_helpers_form_xhtml_Form ( $ name , $ options ) ; $ myForm -> setDecorators ( array ( 'element' => new tao_helpers_form_xhtml_TagWrapper ( array ( 'tag... | Factors an instance of Form |
54,057 | public static function getElement ( $ name = '' , $ widgetId = '' ) { $ eltClass = null ; $ definition = WidgetRegistry :: getWidgetDefinitionById ( $ widgetId ) ; if ( is_null ( $ definition ) || ! isset ( $ definition [ 'renderers' ] [ self :: $ renderMode ] ) ) { $ candidate = "tao_helpers_form_elements_xhtml_{$widg... | Create dynamically a Form Element instance of the defined type |
54,058 | public static function getValidator ( $ name , $ options = array ( ) ) { $ returnValue = null ; $ clazz = 'tao_helpers_form_validators_' . $ name ; if ( class_exists ( $ clazz ) ) { $ returnValue = new $ clazz ( $ options ) ; } else { common_Logger :: w ( 'Unknown validator ' . $ name , array ( 'TAO' , 'FORM' ) ) ; } r... | Get an instance of a Validator |
54,059 | protected function process ( ) { $ sourceFp = $ this -> getSourceFp ( ) ; $ destinationFp = $ this -> getDestinationFp ( ) ; $ index = $ this -> getIndex ( ) ; $ duplicateCount = 0 ; foreach ( $ index as $ identifier => $ positions ) { if ( count ( $ positions ) > 1 ) { foreach ( $ positions as $ pos ) { rewind ( $ sou... | Duplicate extraction logic . |
54,060 | public function getXmlBase ( $ path ) { $ returnValue = ( string ) '' ; if ( ! isset ( $ this -> xmlBase [ $ path ] ) ) { throw new tao_helpers_translation_TranslationException ( 'Missing xmlBase for file ' . $ path ) ; } $ returnValue = $ this -> xmlBase [ $ path ] ; return ( string ) $ returnValue ; } | Short description of method getXmlBase |
54,061 | protected function getReportAttachment ( common_report_Report $ report ) { $ filename = null ; foreach ( $ report -> getSuccesses ( ) as $ success ) { if ( ! is_null ( $ filename = $ success -> getData ( ) ) ) { if ( is_array ( $ filename ) ) { $ filename = $ filename [ 'uriResource' ] ; } break ; } } return $ filename... | Extracts the path of the file attached to a report |
54,062 | protected function getFile ( $ fileUri ) { $ fileSystemService = $ this -> getServiceLocator ( ) -> get ( \ oat \ oatbox \ filesystem \ FileSystemService :: SERVICE_ID ) ; $ storageService = $ fileSystemService -> getFileSystem ( Queue :: FILE_SYSTEM_ID ) ; return $ storageService -> readStream ( $ fileUri ) ; } | Gets file from URI |
54,063 | public static function buildTree ( core_kernel_classes_Resource $ resource , core_kernel_classes_Property $ property ) { $ tree = new self ( $ resource , $ property ) ; $ range = $ property -> getRange ( ) ; $ tree -> setData ( 'rootNode' , $ range -> getUri ( ) ) ; $ tree -> setData ( 'dataUrl' , _url ( 'getData' , 'G... | Generates a form to define the values of a specific property for a resource |
54,064 | public function import ( array $ data , $ dryrun = false ) { try { $ injectors = $ this -> getInjectors ( ) ; } catch ( InconsistencyConfigException $ e ) { return \ common_report_Report :: createFailure ( 'Config problem: ' . $ e -> getMessage ( ) ) ; } $ report = \ common_report_Report :: createInfo ( 'Report of meta... | Main method to import Iterator data to Ontology object |
54,065 | protected function getInjectors ( ) { if ( empty ( $ this -> injectors ) ) { try { foreach ( array_keys ( $ this -> getOptions ( ) ) as $ injectorName ) { $ injector = $ this -> getSubService ( $ injectorName , Injector :: class ) ; $ injector -> createInjectorHelpers ( ) ; $ this -> injectors [ $ injectorName ] = $ in... | Get metadata injectors from config |
54,066 | public function out ( $ message , $ options = array ( ) ) { $ returnValue = $ this -> isCli ? $ this -> renderCliOutput ( $ message , $ options ) : $ this -> renderHtmlOutput ( $ message , $ options ) ; if ( $ this -> logOny ) { } else { echo $ returnValue ; } common_Logger :: i ( $ message , array ( 'SCRIPTS_RUNNER' )... | Short description of method out |
54,067 | protected function err ( $ message , $ stopExec = false ) { common_Logger :: e ( $ message ) ; echo $ this -> out ( $ message , array ( 'color' => 'light_red' ) ) ; if ( $ stopExec == true ) { $ this -> handleError ( new Exception ( $ message , 1 ) ) ; } } | Short description of method err |
54,068 | protected function handleError ( Exception $ e ) { if ( $ this -> isCli ) { $ errorCode = $ e -> getCode ( ) ; exit ( ( empty ( $ errorCode ) ) ? 1 : $ errorCode ) ; } else { throw new Exception ( $ e -> getMessage ( ) ) ; } } | Handles a fatal error situation . |
54,069 | protected function help ( ) { $ usage = "Usage:php {$this->argv[0]} [arguments]\n" ; $ usage .= "\nArguments list:\n" ; foreach ( $ this -> inputFormat [ 'parameters' ] as $ parameter ) { $ line = '' ; if ( isset ( $ parameter [ 'required' ] ) ) { if ( $ parameter [ 'required' ] == true ) { $ line .= "Required" ; } els... | Short description of method help |
54,070 | public function outVerbose ( $ message , $ options = array ( ) ) { common_Logger :: i ( $ message ) ; if ( isset ( $ this -> parameters [ 'verbose' ] ) && $ this -> parameters [ 'verbose' ] === true ) { $ this -> out ( $ message , $ options ) ; } } | Short description of method outVerbose |
54,071 | public function index ( ) { $ this -> defaultData ( ) ; $ userLangService = $ this -> getServiceLocator ( ) -> get ( UserLanguageServiceInterface :: class ) ; $ this -> setData ( 'user-data-lang-enabled' , $ userLangService -> isDataLanguageEnabled ( ) ) ; $ this -> setView ( 'user/list.tpl' ) ; } | Show the list of users |
54,072 | public function delete ( ) { $ userService = $ this -> getServiceLocator ( ) -> get ( tao_models_classes_UserService :: class ) ; $ tokenService = $ this -> getServiceLocator ( ) -> get ( TokenService :: SERVICE_ID ) ; $ tokenName = $ tokenService -> getTokenName ( ) ; $ token = $ this -> getRequestParameter ( $ tokenN... | Remove a user The request must contains the user s login to remove |
54,073 | public function add ( ) { $ this -> defaultData ( ) ; $ container = new tao_actions_form_Users ( $ this -> getClass ( TaoOntology :: CLASS_URI_TAO_USER ) ) ; $ form = $ container -> getForm ( ) ; if ( $ form -> isSubmited ( ) ) { if ( $ form -> isValid ( ) ) { $ values = $ form -> getValues ( ) ; $ values [ GenerisRdf ... | form to add a user |
54,074 | public function checkLogin ( ) { $ this -> defaultData ( ) ; $ userService = $ this -> getServiceLocator ( ) -> get ( tao_models_classes_UserService :: class ) ; if ( ! $ this -> isXmlHttpRequest ( ) ) { throw new common_exception_BadRequest ( 'wrong request mode' ) ; } $ data = array ( 'available' => false ) ; if ( $ ... | action used to check if a login can be used |
54,075 | public function edit ( ) { $ this -> defaultData ( ) ; $ userService = $ this -> getServiceLocator ( ) -> get ( tao_models_classes_UserService :: class ) ; $ user = $ this -> getUserResource ( ) ; $ types = $ user -> getTypes ( ) ; $ myFormContainer = new tao_actions_form_Users ( reset ( $ types ) , $ user ) ; $ myForm... | Form to edit a user User login must be set in parameter |
54,076 | public function unlock ( ) { $ user = UserHelper :: getUser ( $ this -> getUserResource ( ) ) ; if ( $ this -> getUserLocksService ( ) -> unlockUser ( $ user ) ) { $ this -> returnJson ( [ 'success' => true , 'message' => __ ( 'User %s successfully unlocked' , UserHelper :: getUserLogin ( UserHelper :: getUser ( $ user... | Removes all locks from user account |
54,077 | public function lock ( ) { $ user = UserHelper :: getUser ( $ this -> getUserResource ( ) ) ; if ( $ this -> getUserLocksService ( ) -> lockUser ( $ user ) ) { $ this -> returnJson ( [ 'success' => true , 'message' => __ ( 'User %s successfully locked' , UserHelper :: getUserLogin ( UserHelper :: getUser ( $ user ) ) )... | Locks user account he can not login in to the system anymore |
54,078 | public function getTranslationFile ( ) { $ returnValue = null ; if ( $ this -> translationFile != null ) { return $ this -> translationFile ; } else { throw new tao_helpers_translation_TranslationException ( 'No TranslationFile to retrieve.' ) ; } return $ returnValue ; } | Gets the TranslationFile instance resulting of the reading of the file . |
54,079 | protected function download ( $ data , $ fileName = null ) { if ( $ fileName === null ) { $ fileName = time ( ) ; } while ( ob_get_level ( ) > 0 ) { ob_end_flush ( ) ; } header ( 'Content-Type: ' . $ this -> contentType ) ; header ( 'Content-Disposition: attachment; fileName="' . $ fileName . '"' ) ; header ( "Content-... | Send exported data to end user |
54,080 | public function addAvailableFilters ( $ userId , $ archivedAllowed = false , $ cancelledAvailable = false ) { if ( ! $ archivedAllowed ) { $ this -> neq ( TaskLogBrokerInterface :: COLUMN_STATUS , TaskLogInterface :: STATUS_ARCHIVED ) ; } if ( ! $ cancelledAvailable ) { $ this -> neq ( TaskLogBrokerInterface :: COLUMN_... | Add a basic filter to query only rows belonging to a given user and not having status ARCHIVED or CANCELLED . |
54,081 | public static function getConfigChecker ( $ extensionIds ) { $ returnValue = new common_configuration_ComponentCollection ( ) ; $ checkArray = array ( ) ; foreach ( self :: getRawChecks ( $ extensionIds ) as $ c ) { $ checkArray [ ] = $ c ; $ comp = common_configuration_ComponentFactory :: buildFromArray ( $ c ) ; if (... | Get the ComponentCollection corresponding to the distribution . It the configuration checks to perform for all extensions involved in the |
54,082 | public function format ( array $ data ) { $ value = parent :: format ( $ data ) ; foreach ( $ this -> list as $ uri => $ values ) { if ( in_array ( $ value , $ values ) ) { return $ uri ; } } return '' ; } | Format an array to expected value to be written |
54,083 | public function get ( $ key ) { $ textRegistry = $ this -> getTextRegistry ( ) ; if ( is_string ( $ key ) && isset ( $ textRegistry [ $ key ] ) ) { return $ textRegistry [ $ key ] ; } return $ key ; } | Return the associated conversion of the given key |
54,084 | public static function getNodesToOpen ( $ uris , core_kernel_classes_Class $ rootNode ) { $ toTest = array ( ) ; foreach ( $ uris as $ uri ) { $ resource = new core_kernel_classes_Resource ( $ uri ) ; foreach ( $ resource -> getTypes ( ) as $ type ) { $ toTest [ $ type -> getUri ( ) ] = array ( ) ; } } $ toOpen = array... | Returns the nodes to open in order to display all the listed resources to be visible |
54,085 | public static function buildResourceNode ( core_kernel_classes_Resource $ resource , core_kernel_classes_Class $ class , array $ extraProperties = [ ] ) { $ label = $ resource -> getLabel ( ) ; $ label = empty ( $ label ) ? __ ( 'no label' ) : $ label ; $ extraValues = [ ] ; if ( ! empty ( $ extraProperties ) ) { forea... | generis tree representation of a resource node |
54,086 | public function getAnnotation ( $ name ) { $ returnValue = array ( ) ; if ( isset ( $ this -> annotations [ $ name ] ) ) { $ returnValue = array ( 'name' => $ name , 'value' => $ this -> annotations [ $ name ] ) ; } else { $ returnValue = null ; } return ( array ) $ returnValue ; } | Get an annotation for a given annotation name . Returns an associative where keys are name and value . |
54,087 | public function addTranslationUnit ( tao_helpers_translation_TranslationUnit $ translationUnit ) { foreach ( $ this -> getTranslationUnits ( ) as $ tu ) { if ( $ tu -> getSource ( ) == $ translationUnit -> getSource ( ) ) { if ( $ translationUnit -> getTarget ( ) !== '' ) { $ tu -> setTarget ( $ translationUnit -> getT... | Adds a TranslationUnit instance to the file . It is appenned at the end of collection . |
54,088 | public function removeTranslationUnit ( tao_helpers_translation_TranslationUnit $ translationUnit ) { $ tus = $ this -> getTranslationUnits ( ) ; for ( $ i = 0 ; $ i < count ( $ tus ) ; $ i ++ ) { if ( $ tus [ $ i ] === $ translationUnit ) { unset ( $ tus [ $ i ] ) ; break ; } } throw new tao_helpers_translation_Transl... | Removes a given TranslationUnit from the collection of TranslationUnits the file . |
54,089 | public function hasSameSource ( tao_helpers_translation_TranslationUnit $ translationUnit ) { $ returnValue = ( bool ) false ; foreach ( $ this -> getTranslationUnits ( ) as $ tu ) { if ( $ tu -> hasSameTranslationUnitSource ( $ translationUnit ) ) { $ returnValue = true ; break ; } } return ( bool ) $ returnValue ; } | Short description of method hasSameSource |
54,090 | public function hasSameTarget ( tao_helpers_translation_TranslationUnit $ translationUnit ) { $ returnValue = ( bool ) false ; foreach ( $ this -> getTranslationUnits ( ) as $ tu ) { if ( $ tu -> hasSameTranslationUnitTarget ( $ translationUnit ) ) { $ returnValue = true ; break ; } } return ( bool ) $ returnValue ; } | Short description of method hasSameTarget |
54,091 | public function sortBySource ( $ sortingType ) { $ returnValue = $ this -> getTranslationUnits ( ) ; switch ( $ sortingType ) { case self :: SORT_ASC : $ cmpFunction = function ( $ a , $ b ) { return strcmp ( $ a -> getSource ( ) , $ b -> getSource ( ) ) ; } ; break ; case self :: SORT_ASC_I : $ cmpFunction = function ... | Sorts and returns the TranslationUnits by Source with a specified sorting |
54,092 | public function getBySource ( tao_helpers_translation_TranslationUnit $ translationUnit ) { $ returnValue = null ; foreach ( $ this -> getTranslationUnits ( ) as $ tu ) { if ( $ tu -> hasSameTranslationUnitSource ( $ translationUnit ) ) { $ returnValue = $ tu ; break ; } } return $ returnValue ; } | Short description of method getBySource |
54,093 | public function getByTarget ( tao_helpers_translation_TranslationUnit $ translationUnit ) { $ returnValue = null ; foreach ( $ this -> getTranslationUnits ( ) as $ tu ) { if ( $ tu -> hasSameTranslationUnitTarget ( $ translationUnit ) ) { $ returnValue = $ tu ; break ; } } return $ returnValue ; } | Short description of method getByTarget |
54,094 | protected function getPropertyForm ( $ property , $ index , $ isParentProp , $ propData ) { $ propFormClass = 'tao_actions_form_' . ucfirst ( strtolower ( $ this -> propertyMode ) ) . 'Property' ; if ( ! class_exists ( $ propFormClass ) ) { $ propFormClass = 'tao_actions_form_SimpleProperty' ; } $ propFormContainer = n... | Returns the form for the property based on the mode |
54,095 | protected function getSystemProperties ( ) { $ constants = get_defined_constants ( true ) ; $ keys = array_filter ( array_keys ( $ constants [ 'user' ] ) , function ( $ key ) { return strstr ( $ key , 'PROPERTY' ) !== false ; } ) ; return array_intersect_key ( $ constants [ 'user' ] , array_flip ( $ keys ) ) ; } | Returns list of all system property classes |
54,096 | public function getUploadedFile ( $ serial ) { $ file = $ this -> universalizeUpload ( $ serial ) ; if ( $ file instanceof File ) { $ file = $ this -> getLocalCopy ( $ file ) ; } return $ file ; } | Either create local copy or use original location for tile Returns absolute path to the file to be compatible with legacy methods |
54,097 | private function getLocalCopy ( File $ file ) { $ tmpName = \ tao_helpers_File :: concat ( [ \ tao_helpers_File :: createTempDir ( ) , $ file -> getBasename ( ) ] ) ; if ( ( $ resource = fopen ( $ tmpName , 'wb' ) ) !== false ) { stream_copy_to_stream ( $ file -> readStream ( ) , $ resource ) ; fclose ( $ resource ) ; ... | Deprecated for compatibility with legacy code |
54,098 | public function isUploadedFile ( $ filePath ) { if ( filter_var ( $ filePath , FILTER_VALIDATE_URL ) ) { return true ; } $ file = $ this -> getUploadDir ( ) -> getFile ( $ this -> getUserDirectoryHash ( ) . '/' . $ filePath ) ; if ( $ file -> exists ( ) ) { return true ; } return false ; } | Is the uploaded filename looks as an uploaded file . |
54,099 | public function searchParams ( ) { $ rawQuery = isset ( $ _POST [ 'query' ] ) ? $ _POST [ 'query' ] : '' ; $ this -> returnJson ( array ( 'url' => _url ( 'search' ) , 'params' => array ( 'query' => $ rawQuery , 'rootNode' => $ this -> getRequestParameter ( 'rootNode' ) ) , 'filter' => array ( ) , 'model' => array ( Ont... | Search parameters endpoints . The response provides parameters to create a datatable . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.