idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
42,200 | public function setValue ( $ key , $ value ) { if ( ! isset ( $ key ) ) { throw new Exception ( "nullKey" ) ; } else if ( ! in_array ( $ key , static :: $ fields ) ) { throw new FieldNotFoundException ( $ key , static :: getClass ( ) ) ; } else if ( $ key === static :: $ IDFIELD ) { throw new Exception ( "idNotEditable" ) ; } else if ( $ value !== $ this -> data [ $ key ] ) { $ this -> addModFields ( $ key ) ; $ this -> data [ $ key ] = $ value ; } return $ this ; } | Set the value of a field |
42,201 | public function equals ( $ o ) { return ( get_class ( $ this ) == get_class ( $ o ) && $ this -> id ( ) == $ o -> id ( ) ) ; } | Verify equality with another object |
42,202 | public static function getLogEvent ( $ event , $ time = null , $ ipAdd = null ) { return array ( $ event . '_time' => isset ( $ time ) ? $ time : time ( ) , $ event . '_date' => isset ( $ time ) ? sqlDatetime ( $ time ) : sqlDatetime ( ) , $ event . '_ip' => isset ( $ ipAdd ) ? $ ipAdd : ( ! empty ( $ _SERVER [ 'REMOTE_ADDR' ] ) ? $ _SERVER [ 'REMOTE_ADDR' ] : '127.0.0.1' ) , ) ; } | Get the log of an event |
42,203 | public static function isFieldEditable ( $ fieldName ) { if ( $ fieldName == static :: $ IDFIELD ) { return false ; } if ( ! is_null ( static :: $ editableFields ) ) { return in_array ( $ fieldName , static :: $ editableFields ) ; } if ( method_exists ( static :: $ validator , 'isFieldEditable' ) ) { return in_array ( $ fieldName , static :: $ editableFields ) ; } return in_array ( $ fieldName , static :: $ fields ) ; } | Test if field is editable |
42,204 | public static function get ( $ options = null ) { if ( $ options === null ) { return static :: select ( ) ; } if ( $ options instanceof SQLSelectRequest ) { $ options -> setSQLAdapter ( static :: getSQLAdapter ( ) ) ; $ options -> setIDField ( static :: $ IDFIELD ) ; $ options -> from ( static :: $ table ) ; return $ options -> run ( ) ; } if ( is_string ( $ options ) ) { $ args = func_get_args ( ) ; $ options = array ( ) ; foreach ( array ( 'where' , 'orderby' ) as $ i => $ key ) { if ( ! isset ( $ args [ $ i ] ) ) { break ; } $ options [ $ key ] = $ args [ $ i ] ; } } $ options [ 'table' ] = static :: $ table ; if ( ! isset ( $ options [ 'output' ] ) ) { $ options [ 'output' ] = SQLAdapter :: ARR_OBJECTS ; } $ onlyOne = $ objects = 0 ; if ( in_array ( $ options [ 'output' ] , array ( SQLAdapter :: ARR_OBJECTS , SQLAdapter :: OBJECT ) ) ) { if ( $ options [ 'output' ] == SQLAdapter :: OBJECT ) { $ options [ 'number' ] = 1 ; $ onlyOne = 1 ; } $ options [ 'output' ] = SQLAdapter :: ARR_ASSOC ; $ objects = 1 ; } $ sqlAdapter = static :: getSQLAdapter ( ) ; $ r = $ sqlAdapter -> select ( $ options ) ; if ( empty ( $ r ) && in_array ( $ options [ 'output' ] , array ( SQLAdapter :: ARR_ASSOC , SQLAdapter :: ARR_OBJECTS , SQLAdapter :: ARR_FIRST ) ) ) { return $ onlyOne && $ objects ? null : array ( ) ; } if ( ! empty ( $ r ) && $ objects ) { if ( $ onlyOne ) { $ r = static :: load ( $ r [ 0 ] ) ; } else { foreach ( $ r as & $ rdata ) { $ rdata = static :: load ( $ rdata ) ; } } } return $ r ; } | Get some permanent objects |
42,205 | public static function load ( $ in , $ nullable = true , $ usingCache = true ) { if ( empty ( $ in ) ) { if ( $ nullable ) { return null ; } static :: throwNotFound ( 'invalidParameter_load' ) ; } if ( is_object ( $ in ) && $ in instanceof static ) { return $ in ; } $ IDFIELD = static :: $ IDFIELD ; if ( is_array ( $ in ) ) { $ id = $ in [ $ IDFIELD ] ; $ data = $ in ; } else { $ id = $ in ; } if ( ! is_ID ( $ id ) ) { static :: throwException ( 'invalidID' ) ; } if ( $ usingCache && isset ( static :: $ instances [ static :: getClass ( ) ] [ $ id ] ) ) { return static :: $ instances [ static :: getClass ( ) ] [ $ id ] ; } if ( empty ( $ data ) ) { $ obj = static :: get ( array ( 'where' => $ IDFIELD . '=' . $ id , 'output' => SQLAdapter :: OBJECT , ) ) ; if ( empty ( $ obj ) ) { if ( $ nullable ) { return null ; } static :: throwNotFound ( ) ; } } else { $ obj = new static ( $ data ) ; } return $ usingCache ? $ obj -> checkCache ( ) : $ obj ; } | Load a permanent object |
42,206 | protected function checkCache ( ) { if ( isset ( static :: $ instances [ static :: getClass ( ) ] [ $ this -> id ( ) ] ) ) { return static :: $ instances [ static :: getClass ( ) ] [ $ this -> id ( ) ] ; } static :: $ instances [ static :: getClass ( ) ] [ $ this -> id ( ) ] = $ this ; return $ this ; } | Check if this object is cached and cache it |
42,207 | public static function clearDeletedInstances ( ) { if ( ! isset ( static :: $ instances [ static :: getClass ( ) ] ) ) { return ; } $ instances = & static :: $ instances [ static :: getClass ( ) ] ; foreach ( $ instances as $ id => $ obj ) { if ( $ obj -> isDeleted ( ) ) { unset ( $ instances [ $ id ] ) ; } } } | Remove deleted instances from cache |
42,208 | public static function escapeIdentifier ( $ identifier = null ) { $ sqlAdapter = static :: getSQLAdapter ( ) ; return $ sqlAdapter -> escapeIdentifier ( $ identifier ? $ identifier : static :: $ table ) ; } | Escape identifier through instance |
42,209 | public static function getCreateOperation ( $ input , $ fields ) { $ operation = new CreateTransactionOperation ( static :: getClass ( ) , $ input , $ fields ) ; $ operation -> setSQLAdapter ( static :: getSQLAdapter ( ) ) ; return $ operation ; } | Get the create operation |
42,210 | public static function onValidCreate ( & $ input , $ newErrors ) { if ( $ newErrors ) { static :: throwException ( 'errorCreateChecking' ) ; } static :: fillLogEvent ( $ input , 'create' ) ; static :: fillLogEvent ( $ input , 'edit' ) ; return true ; } | Callback when validating create |
42,211 | public static function extractCreateQuery ( & $ input ) { static :: onEdit ( $ input , null ) ; foreach ( $ input as $ fieldname => $ fieldvalue ) { if ( ! in_array ( $ fieldname , static :: $ fields ) ) { unset ( $ input [ $ fieldname ] ) ; } } $ options = array ( 'table' => static :: $ table , 'what' => $ input , ) ; return $ options ; } | Extract a create query from this class |
42,212 | public static function completeFields ( $ data ) { foreach ( static :: $ fields as $ fieldname ) { if ( ! isset ( $ data [ $ fieldname ] ) ) { $ data [ $ fieldname ] = '' ; } } return $ data ; } | Complete missing fields |
42,213 | public static function checkUserInput ( $ input , $ fields = null , $ ref = null , & $ errCount = 0 ) { if ( ! isset ( $ errCount ) ) { $ errCount = 0 ; } if ( is_array ( static :: $ validator ) ) { if ( $ fields === null ) { $ fields = static :: $ editableFields ; } if ( empty ( $ fields ) ) { return array ( ) ; } $ data = array ( ) ; foreach ( $ fields as $ field ) { if ( $ field == static :: $ IDFIELD ) { continue ; } $ value = $ notset = null ; try { try { if ( ! empty ( static :: $ validator [ $ field ] ) ) { $ checkMeth = static :: $ validator [ $ field ] ; $ value = static :: $ checkMeth ( $ input , $ ref ) ; } else if ( array_key_exists ( $ field , $ input ) ) { $ value = $ input [ $ field ] ; } else { $ notset = 1 ; } if ( ! isset ( $ notset ) && ( $ ref === null || $ value != $ ref -> $ field ) && ( $ fields === null || in_array ( $ field , $ fields ) ) ) { $ data [ $ field ] = $ value ; } } catch ( UserException $ e ) { if ( $ value === null && isset ( $ input [ $ field ] ) ) { $ value = $ input [ $ field ] ; } throw InvalidFieldException :: from ( $ e , $ field , $ value ) ; } } catch ( InvalidFieldException $ e ) { $ errCount ++ ; reportError ( $ e , static :: getDomain ( ) ) ; } } return $ data ; } else if ( is_object ( static :: $ validator ) ) { if ( method_exists ( static :: $ validator , 'validate' ) ) { return static :: $ validator -> validate ( $ input , $ fields , $ ref , $ errCount ) ; } } return array ( ) ; } | Check user input |
42,214 | public static function getClassData ( & $ classData = null ) { $ class = static :: getClass ( ) ; if ( ! isset ( static :: $ knownClassData [ $ class ] ) ) { static :: $ knownClassData [ $ class ] = ( object ) array ( 'sqlAdapter' => null , ) ; } $ classData = static :: $ knownClassData [ $ class ] ; return $ classData ; } | Get all gathered data about this class |
42,215 | public static function getSQLAdapter ( ) { $ classData = null ; static :: getClassData ( $ classData ) ; if ( ! isset ( $ classData -> sqlAdapter ) || ! $ classData -> sqlAdapter ) { $ classData -> sqlAdapter = SQLAdapter :: getInstance ( static :: $ DBInstance ) ; } return $ classData -> sqlAdapter ; } | Get the SQL Adapter of this class |
42,216 | public function offsetGet ( $ name ) { $ name = $ this -> resolveAlias ( $ name ) ; if ( ! $ this -> offsetExists ( $ name ) ) { return null ; } return parent :: offsetGet ( $ name ) ; } | Get an option by name . |
42,217 | public function setAlias ( $ aliases , $ option ) { $ aliases = ( array ) $ aliases ; foreach ( $ aliases as $ alias ) { $ this -> aliases [ $ alias ] = $ option ; } return $ this ; } | Set Alias of an option . |
42,218 | protected function resolveAlias ( $ alias ) { if ( ! empty ( $ this -> aliases [ $ alias ] ) ) { return $ this -> aliases [ $ alias ] ; } return $ alias ; } | Resolve alias for an option . |
42,219 | public function renderSections ( $ sections = null ) { if ( $ sections === null ) { $ sections = $ this -> getSections ( ) ; } $ res = '' ; foreach ( $ sections as $ section ) { $ res .= $ this -> renderSection ( $ section ) ; } return $ res ; } | Render all configured sections . |
42,220 | public function renderBadges ( ) { $ badges = $ this -> badges ; if ( ! $ badges ) { return '' ; } $ pm = $ this -> take ( 'package' ) -> getPackageManager ( ) ; $ res = '' ; foreach ( $ badges as $ badge => $ tpl ) { if ( ! $ tpl ) { $ tpl = $ this -> knownBadges [ $ badge ] ; } if ( $ tpl === 'disabled' ) { continue ; } $ res .= $ this -> renderBadge ( $ tpl ) . "\n" ; } return $ res ? "\n$res" : '' ; } | Render all configured badges . |
42,221 | public function renderBadge ( $ template ) { $ tpl = $ this -> getTwig ( ) -> createTemplate ( $ template ) ; return $ tpl -> render ( [ 'app' => Yii :: $ app ] ) ; } | Render badge by given template . |
42,222 | public function getTwig ( ) { if ( $ this -> _twig === null ) { $ this -> _twig = new \ Twig_Environment ( new \ Twig_Loader_Array ( ) ) ; } return $ this -> _twig ; } | Twig getter . |
42,223 | public static function factory ( EventRegistration $ registration ) { $ email = new self ( ) ; $ siteconfig = SiteConfig :: current_site_config ( ) ; $ email -> setTo ( $ registration -> Email ) ; $ email -> setSubject ( sprintf ( 'Registration Details For %s (%s)' , $ registration -> Event ( ) -> Title , $ siteconfig -> Title ) ) ; $ email -> populateTemplate ( array ( 'Registration' => $ registration , 'SiteConfig' => $ siteconfig ) ) ; singleton ( get_class ( ) ) -> extend ( 'updateEmail' , $ email , $ registration ) ; return $ email ; } | Creates an email instance from a registration object . |
42,224 | public function loadData ( $ installModel ) { $ this -> is_active = false ; $ this -> create_at = new Expression ( 'NOW()' ) ; $ this -> module_id = $ installModel -> moduleId ; $ this -> parent_uid = $ installModel -> parentUid ; $ fileBody = file_get_contents ( $ installModel -> moduleClassFile -> tempName ) ; $ regexp = "/namespace[ \t]+([^;]+);/" ; $ n = preg_match ( $ regexp , $ fileBody , $ found ) ; if ( $ n < 1 ) { $ this -> addError ( 'module_class' , $ error = Yii :: t ( $ this -> tc , "Can't find namespace in module class file" ) ) ; return ; } else { $ this -> module_class = $ found [ 1 ] . "\\" . basename ( $ installModel -> moduleClassFile -> name , '.php' ) ; $ cmd = "return {$this->module_class}::className();" ; if ( function_exists ( 'runkit_lint' ) && ! runkit_lint ( $ cmd ) ) { $ this -> addError ( 'module_class' , $ error = Yii :: t ( $ this -> tc , 'Module class file has errors' ) ) ; return ; } try { $ className = @ eval ( $ cmd ) ; if ( $ className != $ this -> module_class ) { $ this -> addError ( 'module_class' , $ error = Yii :: t ( $ this -> tc , 'Bad module class file' ) ) ; return ; } } catch ( Exception $ e ) { $ this -> addError ( 'module_class' , $ error = Yii :: t ( $ this -> tc , $ e -> getMessage ( ) ) ) ; return ; } $ configDefault = $ this -> buildDefaultConfig ( $ this -> module_class ) ; $ this -> config_default = var_export ( $ configDefault , true ) ; $ this -> name = empty ( $ configDefault [ 'params' ] [ 'label' ] ) ? ( 'Module ' . dirname ( $ this -> module_class ) ) : $ configDefault [ 'params' ] [ 'label' ] ; $ config = [ ] ; if ( isset ( $ configDefault [ 'params' ] ) ) { $ config [ 'params' ] = $ configDefault [ 'params' ] ; } if ( isset ( $ configDefault [ 'routesConfig' ] ) ) { $ config [ 'routesConfig' ] = $ configDefault [ 'routesConfig' ] ; } else { } $ this -> config_text = var_export ( $ config , true ) ; } } | Load data from install model |
42,225 | protected static function isActive ( $ dbId ) { if ( ! isset ( static :: $ _modulesData [ $ dbId ] ) ) { $ result = static :: findOne ( $ dbId ) ; static :: $ _modulesData [ $ dbId ] = $ result ; } if ( empty ( static :: $ _modulesData [ $ dbId ] ) ) { return false ; } else { $ isActive = static :: $ _modulesData [ $ dbId ] -> is_active ; return $ isActive ; } } | Check if active dynamicly attached module |
42,226 | public function hasUnactiveContainer ( ) { $ parent = $ this -> parent_uid ; if ( preg_match_all ( '|\{(\d+)\}|' , $ parent , $ matches ) ) { if ( ! empty ( $ matches [ 1 ] ) ) { foreach ( $ matches [ 1 ] as $ nextDbId ) { if ( ! static :: isActive ( $ nextDbId ) ) return true ; } } } return false ; } | Check if this module has unactive container |
42,227 | public function correctParents ( $ oldSubmodulesParentUid , $ newSubmodulesParentUid ) { if ( $ oldSubmodulesParentUid === $ newSubmodulesParentUid ) return ; $ query = static :: find ( ) -> where ( [ 'like' , 'parent_uid' , "{$oldSubmodulesParentUid}%" , false ] ) ; $ list = $ query -> all ( ) ; foreach ( $ list as $ item ) { if ( 0 === strpos ( $ item -> parent_uid , $ oldSubmodulesParentUid ) ) { $ item -> parent_uid = $ newSubmodulesParentUid . mb_substr ( $ item -> parent_uid , mb_strlen ( $ oldSubmodulesParentUid ) ) ; $ item -> save ( ) ; } } } | Correct parent_uid chain if module - container change it s own name or container |
42,228 | private function processStreamCallback ( string $ task , ... $ params ) { if ( ! isset ( $ this -> stream ) ) { throw new \ RuntimeException ( 'Stream is detached' ) ; } $ task = strtolower ( $ task ) ; $ fn = 'f' ; if ( $ this -> streamType === 'ZLIB' ) { if ( $ task === 'stat' ) { return false ; } $ fn = 'gz' ; } $ fn .= $ task ; if ( ! function_exists ( $ fn ) ) { return false ; } switch ( $ task ) { case 'seek' : case 'write' : if ( $ task === 'seek' && ! $ this -> seekable ) { throw new \ RuntimeException ( 'Stream is not seekable' ) ; } elseif ( $ task === 'write' && ! $ this -> writable ) { throw new \ RuntimeException ( 'Cannot write to a non-writable stream' ) ; } if ( isset ( $ params [ 1 ] ) ) { return $ fn ( $ this -> stream , $ params [ 0 ] , $ params [ 1 ] ) ; } return $ fn ( $ this -> stream , $ params [ 0 ] ) ; case 'read' : return $ fn ( $ this -> stream , $ params [ 0 ] ) ; default : return $ fn ( $ this -> stream , ... $ params ) ; } } | Helper callback processor |
42,229 | public function checkBoxRow ( $ model , $ attribute , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_CHECKBOX , $ model , $ attribute , null , $ htmlOptions ) ; } | Renders a checkbox input row . |
42,230 | public function toggleButtonRow ( $ model , $ attribute , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_TOGGLEBUTTON , $ model , $ attribute , null , $ htmlOptions ) ; } | Renders a toggle input row . |
42,231 | public function checkBoxListRow ( $ model , $ attribute , $ data = array ( ) , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_CHECKBOXLIST , $ model , $ attribute , $ data , $ htmlOptions ) ; } | Renders a checkbox list input row . |
42,232 | public function checkBoxListInlineRow ( $ model , $ attribute , $ data = array ( ) , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_CHECKBOXLIST_INLINE , $ model , $ attribute , $ data , $ htmlOptions ) ; } | Renders a checkbox list inline input row . |
42,233 | public function dropDownListRow ( $ model , $ attribute , $ data = array ( ) , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_DROPDOWN , $ model , $ attribute , $ data , $ htmlOptions ) ; } | Renders a drop - down list input row . |
42,234 | public function fileFieldRow ( $ model , $ attribute , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_FILE , $ model , $ attribute , null , $ htmlOptions ) ; } | Renders a file field input row . |
42,235 | public function passwordFieldRow ( $ model , $ attribute , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_PASSWORD , $ model , $ attribute , null , $ htmlOptions ) ; } | Renders a password field input row . |
42,236 | public function radioButtonRow ( $ model , $ attribute , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_RADIO , $ model , $ attribute , null , $ htmlOptions ) ; } | Renders a radio button input row . |
42,237 | public function radioButtonListRow ( $ model , $ attribute , $ data = array ( ) , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_RADIOLIST , $ model , $ attribute , $ data , $ htmlOptions ) ; } | Renders a radio button list input row . |
42,238 | public function radioButtonListInlineRow ( $ model , $ attribute , $ data = array ( ) , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_RADIOLIST_INLINE , $ model , $ attribute , $ data , $ htmlOptions ) ; } | Renders a radio button list inline input row . |
42,239 | public function radioButtonGroupsListRow ( $ model , $ attribute , $ data = array ( ) , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_RADIOBUTTONGROUPSLIST , $ model , $ attribute , $ data , $ htmlOptions ) ; } | Renders a radio button list input row using Button Groups . |
42,240 | public function textFieldRow ( $ model , $ attribute , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_TEXT , $ model , $ attribute , null , $ htmlOptions ) ; } | Renders a text field input row . |
42,241 | public function textAreaRow ( $ model , $ attribute , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_TEXTAREA , $ model , $ attribute , null , $ htmlOptions ) ; } | Renders a text area input row . |
42,242 | public function redactorRow ( $ model , $ attribute , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_REDACTOR , $ model , $ attribute , null , $ htmlOptions ) ; } | Renders a WYSIWYG redactor editor |
42,243 | public function markdownEditorRow ( $ model , $ attribute , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_MARKDOWNEDITOR , $ model , $ attribute , null , $ htmlOptions ) ; } | Renders a WYSIWYG Markdown editor |
42,244 | public function html5EditorRow ( $ model , $ attribute , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_HTML5EDITOR , $ model , $ attribute , null , $ htmlOptions ) ; } | Renders a WYSIWYG bootstrap editor |
42,245 | public function ckEditorRow ( $ model , $ attribute , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_CKEDITOR , $ model , $ attribute , null , $ htmlOptions ) ; } | Renders a WYSIWYG ckeditor |
42,246 | public function captchaRow ( $ model , $ attribute , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_CAPTCHA , $ model , $ attribute , null , $ htmlOptions ) ; } | Renders a captcha row . |
42,247 | public function uneditableRow ( $ model , $ attribute , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_UNEDITABLE , $ model , $ attribute , null , $ htmlOptions ) ; } | Renders an uneditable text field row . |
42,248 | public function datepickerRow ( $ model , $ attribute , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_DATEPICKER , $ model , $ attribute , null , $ htmlOptions ) ; } | Renders a datepicker field row . |
42,249 | public function colorpickerRow ( $ model , $ attribute , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_COLORPICKER , $ model , $ attribute , null , $ htmlOptions ) ; } | Renders a colorpicker field row . |
42,250 | public function timepickerRow ( $ model , $ attribute , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_TIMEPICKER , $ model , $ attribute , null , $ htmlOptions ) ; } | Renders a timepicker field row . |
42,251 | public function select2Row ( $ model , $ attribute , $ htmlOptions = array ( ) ) { return $ this -> inputRow ( CiiInput :: TYPE_SELECT2 , $ model , $ attribute , null , $ htmlOptions ) ; } | Renders a select2 field row |
42,252 | public function radioButtonGroupsList ( $ model , $ attribute , $ data , $ htmlOptions = array ( ) ) { $ buttons = array ( ) ; $ scripts = array ( ) ; $ hiddenFieldId = CHtml :: getIdByName ( get_class ( $ model ) . '[' . $ attribute . ']' ) ; $ buttonType = isset ( $ htmlOptions [ 'type' ] ) ? $ htmlOptions [ 'type' ] : null ; foreach ( $ data as $ key => $ value ) { $ btnId = CHtml :: getIdByName ( get_class ( $ model ) . '[' . $ attribute . '][' . $ key . ']' ) ; $ button = array ( ) ; $ button [ 'label' ] = $ value ; $ button [ 'htmlOptions' ] = array ( 'value' => $ key , 'id' => $ btnId , 'class' => ( isset ( $ model -> $ attribute ) && $ model -> $ attribute == $ key ? 'active' : '' ) , ) ; $ buttons [ ] = $ button ; $ scripts [ ] = "\$('#" . $ btnId . "').click(function(){ \$('#" . $ hiddenFieldId . "').val('" . $ key . "').trigger('change'); });" ; } Yii :: app ( ) -> controller -> widget ( 'bootstrap.widgets.CiiButtonGroup' , array ( 'buttonType' => 'button' , 'toggle' => 'radio' , 'htmlOptions' => $ htmlOptions , 'buttons' => $ buttons , 'type' => $ buttonType , ) ) ; echo $ this -> hiddenField ( $ model , $ attribute ) ; Yii :: app ( ) -> clientScript -> registerScript ( 'radiobuttongrouplist-' . $ attribute , implode ( "\n" , $ scripts ) ) ; } | Renders a radio button list for a model attribute using Button Groups . |
42,253 | public function inputRow ( $ type , $ model , $ attribute , $ data = null , $ htmlOptions = array ( ) ) { ob_start ( ) ; Yii :: app ( ) -> controller -> widget ( $ this -> getInputClassName ( ) , array ( 'type' => $ type , 'form' => $ this , 'model' => $ model , 'attribute' => $ attribute , 'data' => $ data , 'htmlOptions' => $ htmlOptions , ) ) ; return ob_get_clean ( ) ; } | Creates an input row of a specific type . |
42,254 | protected function getInputClassName ( ) { if ( isset ( $ this -> input ) ) return $ this -> input ; else { switch ( $ this -> type ) { case self :: TYPE_HORIZONTAL : return self :: INPUT_HORIZONTAL ; break ; case self :: TYPE_INLINE : return self :: INPUT_INLINE ; break ; case self :: TYPE_SEARCH : return self :: INPUT_SEARCH ; break ; case self :: TYPE_VERTICAL : default : return self :: INPUT_VERTICAL ; break ; } } } | Returns the input widget class name suitable for the form . |
42,255 | public function send ( ) { $ settings = Application :: getSettings ( ) -> mail ; $ mailTransport = new Transport ( @ $ settings -> smtp -> host ? : 'localhost' , @ $ settings -> smtp -> port ? : 25 , @ $ settings -> smtp -> timeout ? : 15 ) ; $ mailTransport -> setUser ( @ $ settings -> smtp -> user , @ $ settings -> smtp -> password ) ; $ mailTransport -> addMessage ( $ this ) ; $ mailTransport -> send ( ) ; } | Sends the current mail message . |
42,256 | private function walk ( callable $ cb ) { foreach ( $ this -> values ( ) as $ key => $ value ) { $ cb ( $ key , $ value ) ; } } | Apply a callback to each input value |
42,257 | protected function setDefaultConfig ( ) { $ this -> config [ 'db.prefix' ] = '' ; $ this -> config [ 'env.id' ] = 'default' ; $ this -> config [ 'env.class' ] = 'eMapper\Dynamic\Environment\DynamicSQLEnvironment' ; $ this -> config [ 'depth.current' ] = 0 ; $ this -> config [ 'depth.limit' ] = 1 ; $ this -> config [ 'cache.metakey' ] = '__cache__' ; } | Applies default configuration options |
42,258 | public function addType ( $ type , TypeHandler $ typeHandler , $ alias = null ) { $ this -> typeManager -> setTypeHandler ( $ type , $ typeHandler ) ; if ( ! is_null ( $ alias ) ) { if ( is_array ( $ alias ) ) { foreach ( $ alias as $ al ) $ this -> typeManager -> addAlias ( $ type , $ al ) ; } else $ this -> typeManager -> addAlias ( $ type , $ alias ) ; } } | Adds a new type handler |
42,259 | public function sql ( $ query , $ args = [ ] ) { if ( ! is_string ( $ query ) || empty ( $ query ) ) throw new \ InvalidArgumentException ( "Query is not a valid string" ) ; $ this -> driver -> connect ( ) ; $ stmt = $ this -> driver -> buildStatement ( $ this -> typeManager ) ; $ query = $ stmt -> format ( $ query , $ args , $ this -> config ) ; if ( $ this -> hasOption ( 'callback.debug' ) ) { $ callback = $ this -> getOption ( 'callback.debug' ) ; if ( $ callback instanceof \ Closure ) $ callback -> __invoke ( $ query ) ; } $ result = $ this -> driver -> query ( $ query ) ; if ( $ result === false ) $ this -> driver -> throwQueryException ( $ stmt ) ; return $ result ; } | Runs a query |
42,260 | public function query ( $ query ) { $ args = func_get_args ( ) ; $ query = array_shift ( $ args ) ; return $ this -> execute ( $ query , $ args ) ; } | Executes a query with the given arguments |
42,261 | public function beginTransaction ( ) { $ this -> connect ( ) ; if ( $ this -> txStatus == self :: TX_NOT_STARTED ) { $ this -> txStatus = self :: TX_STARTED ; $ this -> txCounter = 1 ; return $ this -> driver -> begin ( ) ; } $ this -> txCounter ++ ; return false ; } | Begins a transaction |
42,262 | public function commit ( ) { if ( $ this -> txStatus == self :: TX_STARTED && $ this -> txCounter == 1 ) { $ this -> txStatus = self :: TX_NOT_STARTED ; $ this -> txCounter = 0 ; return $ this -> driver -> commit ( ) ; } $ this -> txCounter -- ; return false ; } | Commits current transaction |
42,263 | public function rollback ( ) { $ this -> txStatus = self :: TX_NOT_STARTED ; $ this -> txCounter = 0 ; return $ this -> driver -> rollback ( ) ; } | Rollbacks current transaction |
42,264 | public function newManager ( $ classname ) { $ profile = Profiler :: getClassProfile ( $ classname ) ; if ( ! $ profile -> isEntity ( ) ) throw new \ InvalidArgumentException ( sprintf ( "Class %s is not declared as an entity" , $ profile -> reflectionClass -> getName ( ) ) ) ; return new Manager ( $ this , $ profile ) ; } | Returns a new Manager instance |
42,265 | public function main ( ) { $ this -> prepareProjectData ( ) ; $ this -> getInfoSourceFiles ( ) ; $ this -> getInfoResourceFiles ( ) ; $ this -> preparePlaceHolders ( ) ; $ this -> processingSourceFiles ( ) ; $ this -> processResourceFiles ( ) ; if ( $ this -> gzipFlag ) $ this -> gzipCompressOptimizedResourceFiles ( ) ; $ this -> unlinkResourceFiles ( ) ; } | Main method of this Phing task . |
42,266 | protected function getClasses ( string $ phpCode ) : array { $ tokens = token_get_all ( $ phpCode ) ; $ mode = '' ; $ namespace = '' ; $ classes = [ ] ; foreach ( $ tokens as $ i => $ token ) { if ( is_array ( $ token ) && $ token [ 0 ] == T_NAMESPACE ) { $ mode = 'namespace' ; $ namespace = '' ; continue ; } if ( is_array ( $ token ) && in_array ( $ token [ 0 ] , [ T_CLASS , T_INTERFACE , T_TRAIT ] ) ) { $ mode = 'class' ; continue ; } if ( $ mode == 'namespace' ) { if ( is_array ( $ token ) && in_array ( $ token [ 0 ] , [ T_STRING , T_NS_SEPARATOR ] ) ) { $ namespace .= $ token [ 1 ] ; } elseif ( is_array ( $ token ) && $ token [ 0 ] == T_WHITESPACE ) { } elseif ( $ token === ';' ) { $ mode = '' ; } elseif ( $ token === '{' ) { throw new LogicException ( 'Bracketed syntax for namespace not supported.' ) ; } else { throw new LogicException ( "Unexpected token %s" , print_r ( $ token , true ) ) ; } } if ( $ mode == 'class' ) { if ( is_array ( $ token ) && $ token [ 0 ] == T_STRING ) { $ classes [ $ token [ 2 ] ] = [ 'namespace' => $ namespace , 'class' => $ token [ 1 ] , 'line' => $ token [ 2 ] ] ; $ mode = '' ; } } } return $ classes ; } | Returns an array with classes and namespaces defined in PHP code . |
42,267 | private function getInfoSourceFiles ( ) : void { $ this -> logVerbose ( 'Get resource files info.' ) ; $ dir = $ this -> getProject ( ) -> getReference ( $ this -> sourcesFilesetId ) -> getDir ( $ this -> getProject ( ) ) ; foreach ( $ this -> sourceFileNames as $ theFileName ) { $ filename = $ dir . '/' . $ theFileName ; $ real_path = realpath ( $ filename ) ; $ this -> sourceFilesInfo [ $ real_path ] = $ filename ; } $ suc = ksort ( $ this -> sourceFilesInfo ) ; if ( $ suc === false ) $ this -> logError ( "ksort failed." ) ; } | Gets full path for each source file in the source fileset . |
42,268 | private function getResourceFilesInSource ( string $ sourceFileContent ) : array { $ resource_files = [ ] ; foreach ( $ this -> getResourcesInfo ( ) as $ file_info ) { if ( strpos ( $ sourceFileContent , $ file_info [ 'path_name_in_sources_with_hash' ] ) !== false ) { $ resource_files [ ] = $ file_info ; } } return $ resource_files ; } | Returns an array with info about resource files referenced from a source file . |
42,269 | public function cache ( $ key , $ value , $ expire = null ) { $ this -> _caches [ $ key ] = $ value ; return true ; } | expire not supported . |
42,270 | public function handleDeleteAllImages ( ) : void { if ( $ this -> request -> isAjax ( ) ) { $ result = $ this -> getStorage ( ) -> delete ( ) ; foreach ( $ result as $ row ) { $ this -> imageStorage -> delete ( $ row ) ; } $ this -> redrawControl ( 'gallery' ) ; } else { throw new AbortException ; } } | Smaze vsechny obrazky z modelu |
42,271 | public function handleDeleteImages ( string $ json ) : void { if ( $ this -> request -> isAjax ( ) ) { $ data = Json :: decode ( $ json ) ; $ result = $ this -> getStorage ( ) -> delete ( $ data ) ; foreach ( $ result as $ row ) { $ this -> imageStorage -> delete ( $ row ) ; } $ this -> redrawControl ( 'gallery' ) ; } else { throw new AbortException ; } } | Smaze vybrane obrazky |
42,272 | public function handleNextImage ( int $ id ) : void { if ( $ this -> request -> isAjax ( ) ) { $ row = $ this -> getStorage ( ) -> getNext ( $ id ) ; if ( $ row ) { $ this -> template -> viewImage = $ row ; $ this -> redrawControl ( 'image' ) ; } else { throw new AbortException ; } } else { throw new AbortException ; } } | Zobrazi dalsi obrazek |
42,273 | public function handlePreviousImage ( int $ id ) : void { if ( $ this -> request -> isAjax ( ) ) { $ row = $ this -> getStorage ( ) -> getPrevious ( $ id ) ; if ( $ row ) { $ this -> template -> viewImage = $ row ; $ this -> redrawControl ( 'image' ) ; } else { throw new AbortException ; } } else { throw new AbortException ; } } | Zobrazi predchozi obrazek |
42,274 | public function handleUpdatePosition ( string $ json ) : void { if ( $ this -> request -> isAjax ( ) ) { $ data = Json :: decode ( $ json ) ; $ this -> getStorage ( ) -> updatePosition ( $ data ) ; } throw new AbortException ; } | Aktualizuje poradi obrazku |
42,275 | public function setForeignKey ( string $ keyName , int $ value ) : void { if ( $ this -> storage instanceof NetteDatabaseStorage ) { $ this -> storage -> setForeignKey ( $ keyName , $ value ) ; } elseif ( $ this -> storage instanceof NextrasOrmStorage ) { $ this -> storage -> setForeignKey ( $ keyName , $ value ) ; } else { throw new InvalidArgumentException ( 'Storage is not database' ) ; } } | Nastavi cizi klic |
42,276 | public function addAttribute ( $ name = null , $ value ) { if ( $ value ) { $ this -> attributes [ $ name ] = $ value ; } return $ this ; } | Defines an HTML attribute to add |
42,277 | public function setClass ( $ value ) { $ classes = [ ] ; foreach ( explode ( ' ' , $ value ) as $ class ) { $ classes [ $ class ] = $ class ; } $ this -> classes = $ classes ; return $ this ; } | Defines CSS classes |
42,278 | public function Render ( ) { $ string = $ this -> string ; $ tag = $ this -> tag ; $ classes = $ this -> classes ; if ( Count ( $ classes ) ) { if ( $ classPrefix = $ this -> classPrefix ) { foreach ( $ classes as $ key => $ value ) { $ prefixedClass = $ classPrefix . '__' . $ value ; $ classes [ $ prefixedClass ] = $ prefixedClass ; } } $ this -> addAttribute ( 'class' , implode ( ' ' , $ classes ) ) ; } if ( $ this -> isVoidElement ( ) && $ string ) { if ( $ voidAttributeName = $ this -> VoidElements [ $ tag ] ) { $ this -> addAttribute ( $ voidAttributeName , $ string ) ; } else { throw new InvalidArgumentException ( "Void element \"{$tag}\" cannot have string" ) ; } } $ attributes = [ ] ; foreach ( $ this -> attributes as $ name => $ value ) { $ attributes [ ] = sprintf ( '%s="%s"' , $ name , Convert :: raw2att ( $ value ) ) ; } $ attributes = Count ( $ attributes ) ? ' ' . implode ( ' ' , $ attributes ) : '' ; if ( $ this -> isVoidElement ( ) ) { return "<{$tag}{$attributes} />" ; } if ( ! isset ( $ string ) || ! $ string || $ string == '' ) { return null ; } return "<{$tag}{$attributes}>{$string}</{$tag}>" ; } | Returns the rendered html markup |
42,279 | public function get ( $ id ) { if ( isset ( $ this -> connections [ $ id ] ) ) { return $ this -> connections [ $ id ] ; } if ( ! isset ( $ this -> config [ $ id ] ) ) { throw new JAQBException ( 'No configuration or connection has been supplied for the ID "' . $ id . '".' ) ; } $ this -> connections [ $ id ] = $ this -> buildFromConfig ( $ this -> config [ $ id ] , $ id ) ; return $ this -> connections [ $ id ] ; } | Gets a database connection by ID . |
42,280 | public function getDefault ( ) { if ( $ this -> default ) { return $ this -> get ( $ this -> default ) ; } if ( 0 === count ( $ this -> config ) ) { if ( 1 === count ( $ this -> connections ) ) { $ this -> default = array_keys ( $ this -> connections ) [ 0 ] ; return $ this -> get ( $ this -> default ) ; } elseif ( count ( $ this -> connections ) > 1 ) { throw new JAQBException ( 'Could not determine the default connection because multiple connections were available and the default has not been set.' ) ; } throw new JAQBException ( 'The default connection is not available because no configurations have been supplied.' ) ; } if ( 1 === count ( $ this -> config ) ) { $ this -> default = array_keys ( $ this -> config ) [ 0 ] ; return $ this -> get ( $ this -> default ) ; } foreach ( $ this -> config as $ k => $ v ) { if ( array_value ( $ v , 'default' ) ) { $ this -> default = $ k ; return $ this -> get ( $ this -> default ) ; } } throw new JAQBException ( 'There is no default connection.' ) ; } | Gets the default database connection . |
42,281 | public function add ( $ id , QueryBuilder $ connection ) { if ( isset ( $ this -> connections [ $ id ] ) ) { throw new InvalidArgumentException ( 'A connection with the ID "' . $ id . '" already exists.' ) ; } $ this -> connections [ $ id ] = $ connection ; $ this -> default = false ; return $ this ; } | Adds a connection . |
42,282 | public function buildDsn ( array $ config , $ id ) { if ( ! isset ( $ config [ 'type' ] ) ) { throw new JAQBException ( 'Missing connection type for configuration "' . $ id . '"!' ) ; } $ dsn = $ config [ 'type' ] . ':' ; $ params = [ ] ; foreach ( self :: $ connectionParams as $ j => $ k ) { if ( isset ( $ config [ $ j ] ) ) { $ params [ ] = $ k . '=' . $ config [ $ j ] ; } } $ dsn .= implode ( ';' , $ params ) ; return $ dsn ; } | Builds a PDO DSN string from a JAQB connection configuration . |
42,283 | public function initializeUserSession ( WebRequest $ request , Response $ response , User $ user ) { if ( $ request -> getSessionData ( 'userUuid' ) !== false ) { $ sessionToken = $ request -> getSessionData ( 'userSessionToken' ) ; $ sessionTokenLifetime = $ request -> getSessionData ( 'userSessionTokenLifetime' ) ; $ this -> cleanupSession ( $ request ) ; if ( $ sessionToken !== false ) { $ request -> setSessionData ( 'oldUserSessionToken' , $ sessionToken ) ; $ request -> setSessionData ( 'oldUserSessionTokenLifetime' , $ sessionTokenLifetime ) ; } } $ this -> regenerateSession ( $ request ) ; $ sessionToken = md5 ( $ user -> getUuid ( ) ) . '-' . md5 ( uniqid ( ) ) ; $ sessionTokenLifeTime = time ( ) + 300 ; $ request -> setSessionData ( 'userUuid' , $ user -> getUuid ( ) ) ; $ request -> setSessionData ( 'userSessionToken' , $ sessionToken ) ; $ request -> setSessionData ( 'userSessionTokenLifetime' , $ sessionTokenLifeTime ) ; setcookie ( $ sessionToken , $ sessionTokenLifeTime , 0 , '/' , '' , $ request -> isSsl ( ) ) ; } | Initializes the user session |
42,284 | public function reinitializeSession ( Framework $ framework , WebRequest $ request , Response $ response ) { session_name ( 'ZTSM' ) ; session_start ( ) ; if ( $ request -> getSessionData ( 'sessionStarted' ) === false ) { $ this -> startSession ( $ request ) ; } $ valid = $ this -> validateSessionData ( $ request ) ; if ( ! $ valid ) { $ response -> redirectTo ( '' ) ; } if ( mt_rand ( 1 , 100 ) <= 1 ) { $ this -> regenerateSession ( $ request ) ; } if ( $ request -> getSessionData ( 'userUuid' ) !== false ) { $ this -> reinitializeUserSession ( $ framework , $ request , $ response ) ; } } | Initializes the session |
42,285 | public function logoutUser ( WebRequest $ request , Response $ response ) { $ this -> cleanupSession ( $ request ) ; $ request -> removeSession ( ) ; } | Logouts the logged in user |
42,286 | protected function reinitializeUserSession ( Framework $ framework , WebRequest $ request , Response $ response ) { $ token = $ request -> getSessionData ( 'userSessionToken' ) ; $ lifetime = $ request -> getSessionData ( 'userSessionTokenLifetime' ) ; list ( $ notValid , $ token , $ lifetime , $ userUuid ) = $ this -> verifyToken ( $ request , $ token , $ lifetime ) ; if ( $ notValid ) { $ this -> cleanupSession ( $ request ) ; $ this -> regenerateSession ( $ request ) ; return false ; } $ user = $ this -> userManager -> getUserForUuid ( $ userUuid ) ; if ( ! $ user -> hasAccess ( '\\Global\\*' ) && $ user -> hasAccess ( '\\Global\\Disabled' ) ) { return false ; } $ session = new Session ( $ user , $ token , $ lifetime ) ; $ request -> setSession ( $ session ) ; if ( $ lifetime - 30 < time ( ) ) { $ this -> initializeUserSession ( $ request , $ response , $ user ) ; } return true ; } | Verifies the session tokens and the session token life time and loads the user for the session . |
42,287 | protected function verifyToken ( WebRequest $ request , $ token , $ lifetime ) { $ notValid = false ; if ( $ request -> getCookieData ( $ token ) === false ) { $ notValid = true ; } if ( $ notValid && $ request -> getSessionData ( 'oldUserSessionToken' ) !== false ) { $ token = $ request -> getSessionData ( 'oldUserSessionToken' ) ; $ lifetime = $ request -> getSessionData ( 'oldUserSessionTokenLifetime' ) ; if ( $ request -> getCookieData ( $ token ) === false ) { $ notValid = true ; } } if ( ! $ notValid && $ request -> getCookieData ( $ token ) != $ lifetime ) { $ notValid = true ; } if ( ! $ notValid && $ lifetime < time ( ) - 1800 ) { $ notValid = true ; } $ userUuid = $ request -> getSessionData ( 'userUuid' ) ; if ( ! $ notValid && ! $ this -> userManager -> hasUserForUuid ( $ userUuid ) ) { $ notValid = true ; } return array ( $ notValid , $ token , $ lifetime , $ userUuid ) ; } | Verifies the given session token and lifetime |
42,288 | protected function startSession ( WebRequest $ request ) { $ request -> setSessionData ( 'nonceBase' , md5 ( uniqid ( ) ) ) ; $ request -> setSessionData ( 'ipAddress' , $ _SERVER [ 'REMOTE_ADDR' ] ) ; if ( isset ( $ _SERVER [ 'HTTP_USER_AGENT' ] ) ) { $ request -> setSessionData ( 'userAgent' , $ _SERVER [ 'HTTP_USER_AGENT' ] ) ; } $ request -> setSessionData ( 'sessionStarted' , true ) ; } | Starts the session and saves the base session informations . |
42,289 | protected function cleanupSession ( WebRequest $ request ) { $ sessionToken = $ request -> getSessionData ( 'userSessionToken' ) ; setcookie ( $ sessionToken , 0 , time ( ) - 60 , '/' , '' , $ request -> isSsl ( ) ) ; $ oldSessionToken = $ request -> getSessionData ( 'oldUserSessionToken' ) ; if ( $ oldSessionToken != '' ) { setcookie ( $ oldSessionToken , 0 , time ( ) - 60 , '/' , '' , $ request -> isSsl ( ) ) ; } $ request -> deleteSessionData ( 'userUuid' ) ; $ request -> deleteSessionData ( 'userSessionToken' ) ; $ request -> deleteSessionData ( 'userSessionTokenLifetime' ) ; $ request -> deleteSessionData ( 'oldUserSessionToken' ) ; $ request -> deleteSessionData ( 'oldUserSessionTokenLifetime' ) ; } | Removes all user and token data from the session |
42,290 | protected function validateSessionData ( WebRequest $ request ) { if ( $ request -> getSessionData ( 'isObsolete' ) && $ request -> getSessionData ( 'maxLifetime' ) < time ( ) ) { return false ; } return true ; } | Validates the session . If the session is obsolete and the max lieftime is reached the function will return false otherwise true . |
42,291 | protected function regenerateSession ( WebRequest $ request ) { $ request -> setSessionData ( 'isObsolete' , true ) ; $ request -> setSessionData ( 'maxLifetime' , time ( ) + 60 ) ; session_regenerate_id ( false ) ; $ newSessionId = session_id ( ) ; session_write_close ( ) ; session_id ( $ newSessionId ) ; session_start ( ) ; $ request -> deleteSessionData ( 'isObsolete' ) ; $ request -> deleteSessionData ( 'maxLifetime' ) ; } | Regenerates the session . It makes the old session id obsolete and generates a new session id . |
42,292 | public function addTimer ( Timer $ timer ) { if ( false === ( $ step = $ this -> currentStep ( ) ) ) { throw new \ Exception ( 'No current step' ) ; } $ step -> setTimer ( $ timer ) ; return $ this ; } | Add timer to current step |
42,293 | public function addMessage ( string $ message ) { if ( false === ( $ step = $ this -> currentStep ( ) ) ) { throw new \ Exception ( 'No current step' ) ; } $ step -> addMessage ( $ message ) ; return $ this ; } | Add message to current step |
42,294 | public function getFile ( string $ id ) : ? FileResponse { $ log = $ this -> getLog ( $ id ) ; if ( $ log ) { $ file = $ log -> name ; if ( Strings :: endsWith ( $ file , '.html' ) ) { $ contentType = 'text/html' ; } else { $ contentType = 'text/plain' ; } return new FileResponse ( $ this -> path . $ file , $ file , $ contentType , false ) ; } return null ; } | Vrati soubor ke stazeni |
42,295 | public function add ( string $ email , string $ name = null ) : void { $ recipient = $ this -> make ( ) ; $ recipient -> email = $ email ; if ( $ name !== null ) { $ recipient -> name = $ name ; } $ this -> set ( $ recipient ) ; } | Add a recipient . |
42,296 | public function register ( ) { $ this -> app -> singleton ( 'Ooglee\Domain\Contracts\IHashingService' , function ( $ app ) { $ hasher = \ Config :: get ( 'ooglee::ioc.app.hasher' ) ; return new HashingService ( new $ hasher ) ; } ) ; } | Registers the service in the IoC Container |
42,297 | private function checkComposer ( ) { $ composerJsonDetected = false ; $ composerLockDetected = false ; foreach ( GitUtils :: extractCommitedFiles ( ) as $ file ) { if ( $ file === 'composer.json' ) { $ composerJsonDetected = true ; } if ( $ file === 'composer.lock' ) { $ composerLockDetected = true ; } } if ( $ composerJsonDetected && ! $ composerLockDetected ) { $ this -> output -> writeln ( '<bg=yellow;fg=black> composer.lock must be commited if composer.json is modified! </bg=yellow;fg=black>' ) ; } } | Check composer . json and composer . lock files |
42,298 | public function rm ( string $ directory ) : bool { if ( is_dir ( $ directory ) ) { foreach ( new DirectoryIterator ( Path :: replaceOSSeparator ( $ directory ) ) as $ fileInfo ) { if ( ! $ fileInfo -> isDot ( ) ) { if ( $ fileInfo -> isDir ( ) ) { $ this -> rm ( $ fileInfo -> getPathname ( ) ) ; @ rmdir ( $ fileInfo -> getPathname ( ) ) ; } else if ( $ fileInfo -> isFile ( ) ) { @ unlink ( $ fileInfo -> getPathname ( ) ) ; } } } @ rmdir ( $ directory ) ; } return ! file_exists ( $ directory ) ; } | - Delete directory and sub directory recursive |
42,299 | public function getLayoutPath ( ) { $ ref = new \ ReflectionClass ( $ this ) ; return dirname ( dirname ( $ ref -> getFileName ( ) ) ) . '/views/layouts/' . $ this -> layout . '.php' ; } | get layouts path |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.