idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
55,900 | protected function isFilesystemWritable ( $ path ) { if ( $ this -> getFilesystem ( ) -> isWritable ( ) ) { return true ; } else { return $ this -> setError ( Message :: get ( Message :: STR_FS_NONWRITABLE , $ path ) , Message :: STR_FS_NONWRITABLE ) ; } } | Check filesystem writable or not |
55,901 | protected function isFilesystemDeletable ( $ path ) { if ( $ this -> getFilesystem ( ) -> isDeletable ( ) ) { return true ; } else { return $ this -> setError ( Message :: get ( Message :: STR_FS_NONDELETABLE , $ path ) , Message :: STR_FS_NONDELETABLE ) ; } } | Check filesystem file deletable or not |
55,902 | final public function hasclass ( $ classname ) { return ! ! $ this -> hasattr ( 'class' ) ? in_array ( $ classname , explode ( ' ' , $ this -> attrs -> class ) ) : FALSE ; } | Permite saber si el elemento posee una clase . |
55,903 | final public function parent ( ) { $ parent = NULL ; if ( ! ! isset ( $ this -> dom_element -> parentNode ) ) { if ( $ this -> dom_element -> parentNode -> nodeType == 1 ) { $ parent = new PHPHtmlDomElement ( $ this -> dom_element -> parentNode ) ; } else { $ parent = $ this -> dom_element -> parentNode ; } } return $ ... | Permite obtener el elemeno padre si lo posee |
55,904 | public function convertToSql ( String $ query , Parameters $ parameterRepository ) : StdClass { $ stdClass = new StdClass ( ) ; $ stdClass -> parameterValues = [ ] ; $ placeholder = '?' ; $ stdClass -> query = '' ; $ match = false ; if ( preg_match_all ( '/\:([^ ,]+)/s' , $ query , $ matched ) ) { $ stdClass -> paramet... | Converts a query string with named parameters to marked placeholders and returs an object . |
55,905 | public function getSelectedFields ( String $ query ) : Array { $ columns = [ ] ; if ( Type :: getStatementType ( $ query ) == 1 ) { if ( preg_match ( "/(SELECT|select|Select)(.*?)FROM|from|From([^ ]+)/s" , $ query , $ matches ) ) { $ columns = explode ( ',' , $ matches [ 2 ] ) ; $ columns = array_map ( function ( $ fie... | Returns an array of selected fields in a SELECT statement . |
55,906 | public function hasMappableFields ( String $ query ) : Array { $ fields = [ ] ; if ( preg_match ( "/=([^ ]+)?/s" , $ query , $ matches ) ) { $ fields = $ matches ; } return $ fields ; } | This method returns an array of fields to map in a query . |
55,907 | public function isChecked ( ) { if ( null == $ this -> checked ) { $ this -> checked = StaticFilter :: filter ( Boolean :: class , $ this -> getValue ( ) ) ; } return $ this -> checked ; } | Check whenever the checkbox state is checked |
55,908 | public function getAttributes ( ) { $ attributes = parent :: getAttributes ( ) ; if ( $ this -> isChecked ( ) ) { $ attributes -> set ( 'checked' , null ) ; } return $ attributes ; } | Get the attributes map collection |
55,909 | public function addDetectedLanguage ( $ language ) { if ( ! in_array ( $ language , $ this -> detectedLanguages ) ) { $ this -> detectedLanguages [ ] = $ language ; } return $ this ; } | Add detected languages |
55,910 | public function getVoteLanguages ( $ mode = null ) { arsort ( $ this -> votes , SORT_NUMERIC ) ; if ( self :: VOTED_HIGH === $ mode ) { if ( ! count ( $ this -> votes ) ) { return $ this -> votes ; } $ languages = array ( ) ; list ( $ language , $ highVote ) = each ( $ this -> votes ) ; $ languages [ ] = $ language ; w... | Get vote languages |
55,911 | public function getPrimaryLanguage ( array $ priorityLanguages = array ( ) ) { $ votedLanguages = $ this -> getVoteLanguages ( self :: VOTED_HIGH ) ; if ( ! count ( $ votedLanguages ) ) { $ votedLanguages = $ this -> getVoteLanguages ( ) ; if ( ! count ( $ votedLanguages ) ) { return null ; } } if ( ! count ( $ priorit... | Get primary language |
55,912 | protected function getArg ( $ name ) { if ( isset ( $ this -> request [ 'post' ] [ $ name ] ) ) { return $ this -> request [ 'post' ] [ $ name ] ; } else { return $ this -> getURLArg ( $ name ) ; } } | Return an argument first from POST or from GET if POST fails |
55,913 | public function Exception ( $ exception ) { $ auditlog = Sonic :: getResource ( 'auditlog' ) ; if ( $ auditlog instanceof Resource \ Audit \ Log ) { $ auditlog :: _Log ( get_called_class ( ) . '\\' . $ this -> action , 7 , $ this -> request , array ( 'file' => $ exception -> getFile ( ) , 'line' => $ exception -> getLi... | Deal with an exception |
55,914 | public function authenticate ( Request $ request ) { return $ request -> get ( 'username' ) === $ this -> username && password_verify ( $ request -> get ( 'password' ) , $ this -> password ) ; } | Returns true if the given Request meets authentication requirements |
55,915 | public function relation ( string $ table , string $ bindKey , string $ srcKey = 'id' , Closure $ userExe = null ) : Builder { $ this -> rsRender ( $ table , $ bindKey , $ srcKey , null , $ userExe ) ; return $ this ; } | similar with relations but merge single - data in source |
55,916 | public function relations ( string $ table , string $ bindKey , string $ listKey , string $ srcKey = 'id' , Closure $ userExe = null ) : Builder { $ this -> rsRender ( $ table , $ bindKey , $ srcKey , $ listKey , $ userExe ) ; return $ this ; } | similar with relation but attach listed - data in source |
55,917 | public function get ( $ key , $ default = null ) { if ( Arrays :: exists ( $ key , $ this -> attributes ) ) { return $ this -> attributes [ $ key ] ; } return value ( $ default ) ; } | Get an attribute from the container . |
55,918 | public function setStateNotVoid ( ) { if ( $ this -> state === State :: VOID ) { $ this -> state = $ this -> hasSavedProperties ( ) ? State :: SAVED : State :: PENDING ; } return $ this ; } | if the model has id it becomes SAVED otherwise - pending |
55,919 | public function getRelationships ( $ modelName ) { if ( $ this -> models -> has ( $ modelName ) && $ this -> models -> get ( $ modelName ) -> has ( 'relationships' ) ) { return $ this -> models -> get ( $ modelName ) -> get ( 'relationships' ) ; } return new Map ( ) ; } | Returns the relationships for a model |
55,920 | public function getNormalizer ( $ modelName ) { if ( $ this -> models -> has ( $ modelName ) && $ this -> models -> get ( $ modelName ) -> has ( 'normalizer' ) ) { return $ this -> models -> get ( $ modelName ) -> get ( 'normalizer' ) ; } return new Map ( ) ; } | Returns normalizer for a model |
55,921 | public function getIncludes ( $ modelName ) { if ( $ this -> models -> has ( $ modelName ) && $ this -> models -> get ( $ modelName ) -> has ( 'includes' ) ) { return $ this -> models -> get ( $ modelName ) -> get ( 'includes' ) ; } return new ArrayList ( ) ; } | Returns additional includes for a given model |
55,922 | public function isValid ( $ headersOnly = false ) { $ accessToken = $ this -> determineAccessToken ( $ headersOnly ) ; $ result = $ this -> storages [ 'session' ] -> validateAccessToken ( $ accessToken ) ; if ( ! $ result ) { throw new InvalidAccessTokenException ( 'Access token is not valid' ) ; } $ this -> accessToke... | Checks if the access token is valid or not . |
55,923 | public function determineAccessToken ( $ headersOnly = false ) { $ header = $ this -> getRequest ( ) -> header ( 'Authorization' ) ; $ accessToken = '' ; if ( strpos ( $ header , 'Bearer' ) !== false ) { if ( strpos ( $ header , ',' ) !== false ) { $ headerPart = explode ( ',' , $ header ) ; $ accessToken = trim ( preg... | Reads in the access token from the headers . |
55,924 | public function push ( RenderingContext $ context ) { if ( $ this -> getLevel ( ) == self :: COMPONENT ) { throw new \ BadMethodCallException ( 'Cannot push another context : stack is full. Resolve or flush current one first' ) ; } array_unshift ( $ this -> stack , $ context ) ; return $ this ; } | Push given context over the stack making it the current one . |
55,925 | public function setSMTPStream ( $ smtp = FALSE ) { if ( is_array ( $ smtp ) ) { $ this -> smtp = $ smtp ; } else { $ this -> smtp = array ( 'server' => defined ( 'EMAIL_SERVER' ) ? EMAIL_SERVER : NULL , 'port' => defined ( 'EMAIL_PORT' ) ? EMAIL_PORT : NULL , 'domain' => defined ( 'EMAIL_DOMAIN' ) ? EMAIL_DOMAIN : NULL... | Use SMTP stream to send mail |
55,926 | public function setPHPMail ( ) { $ this -> _useStream = FALSE ; if ( isset ( $ _SERVER [ 'QMAIL' ] ) ) { $ this -> _nl = "\n" ; } else { $ this -> _nl = "\r\n" ; } } | Use PHP to send mail |
55,927 | private function addHeader ( $ header , $ unique = FALSE ) { if ( is_array ( $ header ) ) { $ this -> _headers = array_merge ( $ this -> _headers , $ header ) ; } else { if ( $ unique ) { $ headerArray = explode ( ':' , $ header ) ; $ headerKey = $ headerArray [ 0 ] ; foreach ( $ this -> _headers as $ key => $ val ) { ... | Add Email Header |
55,928 | public function addHTML ( $ html , $ plain = FALSE ) { $ this -> _htmlSet = TRUE ; if ( $ plain ) { $ this -> addPlain ( $ plain ) ; } $ this -> _html [ ] = $ html ; } | Add HTML to Email Message |
55,929 | public function addImage ( $ filePath , $ fileName = NULL ) { if ( ! file_exists ( $ filePath ) ) { new \ Sonic \ Message ( 'error' , $ filePath . ' doesnt exist!' ) ; return FALSE ; } if ( ! $ imgData = getimagesize ( $ filePath ) ) { new \ Sonic \ Message ( 'error' , 'Cannot get MIME type!' ) ; return FALSE ; } if ( ... | Add Image to Email Message |
55,930 | public function addAttachment ( $ filePath = FALSE , $ fileName = NULL , $ fileData = FALSE , $ mimeType = 'text/plain' ) { if ( $ filePath !== FALSE ) { if ( ! file_exists ( $ filePath ) ) { new \ Sonic \ Message ( 'error' , $ filePath . ' doesnt exist!' ) ; return FALSE ; } $ objFinfo = new finfo ; if ( ! $ mimeType ... | Add Attachment to Email Message |
55,931 | public function setTemplate ( $ file ) { $ tpl = \ Sonic \ Sonic :: getResource ( 'tpl' ) ; if ( $ tpl instanceof \ Smarty && ! is_readable ( $ file ) ) { $ file = $ tpl -> getTemplateDir ( 0 ) . $ file ; } if ( is_readable ( $ file ) ) { $ this -> _tpl = $ file ; } } | Set the message template file to user |
55,932 | private function constructImage ( $ image , $ boundary ) { $ output = NULL ; $ output .= '--' . $ boundary . $ this -> _nl ; $ output .= 'Content-Type: ' . $ image [ 'type' ] ; if ( $ image [ 'name' ] ) { $ output .= '; name="' . $ image [ 'name' ] . '"' ; } $ output .= $ this -> _nl ; $ output .= 'Content-Transfer-Enc... | Construct the specified image and add it to the message |
55,933 | private function constructAttachment ( $ attachment , $ boundary ) { $ output = NULL ; $ output .= '--' . $ boundary . $ this -> _nl ; $ output .= 'Content-Type: ' . $ attachment [ 'type' ] ; if ( $ attachment [ 'name' ] ) { $ output .= '; name="' . $ attachment [ 'name' ] . '"' ; } $ output .= $ this -> _nl ; $ output... | Construct the specified attachment and add it to the message |
55,934 | private function constructBody ( ) { $ body = NULL ; foreach ( $ this -> _body as $ bodyBlock ) { $ body .= $ bodyBlock ; } return $ this -> addAttachment ( FALSE , NULL , $ body ) ; } | Construct the message body |
55,935 | private function constructHeaders ( ) { $ headers = NULL ; foreach ( $ this -> _headers as $ header ) { $ headers .= $ header . $ this -> _nl ; } return $ headers ; } | Construct the message headers |
55,936 | public function Build ( ) { $ boundary = '=====' . md5 ( uniqid ( time ( ) ) ) ; $ this -> _headers = array ( ) ; $ this -> addHeader ( 'MIME-version: 1.0' ) ; $ this -> addHeader ( 'Content-Type: Multipart/alternative;' . $ this -> _nl . chr ( 9 ) . 'boundary="' . $ boundary . '"' ) ; $ this -> _message = NULL ; if ( ... | Construct the email message |
55,937 | public function Send ( $ from , $ subject = FALSE , $ headers = FALSE ) { if ( preg_match ( '/(.*?)<(.*?)>/' , $ from , $ fromArray ) ) { $ this -> _fromName = trim ( $ fromArray [ 1 ] ) ; $ this -> _fromAddress = $ fromArray [ 2 ] ; try { Parser :: _Validate ( 'From name' , array ( 'type' => \ Sonic \ Model :: TYPE_ST... | Construct message if not done already and send email . Attribute to and from addresses will replace any to or from headers |
55,938 | private function sendUsingPHP ( ) { $ headers = $ this -> constructHeaders ( ) ; $ tpl = \ Sonic \ Sonic :: getResource ( 'tpl' ) ; $ smarty = $ tpl instanceof \ Smarty ; if ( $ smarty ) { $ smartyPrevCache = $ tpl -> caching ; $ tpl -> setCaching ( FALSE ) ; } foreach ( $ this -> _recipients as $ recipient ) { try { P... | Send email to recipients using PHP mail |
55,939 | protected function Log ( $ recipient , $ headers , $ email , $ method ) { $ filename = date ( 'Y-m-d_H-i-s' ) . '_' . $ method . '_' . $ recipient . '.txt' ; @ file_put_contents ( EMAIL_LOG_PATH . $ filename , $ headers . $ email ) ; } | Log sent message |
55,940 | protected function registerConfigs ( Application $ app ) { $ base = $ app [ 'path.base' ] ; if ( file_exists ( "$base/.env" ) ) { $ dotenv = \ Dotenv :: load ( $ base ) ; } $ preloadedVars = [ 'env.DEBUG' => $ app [ 'debug' ] , 'env.AUTO_REBUILD' => $ app [ 'auto_rebuild' ] , 'env.DOMAIN' => isset ( $ _SERVER [ 'SERVER... | Register the config provider and load the default configs |
55,941 | protected function registerTwig ( Application $ app , $ base ) { $ app -> register ( new \ Silex \ Provider \ TwigServiceProvider , [ 'twig.path' => $ base . '/templates' , 'twig.options' => [ 'debug' => $ app [ 'debug' ] , 'cache' => $ base . '/cache/templates' , ] , ] ) ; $ this -> addDateDefaultFormatToTwig ( $ app ... | Register the TwigServiceProvider |
55,942 | protected function addDateDefaultFormatToTwig ( Application $ app ) { $ app [ 'twig' ] = $ app -> share ( $ app -> extend ( 'twig' , function ( \ Twig_Environment $ twig , Application $ app ) { $ defaultDateFormat = new \ Twig_SimpleFilter ( 'date_default_format' , function ( \ DateTime $ date ) use ( $ app ) { $ forma... | Twig date_default_format filter |
55,943 | public static function getMimeType ( $ file ) { $ finfo = finfo_open ( FILEINFO_MIME_TYPE ) ; $ type = finfo_file ( $ finfo , $ file ) ; finfo_close ( $ finfo ) ; return $ type ; } | get the MIME Type of a file . |
55,944 | public static function getMimeTypeFromFilename ( $ fileName ) { $ ext = strtolower ( pathinfo ( $ fileName , PATHINFO_EXTENSION ) ) ; if ( array_key_exists ( $ ext , self :: $ customMimeTypes ) ) { return self :: $ customMimeTypes [ $ ext ] ; } else if ( array_key_exists ( $ ext , self :: $ mimeTypes ) ) { return self ... | get the MIME Type of a file only with its name . |
55,945 | protected function _getListInstallerCommandsFull ( ) { $ result = [ CAKE_INSTALLER_SHELL_INSTALLER_TASK_SETUILANG => __d ( 'cake_installer' , 'Setting application UI language' ) , CAKE_INSTALLER_SHELL_INSTALLER_TASK_CHECK => __d ( 'cake_installer' , 'Checking PHP environment' ) , CAKE_INSTALLER_SHELL_INSTALLER_TASK_SET... | Return full list of installer commands |
55,946 | public function getListInstallerCommands ( $ returnList = true ) { $ commandsList = $ this -> _getListInstallerCommandsFull ( ) ; $ installerCommands = $ this -> _getConfigValueArray ( 'installerCommands' ) ; $ result = array_intersect_key ( $ commandsList , array_flip ( $ installerCommands ) ) ; if ( $ returnList ) { ... | Return list of installer commands |
55,947 | public function registerJs ( ) { if ( Yii :: $ app -> request -> isAjax ) { return ; } $ js = <<<'JS' $(document.body).on("click", "a.toggle-column", function(e) { e.preventDefault(); $.post($(this).attr("href"), function(data) { var pjaxId = $(e.target).closest("[data-pjax-container]").attr("i... | Registers the ajax JS |
55,948 | private function buildConnection ( ) { $ connection = stream_socket_client ( "tcp://{$this->host}:{$this->port}" , $ errno , $ message ) ; $ success = fread ( $ connection , 26 ) ; if ( false === $ connection || false === $ success ) { throw new \ UnexpectedValueException ( "Failed to connect: $message" ) ; } return $ ... | Builds and tests the connection to the Database |
55,949 | public function getAction ( $ item ) { $ options = [ 'query' => [ 'item' => $ this -> getItemId ( $ item ) , 'processor' => $ this -> getId ( ) , ] , ] ; if ( $ this -> isLinkDialog ( ) ) { $ options [ 'attributes' ] [ 'class' ] [ ] = 'use-ajax' ; $ options [ 'attributes' ] [ 'class' ] [ ] = 'minidialog' ; $ options [ ... | Get ready to use action |
55,950 | public static function async ( $ executable , $ arguments = [ ] , $ output_stream = '/dev/null' ) { exec ( $ executable . ( $ arguments ? ' ' . join ( ' ' , $ arguments ) : '' ) . '>' . $ output_stream . ' 2>&1 &' ) ; } | Execute asynchronously using exec |
55,951 | public static function file ( $ executable , $ arguments = [ ] , & $ output = false ) { $ return_var = 0 ; exec ( $ executable . ( $ arguments ? ' ' . join ( ' ' , $ arguments ) : '' ) , $ output , $ return_var ) ; return $ return_var ; } | Execute using exec |
55,952 | public function hasWarningMessages ( ) { $ namespace = $ this -> getNamespace ( ) ; $ this -> setNamespace ( self :: NAMESPACE_WARNING ) ; $ hasMessages = $ this -> hasMessages ( ) ; $ this -> setNamespace ( $ namespace ) ; return $ hasMessages ; } | Whether warning namespace has messages |
55,953 | public function addWarningMessage ( $ message ) { $ namespace = $ this -> getNamespace ( ) ; $ this -> setNamespace ( self :: NAMESPACE_WARNING ) ; $ this -> addMessage ( $ message ) ; $ this -> setNamespace ( $ namespace ) ; return $ this ; } | Add a message with warning type |
55,954 | public function getWarningMessages ( ) { $ namespace = $ this -> getNamespace ( ) ; $ this -> setNamespace ( self :: NAMESPACE_WARNING ) ; $ messages = $ this -> getMessages ( ) ; $ this -> setNamespace ( $ namespace ) ; return $ messages ; } | Get messages from warning namespace |
55,955 | public function menuLink ( $ title , $ url = null , array $ options = [ ] ) { if ( ! empty ( $ url [ 'controller' ] ) && strtolower ( $ this -> request -> getParam ( 'controller' ) ) == strtolower ( $ url [ 'controller' ] ) && ! empty ( $ url [ 'action' ] ) && ( strtolower ( $ this -> request -> getParam ( 'action' ) )... | Adds an active css class to links which pointing to the current url |
55,956 | private function cleanup ( $ bind ) { if ( ! is_array ( $ bind ) ) { if ( ! empty ( $ bind ) ) $ bind = array ( $ bind ) ; else $ bind = array ( ) ; } return $ bind ; } | Remove all data from bind array |
55,957 | private function debug ( ) { if ( ! empty ( $ this -> _errorCallbackFunction ) ) { $ error = array ( "Error" => $ this -> _error ) ; if ( ! empty ( $ this -> _sql ) ) $ error [ "SQL Statement" ] = $ this -> _sql ; if ( ! empty ( $ this -> _bind ) ) $ error [ "Bind Parameters" ] = trim ( print_r ( $ this -> _bind , true... | Used for query debugging purpose |
55,958 | public function setErrorCallbackFunction ( $ errorCallbackFunction , $ errorMsgFormat = "html" ) { if ( in_array ( strtolower ( $ errorCallbackFunction ) , array ( "echo" , "print" ) ) ) $ errorCallbackFunction = "print_r" ; if ( function_exists ( $ errorCallbackFunction ) ) { $ this -> _errorCallbackFunction = $ error... | Sets the error callback function |
55,959 | public function handle ( ) { if ( ! ( $ this -> exception instanceof \ ErrorException ) ) { $ this -> quit = true ; } else { switch ( $ this -> exception -> getSeverity ( ) ) { case E_ERROR : case E_CORE_ERROR : case E_USER_ERROR : $ this -> quit = true ; } } if ( $ this -> exception instanceof \ ErrorException ) { $ e... | Handle an error with the most basic handler on the CLI |
55,960 | public function find ( ) { $ config = $ this -> container [ 'config' ] -> get ( 'rinvex.modulable' ) ; foreach ( $ config [ 'paths' ] as $ path ) { foreach ( $ this -> container [ 'files' ] -> glob ( $ path . '/*/*/composer.json' ) as $ module ) { if ( mb_strpos ( $ module , 'cortex/foundation' ) === false && ( $ json ... | Find elligable modules . |
55,961 | public function assertIsArrayAndNotEmpty ( $ value , $ message = '%s must not be an empty Array' , $ exception = 'Asserts' ) { if ( isset ( $ value ) === false || is_array ( $ value ) === false || ( is_array ( $ value ) && count ( $ value ) <= 0 ) ) { $ this -> throwException ( $ exception , $ message , $ value ) ; } } | Verifies that the specified condition is not empty array . The assertion fails if the condition is not array or it s an empty array . |
55,962 | public function isClosed ( ) : bool { foreach ( $ this -> geometries as $ geometry ) { if ( ! $ geometry -> isClosed ( ) ) { return false ; } } return true ; } | Indicates whether the MultiCurve is closed . |
55,963 | public function modalbox ( String $ id , Array $ data = [ ] ) { $ data = [ 'modalId' => $ id , 'modalHeader' => $ this -> settings [ 'attr' ] [ 'modal-header' ] ?? NULL , 'modalBody' => $ this -> settings [ 'attr' ] [ 'modal-body' ] ?? NULL , 'modalFooter' => $ this -> settings [ 'attr' ] [ 'modal-footer' ] ?? NULL , '... | Generate modal box |
55,964 | public function serializer ( String $ url , $ selector = '.modal-body' , $ datatype = 'standart' ) { $ selector = is_string ( $ selector ) ? ( $ this -> settings [ 'attr' ] [ 'data-target' ] ?? NULL ) . Base :: prefix ( $ selector , ' ' ) : $ selector ; return $ this -> trigger ( 'click' , $ url , $ selector , $ dataty... | Serilize form into controller |
55,965 | protected function stringOrCallback ( $ content ) { if ( is_scalar ( $ content ) ) { return $ content ; } elseif ( is_callable ( $ content ) ) { return Buffering \ Callback :: do ( $ content ) ; } throw new Exception \ InvalidArgumentException ( '1.($content) parameter must be [scalar] or [callable] type!' ) ; } | Protected string or callback |
55,966 | protected function bootstrapClassResolution ( $ type , $ class ) { $ result = $ type . ' ' ; $ parts = explode ( ' ' , $ class ) ; foreach ( $ parts as $ part ) { if ( ! strstr ( $ part , $ type ) ) { $ result .= Base :: prefix ( $ part , $ type . '-' ) ; } else { $ result .= $ part ; } $ result .= ' ' ; } return trim ... | Protected class resolution |
55,967 | protected function convertSerializerDataType ( $ datatype ) { if ( $ datatype === 'json' ) { $ this -> settings [ 'serializer' ] [ 'properties' ] = 'dataType:"json",' . EOL ; } elseif ( is_array ( $ datatype ) ) { $ this -> settings [ 'serializer' ] [ 'properties' ] = rtrim ( ltrim ( json_encode ( $ datatype ) , '{' ) ... | Protected convert serializeer data type |
55,968 | protected function transferAttributesAndUnset ( $ type , $ attr ) { $ return = $ this -> settings [ $ type ] [ $ attr ] ?? NULL ; unset ( $ this -> settings [ $ type ] [ $ attr ] ) ; return $ return ; } | Protected transfer attributes and unset |
55,969 | protected function bootstrapObjectOptions ( String $ selector , $ options , $ type ) { if ( ! empty ( $ options ) ) { $ optionsEncode = json_encode ( $ options ) ; } $ return = '<script>$("' . $ selector . '").' . $ type . '(' . ( $ optionsEncode ?? NULL ) . ')' ; if ( $ parameter = $ this -> transferAttributesAndUnset... | Protected object options |
55,970 | protected function isBootstrapAttribute ( $ attr , $ callback ) { if ( isset ( $ this -> settings [ 'attr' ] [ $ attr ] ) ) { $ attribute = $ this -> settings [ 'attr' ] [ $ attr ] ; if ( $ attribute === str_replace ( '-' , '' , $ attr ) ) { $ attribute = NULL ; } unset ( $ this -> settings [ 'attr' ] [ $ attr ] ) ; $ ... | Protected is bootstrap attribute |
55,971 | protected function getModalResource ( String $ resources = 'standart' , $ data , $ directory = 'Modals' ) { return Inclusion \ View :: use ( $ resources , $ data , true , __DIR__ . '/Resources/' . $ directory . '/' ) ; } | Protected get modal resource |
55,972 | protected function changeFormAttributes ( $ types ) { foreach ( $ types as $ new => $ old ) { $ oldEx = explode ( ':' , $ old ) ; if ( isset ( $ this -> settings [ 'attr' ] [ $ new ] ) ) { unset ( $ this -> settings [ 'attr' ] [ $ new ] ) ; $ this -> settings [ 'attr' ] [ $ oldEx [ 0 ] ] = $ oldEx [ 1 ] ; } } } | Protected change form attributes |
55,973 | protected function isBootstrapLabelUsage ( $ type ) { if ( $ for = ( $ this -> settings [ 'label' ] [ 'for' ] ?? NULL ) ) { if ( ! $ this -> isCheckboxOrRadio ( $ type ) ) { $ this -> settings [ 'attr' ] [ 'id' ] = $ for ; } } } | Protected is bootstrap label usage |
55,974 | protected function isBootstrapGroupUsage ( $ type ) { if ( ( $ this -> settings [ 'group' ] [ 'class' ] ?? NULL ) || isset ( $ this -> callableGroup ) ) { if ( ! $ this -> isCheckboxOrRadio ( $ type ) ) { if ( ! isset ( $ this -> settings [ 'attr' ] [ 'class' ] ) ) { $ this -> settings [ 'attr' ] [ 'class' ] = 'form-co... | Protected is bootstrap group usage |
55,975 | protected function createBootstrapFormInputElementByType ( $ type , $ value , $ attributes , & $ return ) { $ return = NULL ; if ( $ class = ( $ this -> settings [ 'group' ] [ 'class' ] ?? NULL ) ) { if ( $ this -> isCheckboxOrRadio ( $ type ) ) { if ( $ class === 'form-group' ) { $ class = $ type ; } elseif ( $ class ... | Protected create form input element by type |
55,976 | protected function isBootstrapColumnSize ( & $ return ) { if ( $ colsize = $ this -> transferAttributesAndUnset ( 'col' , 'size' ) ) { $ return = $ this -> getHTMLClass ( ) -> class ( Base :: prefix ( $ colsize , 'col-' ) ) -> div ( $ return ) ; } } | Protected bootstrap column size |
55,977 | protected function createBootstrapRadioOrCheckboxOpenLabelElement ( $ type , & $ radioOrCheckboxLabel , & $ return ) { if ( $ value = $ this -> settings [ 'label' ] [ 'value' ] ) { $ this -> settings [ 'label' ] [ 'value' ] = Base :: prefix ( $ value , $ type . '-' ) ; } $ return .= '<label' . $ this -> createAttribute... | Protected create bootstrap radio or checkbox open label element |
55,978 | protected function getHttpResponse ( $ request = null , $ response = null ) { $ is_cache = false ; $ cache_type = null ; $ page_cache_config = Lb :: app ( ) -> getPageCacheConfig ( ) ; $ routeInfo = $ this -> route_info ; if ( isset ( $ page_cache_config [ 'controllers' ] [ $ routeInfo [ 'controller' ] ] [ $ routeInfo ... | Get http response |
55,979 | protected function runWebApp ( ) { $ this -> response -> getSwooleResponse ( ) -> end ( $ this -> getHttpResponse ( $ this -> request , $ this -> response ) ) ; } | Run web application |
55,980 | private function getUserFromSession ( $ sid ) { $ session = $ this -> entityManager -> getRepository ( "Emeric0101\PHPAngular\Entity\Session" ) -> findBySid ( $ sid ) ; if ( empty ( $ session ) ) { return null ; } $ userLogged = $ this -> entityManager -> find ( "Emeric0101\PHPAngular\Entity\IUser" , $ session [ 0 ] ->... | try to find the logged user with sid |
55,981 | public function locate ( $ path , $ currentPath = null , $ first = true ) { if ( file_exists ( $ path ) ) { return $ path ; } if ( null !== $ currentPath && file_exists ( $ currentPath . '/' . $ path ) ) { throw new RuntimeException ( sprintf ( 'You tried to load the file "%s" using a relative path. ' . 'This functiona... | Returns a full path for a given Puli path . |
55,982 | public function removeWordDelimiter ( $ delimiter ) { if ( empty ( $ delimiter ) ) { throw new Exception ( 'Word delimiter cannot be null.' ) ; } if ( is_array ( $ delimiter ) ) { foreach ( $ delimiter as $ delim ) { $ this -> removeWordDelimiter ( $ delim ) ; } } else { if ( ! in_array ( $ delimiter , $ this -> getWor... | Remove word delimiter |
55,983 | private function _replaceDelimiters ( $ s ) { foreach ( $ this -> getWordDelimiters ( ) as $ delimiter ) { if ( $ delimiter == $ this -> getDelimiterReplacement ( ) ) { continue ; } if ( in_array ( $ delimiter , $ this -> getNotReplacedChars ( ) ) ) { continue ; } $ s = str_replace ( $ delimiter , $ this -> getDelimite... | replace delimiters with another string |
55,984 | public function payload ( array $ input ) : PayloadInterface { $ domain = $ this -> container -> get ( $ this -> id ) ; if ( $ domain instanceof DomainInterface ) { return $ domain -> payload ( $ input ) ; } throw new ContainedDomainTypeException ( $ this -> id , $ domain ) ; } | Get the domain from the container then proxy its payload method . |
55,985 | protected function getPropertyType ( $ type ) { $ propertyType = ucfirst ( $ type ) ; if ( isset ( self :: $ _propertyTypes [ $ type ] ) ) { $ propertyType = self :: $ _propertyTypes [ $ type ] ; } return $ propertyType ; } | Gets the extbase property type by for a given type . |
55,986 | public function execute ( $ close = true ) { $ result = curl_exec ( $ this -> curl ) ; $ close && curl_close ( $ this -> curl ) ; return $ result ; } | Performs the cURL session . |
55,987 | protected function loadTemplateFile ( $ file ) { $ template = @ file_get_contents ( $ this -> templateDir . $ file ) ; if ( $ template === FALSE ) { throw new \ Sonic \ Exception ( 'Unable to load template file ' . $ this -> templateDir . $ file ) ; } return $ template ; } | Load a template file and return its contents |
55,988 | protected function replaceVars ( $ data ) { foreach ( $ this -> vars as $ key => $ val ) { $ data = str_replace ( $ this -> startDelimiter . $ key . $ this -> endDelimiter , $ val , $ data ) ; } $ data = preg_replace ( '/' . $ this -> startDelimiter . '.*' . $ this -> endDelimiter . '/' , '' , $ data ) ; return $ data ... | Replace variables in the template |
55,989 | protected function _parseXml ( $ file , $ query ) { if ( ! file_exists ( $ file ) ) { return array ( ) ; } $ options = defined ( 'LIBXML_COMPACT' ) ? LIBXML_COMPACT : 0 ; $ document = new SimpleXmlElement ( $ file , $ options , true ) ; return $ document -> xpath ( $ query ) ; } | Parses a XML file and retrieves data from it using an XPATH query and a given closure . |
55,990 | protected static function extend ( $ section , $ content ) { if ( isset ( static :: $ sections [ $ section ] ) ) { static :: $ sections [ $ section ] = str_replace ( '@@parent' , $ content , static :: $ sections [ $ section ] ) ; } else { static :: $ sections [ $ section ] = $ content ; } } | Extend the content in a given section . |
55,991 | public function radius ( $ meters ) { Assertion :: integer ( $ meters ) ; Assertion :: range ( $ meters , 1 , 100000 ) ; $ this -> radius = $ meters ; return $ this ; } | Set the radius in meters . |
55,992 | public function addConnection ( array $ settings , string $ name ) : void { $ this -> capsule -> addConnection ( $ settings , $ name ) ; } | Adds a new connection to the database eloquent model |
55,993 | public static function ensureValid ( $ option ) { if ( is_string ( $ option ) ) { $ option = strtolower ( $ option ) ; } if ( ! self :: isValid ( $ option ) ) { $ option = is_scalar ( $ option ) ? $ option : gettype ( $ option ) ; $ parts = explode ( '\\' , __CLASS__ ) ; $ class = array_pop ( $ parts ) ; throw new Enum... | Ensure the provided value is a valid type . Throw an exception if not . |
55,994 | public function remove ( $ entity ) { $ meta = $ this -> getMeta ( $ entity ) ; $ hash = $ this -> getHash ( $ entity ) ; if ( $ meta instanceof NodeMeta ) { $ this -> nodeEntitiesToRemove [ $ hash ] = $ entity ; } else { $ this -> relationEntitiesToRemove [ $ hash ] = $ entity ; } } | Marks an entity for removal from the database . |
55,995 | public function flush ( ) { try { $ this -> writeEntities ( ) ; $ this -> writeLabels ( ) ; $ this -> writeIndexes ( ) ; $ this -> removeEntities ( ) ; $ this -> clearEntities ( ) ; } catch ( Exception $ e ) { $ this -> clearEntities ( ) ; throw $ e ; } } | Commits persistent entities to the database . |
55,996 | private function removeEntities ( ) { $ deletedRelations = array ( ) ; $ this -> beginBatch ( ) ; foreach ( $ this -> nodeEntitiesToRemove as $ node ) { $ meta = $ this -> getMeta ( $ node ) ; $ id = $ meta -> getPrimaryKey ( ) -> getValue ( $ node ) ; if ( $ id ) { $ entity = $ this -> client -> getNode ( $ id ) ; $ r... | Removes entities in the remove list from the database . |
55,997 | private function writeEntities ( ) { $ this -> beginBatch ( ) ; foreach ( $ this -> nodeEntities as $ node ) { $ hash = $ this -> getHash ( $ node ) ; $ this -> everymanNodeCache [ $ hash ] = $ this -> createNode ( $ node ) -> save ( ) ; if ( array_key_exists ( $ hash , $ this -> startNodeRelations ) ) { foreach ( $ th... | Loops through persistent entities and stores them in the database . |
55,998 | private function createNode ( $ entity ) { $ meta = $ this -> getMeta ( $ entity ) ; $ pk = $ meta -> getPrimaryKey ( ) ; $ id = $ pk -> getValue ( $ entity ) ; if ( $ id ) { $ node = $ this -> client -> getNode ( $ id ) ; } else { $ node = $ this -> client -> makeNode ( ) ; } foreach ( $ meta -> getProperties ( ) as $... | Creates a Everyman node object from the given entity . |
55,999 | private function createRelation ( $ entity ) { $ meta = $ this -> getMeta ( $ entity ) ; $ pk = $ meta -> getPrimaryKey ( ) ; $ id = $ pk -> getValue ( $ entity ) ; $ start = $ meta -> getStart ( ) -> getValue ( $ entity ) ; $ end = $ meta -> getEnd ( ) -> getValue ( $ entity ) ; if ( $ id ) { $ relation = $ this -> cl... | Creates a Everyman relationship object from the given entity . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.