idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
21,300
public function RegisterNewMethod ( $ NewMethodClassName , $ NewMethodName , $ EventClassName = '' , $ EventName = '' ) { $ NewMethodKey = $ NewMethodClassName . '.' . $ NewMethodName ; $ EventKey = strtolower ( $ EventClassName == '' ? $ NewMethodName : $ EventClassName . '_' . $ EventName . '_Create' ) ; if ( array_key_exists ( $ EventKey , $ this -> _NewMethodCollection ) === TRUE ) { trigger_error ( 'New object methods must be unique. The new "' . $ EventKey . '" method has already been assigned by the "' . $ this -> _NewMethodCollection [ $ EventKey ] . '" plugin. It cannot also be assigned by the "' . $ NewMethodClassName . '" plugin.' , E_USER_NOTICE ) ; return ; } $ this -> _NewMethodCollection [ $ EventKey ] = $ NewMethodKey ; }
Registers a plugin new method .
21,301
public function CallEventHandlers ( $ Sender , $ EventClassName , $ EventName , $ EventHandlerType = 'Handler' , $ Options = array ( ) ) { $ Return = FALSE ; if ( $ this -> CallEventHandler ( $ Sender , $ EventClassName , $ EventName , $ EventHandlerType ) ) $ Return = TRUE ; if ( $ this -> CallEventHandler ( $ Sender , 'Base' , $ EventName , $ EventHandlerType ) ) $ Return = TRUE ; $ WildEventKey = $ EventClassName . '_' . $ EventName . '_' . $ EventHandlerType ; if ( $ this -> CallEventHandler ( $ Sender , 'Base' , 'All' , $ EventHandlerType , $ WildEventKey ) ) $ Return = TRUE ; if ( $ this -> CallEventHandler ( $ Sender , $ EventClassName , 'All' , $ EventHandlerType , $ WildEventKey ) ) $ Return = TRUE ; return $ Return ; }
Transfer control to the plugins
21,302
public function HasMethodOverride ( $ ClassName , $ MethodName ) { return array_key_exists ( strtolower ( $ ClassName . '_' . $ MethodName . '_Override' ) , $ this -> _MethodOverrideCollection ) ? TRUE : FALSE ; }
Checks to see if there are any plugins that override the method being executed .
21,303
public function GetCallback ( $ ClassName , $ MethodName , $ Type = 'Create' ) { $ EventKey = strtolower ( "{$ClassName}_{$MethodName}_{$Type}" ) ; switch ( $ Type ) { case 'Create' : $ MethodKey = GetValue ( $ EventKey , $ this -> _NewMethodCollection ) ; break ; case 'Override' : $ MethodKey = GetValue ( $ EventKey , $ this -> _MethodOverrideCollection ) ; break ; } $ Parts = explode ( '.' , $ MethodKey , 2 ) ; if ( count ( $ Parts ) != 2 ) return FALSE ; list ( $ ClassName , $ MethodName ) = $ Parts ; $ Instance = $ this -> GetPluginInstance ( $ ClassName , self :: ACCESS_CLASSNAME ) ; return array ( $ Instance , $ MethodName ) ; }
Get the callback for an event handler .
21,304
public function HasNewMethod ( $ ClassName , $ MethodName ) { $ Key = strtolower ( $ ClassName . '_' . $ MethodName . '_Create' ) ; if ( array_key_exists ( $ Key , $ this -> _NewMethodCollection ) ) { $ Result = explode ( '.' , $ this -> _NewMethodCollection [ $ Key ] ) ; return $ Result [ 0 ] ; } else { return FALSE ; } }
Checks to see if there are any plugins that create the method being executed .
21,305
private function _PluginHook ( $ PluginName , $ ForAction , $ Callback = FALSE ) { switch ( $ ForAction ) { case self :: ACTION_ENABLE : $ HookMethod = 'Setup' ; break ; case self :: ACTION_DISABLE : $ HookMethod = 'OnDisable' ; break ; case self :: ACTION_REMOVE : $ HookMethod = 'CleanUp' ; break ; case self :: ACTION_ONLOAD : $ HookMethod = 'OnLoad' ; break ; } $ PluginInfo = ArrayValue ( $ PluginName , $ this -> AvailablePlugins ( ) , FALSE ) ; $ PluginFolder = ArrayValue ( 'Folder' , $ PluginInfo , FALSE ) ; $ PluginClassName = ArrayValue ( 'ClassName' , $ PluginInfo , FALSE ) ; if ( $ ForAction === self :: ACTION_REMOVE ) { $ this -> _RemovePluginFolder ( $ PluginFolder ) ; } if ( $ PluginFolder !== FALSE && $ PluginClassName !== FALSE && class_exists ( $ PluginClassName ) === FALSE ) { if ( $ ForAction !== self :: ACTION_DISABLE ) { $ this -> IncludePlugins ( array ( $ PluginName => TRUE ) ) ; } $ this -> _PluginCallbackExecution ( $ PluginClassName , $ HookMethod ) ; } elseif ( $ Callback === TRUE ) { $ this -> _PluginCallbackExecution ( $ PluginClassName , $ HookMethod ) ; } }
Hooks to the various actions i . e . enable disable and remove .
21,306
private function _PluginCallbackExecution ( $ PluginClassName , $ HookMethod ) { if ( class_exists ( $ PluginClassName ) ) { $ Plugin = new $ PluginClassName ( ) ; if ( method_exists ( $ PluginClassName , $ HookMethod ) ) { $ Plugin -> $ HookMethod ( ) ; } } }
Executes the plugin hook action if it exists .
21,307
public function check ( array $ input ) { $ missing = [ ] ; $ invalid = [ ] ; $ check = function ( $ constraint , $ key , $ value , $ input ) use ( & $ missing , & $ invalid ) { if ( $ constraint instanceof AbstractConstraint ) { if ( ! $ constraint -> check ( $ value , $ input ) ) { $ invalid [ $ key ] [ ] = $ constraint ; } } elseif ( $ constraint instanceof CheckableInterface ) { $ result = $ constraint -> check ( $ value ) ; $ missing = Std :: concat ( $ missing , array_map ( function ( $ subKey ) use ( $ key ) { return vsprintf ( '%s.%s' , [ $ key , $ subKey ] ) ; } , $ result -> getMissing ( ) ) ) ; foreach ( $ result -> getFailed ( ) as $ failedField => $ constraints ) { $ fullPath = vsprintf ( '%s.%s' , [ $ key , $ failedField ] ) ; if ( array_key_exists ( $ fullPath , $ invalid ) ) { $ invalid [ $ fullPath ] = array_merge ( $ invalid [ $ fullPath ] , $ constraints ) ; } else { $ invalid [ $ fullPath ] = $ constraints ; } } } else { throw new CoreException ( vsprintf ( 'Unexpected constraint type: %s.' , [ TypeHound :: fetch ( $ constraint ) , ] ) ) ; } } ; $ inputMap = ArrayMap :: of ( $ input ) ; $ this -> annotations -> each ( function ( $ value , $ key ) use ( $ check , $ input , $ inputMap , & $ missing ) { if ( Maybe :: fromMaybe ( false , $ value -> lookup ( static :: ANNOTATION_REQUIRED ) ) && $ inputMap -> member ( $ key ) === false ) { $ missing [ ] = $ key ; return ; } elseif ( $ inputMap -> member ( $ key ) === false ) { return ; } $ fieldValue = Maybe :: fromJust ( $ inputMap -> lookup ( $ key ) ) ; $ this -> getInternalFieldConstraints ( $ key ) -> each ( function ( $ constraint ) use ( $ check , $ key , $ fieldValue , $ input ) { $ check ( $ constraint , $ key , $ fieldValue , $ input ) ; } ) ; } ) ; if ( count ( $ missing ) === 0 && count ( $ invalid ) === 0 ) { return new SpecResult ( $ missing , $ invalid , SpecResult :: STATUS_PASS ) ; } return new SpecResult ( $ missing , $ invalid , SpecResult :: STATUS_FAIL ) ; }
Check that a certain input passes the spec .
21,308
public function getFieldConstraints ( $ fieldName ) { $ maybeConstraints = $ this -> annotations -> lookupIn ( [ $ fieldName , static :: ANNOTATION_CONSTRAINTS ] ) ; if ( $ maybeConstraints -> isNothing ( ) ) { return ArrayList :: zero ( ) ; } $ constraints = Maybe :: fromJust ( $ maybeConstraints ) ; if ( is_array ( $ constraints ) ) { return ArrayList :: of ( $ constraints ) ; } elseif ( $ constraints instanceof IterableType ) { return $ constraints ; } return ArrayList :: of ( [ $ constraints ] ) ; }
Get all the constraints for a single field .
21,309
public function withFieldAnnotation ( $ fieldName , $ name , $ value ) { $ copy = clone $ this ; $ copy -> annotations = $ this -> annotations -> update ( $ fieldName , function ( ArrayMap $ fieldAnnotations ) use ( $ name , $ value ) { return $ fieldAnnotations -> insert ( $ name , $ value ) ; } , ArrayMap :: zero ( ) ) ; return $ copy ; }
Set the value of an annotation .
21,310
public function withAnnotation ( $ name , LeftKeyFoldableInterface $ map ) { return $ map -> foldlWithKeys ( function ( self $ acc , $ value , $ fieldName ) use ( $ name ) { return $ acc -> withFieldAnnotation ( $ fieldName , $ name , $ value ) ; } , $ this ) ; }
Get this spec with a map applied as an annotation .
21,311
public function loadFolder ( $ path , $ namespace = '__main__' ) { if ( is_dir ( $ path ) ) { $ files = glob ( $ path . '*.php' ) ; if ( ! defined ( 'DS' ) ) { define ( 'DS' , DIRECTORY_SEPARATOR ) ; } foreach ( $ files as $ file ) { $ shell = explode ( DS , $ file ) ; $ fileName = end ( $ shell ) ; $ fileName = explode ( '.' , $ fileName , - 1 ) ; $ prefix = '' ; if ( count ( $ fileName ) == 2 ) { $ prefix = reset ( $ fileName ) . '.' ; $ locale = end ( $ fileName ) ; } else { $ locale = end ( $ fileName ) ; } $ translations = require $ file ; $ translations = array_dot ( $ translations , $ prefix ) ; if ( isset ( $ this -> translations [ $ locale ] ) ) { if ( isset ( $ this -> translations [ $ locale ] [ $ namespace ] ) ) { $ translations = array_merge ( $ this -> translations [ $ locale ] [ $ namespace ] , $ translations ) ; } } $ this -> translations [ $ locale ] [ $ namespace ] = $ translations ; } } }
Load files in a folder to use as translations .
21,312
public function t ( ) { $ args = func_get_args ( ) ; $ locales = count ( $ this -> supportedLocales ) ; if ( empty ( $ args ) ) { return '' ; } if ( $ locales == 0 ) { return '' ; } if ( $ locales != count ( $ args ) ) { $ args = array_slice ( $ args , 0 , $ locales ) ; } if ( $ locales - count ( $ args ) > 0 ) { $ args = array_merge ( $ args , array_fill ( 0 , $ locales - count ( $ args ) , '' ) ) ; } $ translations = array_combine ( $ this -> supportedLocales , $ args ) ; return $ translations [ $ this -> currentLocale ] ; }
Give the proper translation based on the locale .
21,313
public function dt ( $ key , $ values = [ ] ) { $ namespace = '__main__' ; if ( Str :: contains ( $ key , '::' ) ) { list ( $ namespace , $ key ) = explode ( '::' , $ key ) ; } if ( empty ( $ this -> translations ) ) { return '' ; } $ loc = $ this -> getLocale ( ) ; if ( array_key_exists ( $ namespace , $ this -> translations [ $ loc ] ) && array_key_exists ( $ key , $ this -> translations [ $ loc ] [ $ namespace ] ) ) { $ translation = $ this -> translations [ $ loc ] [ $ namespace ] [ $ key ] ; foreach ( $ values as $ name => $ value ) { $ translation = str_replace ( ':' . $ name , $ value , $ translation ) ; } return $ translation ; } else { return '' ; } }
Fetches the translation of the key based on the current locale .
21,314
public static function instance ( $ name = 'fuelphp' , array $ events = array ( ) ) { if ( ! array_key_exists ( $ name , static :: $ instances ) ) { $ events = array_merge ( \ Config :: get ( 'event.' . $ name , array ( ) ) , $ events ) ; $ instance = static :: forge ( $ events ) ; static :: $ instances [ $ name ] = & $ instance ; } return static :: $ instances [ $ name ] ; }
Multiton Event instance .
21,315
public function regenerateChannel ( ) { $ channel = $ this -> channel ; $ this -> channel = $ this -> amqp -> channel ( ) ; return $ channel ; }
Regenerates a channel
21,316
protected function prepareMessage ( $ queue , Job $ job ) { $ this -> queueDeclare ( $ queue ) ; return new AMQPMessage ( json_encode ( $ job -> createPayload ( ) ) , $ job -> getOptions ( ) ) ; }
Prepares a message
21,317
protected function queueDeclare ( $ queue = '' , array $ arguments = [ ] ) { return $ this -> channel -> queue_declare ( $ queue , false , $ this -> persistent , false , false , false , $ arguments ) ; }
Declares a new queue
21,318
protected function exchangeDeclare ( $ exchange , $ type = 'direct' ) { return $ this -> channel -> exchange_declare ( $ exchange , $ type , false , $ this -> persistent , false ) ; }
Declares a new exchange
21,319
public function proxy ( $ key , \ Closure $ data , $ expiration = 0 ) { if ( $ this -> driver -> has ( $ key ) ) { return $ this -> driver -> get ( $ key ) ; } $ data = $ data ( ) ; $ this -> driver -> set ( $ key , $ data , $ expiration ) ; return $ data ; }
Get a value potentially from cache .
21,320
public function getLastErrorMessage ( ) { $ message = null ; $ error = $ this -> getConnection ( ) -> errorInfo ( ) ; if ( is_array ( $ error ) && isset ( $ error [ 2 ] ) ) { $ message = $ error [ 2 ] ; } return $ message ; }
Get last SQL error message
21,321
public function show ( $ uuid ) { $ response = $ this -> httpClient -> get ( $ this -> getResourceUrl ( $ uuid ) ) ; return ContainerResponse :: createFromHttpResponse ( $ response ) ; }
Fetch information about a container
21,322
protected function registerRegistry ( ) { $ app = app ( ) ; $ this -> app -> singleton ( 'registry' , function ( $ app ) { $ config = $ app -> config -> get ( 'registry' , array ( ) ) ; return new Registry ( $ app [ 'db' ] , $ app [ 'registry.cache' ] , $ config ) ; } ) ; }
Register the repository .
21,323
protected function registerCache ( ) { $ app = app ( ) ; $ this -> app -> singleton ( 'registry.cache' , function ( $ app ) { $ meta = $ app -> config -> get ( 'registry.cache_path' ) ; $ timestampManager = $ app -> config -> get ( 'registry.timestamp_manager' ) ; return new Cache ( $ meta , $ timestampManager ) ; } ) ; }
Register the cache repository .
21,324
protected function registerLocale ( ) { $ lang = $ this -> prepareLang ( ) ; if ( file_exists ( Yii :: getAlias ( $ this -> getAssetBundle ( ) -> sourcePath ) . DIRECTORY_SEPARATOR . "locales" . DIRECTORY_SEPARATOR . "jquery.timeago.{$lang}.js" ) ) { $ this -> getAssetBundle ( ) -> js [ ] = "locales/jquery.timeago.{$lang}.js" ; } else { throw new InvalidConfigException ( "Language '{$lang}' do not exist." ) ; } }
Registred locale js file .
21,325
protected function prepareLang ( ) { $ lang = $ this -> language ; if ( strpos ( $ lang , '-' ) !== false ) { $ lang = strtolower ( explode ( '-' , $ lang ) [ 0 ] ) ; } return $ lang ; }
Prepare name of language .
21,326
public function getKeyPair ( ) { if ( ! isset ( $ this -> keyPair ) ) { $ keyProviderCollection = KeyProviderCollector :: getInstance ( ) ; $ keyProvider = $ keyProviderCollection -> getProvider ( $ this -> providerId ) ; if ( ! $ keyProvider ) { throw new InaccessibleKeyPairException ( "Key pair provider ({$this->providerId}) has not been loaded in this instance" ) ; } $ this -> keyPair = $ keyProvider -> get ( $ this -> keyPairId ) ; } return $ this -> keyPair ; }
Retrieves the referenced KeyPair from the provider
21,327
public function unique ( \ Closure $ compare = null ) { if ( \ is_callable ( $ compare ) ) { return parent :: unique ( $ compare ) ; } return new static ( \ array_unique ( $ this -> _Arr , \ SORT_REGULAR ) ) ; }
Returns a new Set with duplicates removed
21,328
final public static function raise ( int $ level , string $ message , string $ file = null , int $ line = null ) { if ( error_reporting ( ) === 0 ) { return false ; } throw new ErrorException ( $ message , 0 , $ level , $ file , $ line ) ; }
Throws a new \ ErrorException based on the error information provided .
21,329
final public static function toArray ( Throwable $ throwable , bool $ traceAsString = false , int $ depth = 512 ) : array { $ result = [ 'type' => get_class ( $ throwable ) , 'message' => $ throwable -> getMessage ( ) , 'code' => $ throwable -> getCode ( ) , 'file' => $ throwable -> getFile ( ) , 'line' => $ throwable -> getLine ( ) , 'trace' => $ traceAsString ? $ throwable -> getTraceAsString ( ) : $ throwable -> getTrace ( ) , 'previous' => null , ] ; if ( $ throwable -> getPrevious ( ) !== null && -- $ depth ) { $ result [ 'previous' ] = self :: toArray ( $ throwable -> getPrevious ( ) , $ traceAsString , $ depth ) ; } return $ result ; }
Converts the given Exception to an array .
21,330
public function collectPatches ( RootPackageInterface $ rootPackage , array $ subPackages ) { $ collectedPatches = $ this -> collectPatchesFromPackage ( $ rootPackage ) ; $ extra = $ rootPackage -> getExtra ( ) ; if ( isset ( $ extra [ 'allow-subpatches' ] ) ) { $ allowedSubpatches = $ extra [ 'allow-subpatches' ] ; if ( ! is_bool ( $ allowedSubpatches ) && ! is_array ( $ allowedSubpatches ) ) { $ this -> handleException ( new Exception \ InvalidPackageConfigurationValue ( $ rootPackage , 'extra.allow-subpatches' , $ allowedSubpatches , 'The extra.allow-subpatches must be a boolean or an array of strings.' ) ) ; } $ collectedPatches -> merge ( $ this -> collectSubpackagePatches ( $ subPackages , $ allowedSubpatches ) ) ; } return $ collectedPatches ; }
Collect the patches .
21,331
protected function collectSubpackagePatches ( array $ subPackages , $ allowedSubpatches ) { $ collectedPatches = new PatchCollection ( ) ; if ( $ allowedSubpatches !== false && $ allowedSubpatches !== array ( ) ) { foreach ( $ subPackages as $ subPackage ) { if ( $ allowedSubpatches === true || in_array ( $ subPackage -> getName ( ) , $ allowedSubpatches , true ) ) { $ collectedPatches -> merge ( $ this -> collectPatchesFromPackage ( $ subPackage ) ) ; } } } return $ collectedPatches ; }
Collect the patches from the sub - packages .
21,332
protected function collectPatchesFromPackage ( PackageInterface $ package ) { $ collectedPatches = new PatchCollection ( ) ; $ extra = $ package -> getExtra ( ) ; if ( isset ( $ extra [ 'patches' ] ) ) { $ this -> io -> write ( '<info>Gathering patches from ' . $ package -> getName ( ) . ' (extra.patches).</info>' ) ; $ collectedPatches -> merge ( $ this -> resolveExplicitList ( $ package , $ extra [ 'patches' ] ) ) ; } if ( isset ( $ extra [ 'patches-file' ] ) ) { $ this -> io -> write ( '<info>Gathering patches from ' . $ package -> getName ( ) . ' (extra.patches-file).</info>' ) ; $ collectedPatches -> merge ( $ this -> resolveJsonFile ( $ package , $ extra [ 'patches-file' ] ) ) ; } return $ collectedPatches ; }
Collect the patches from a package .
21,333
protected function resolveExplicitList ( PackageInterface $ package , $ patches ) { $ collectedPatches = new PatchCollection ( ) ; if ( ! is_array ( $ patches ) ) { $ this -> handleException ( Exception \ InvalidPackageConfigurationValue ( $ package , 'extra.patches' , $ patches , 'The extra.patches configuration must be an array.' ) ) ; } else { $ packageDirectory = $ this -> installationManager -> getInstallPath ( $ package ) ; foreach ( $ patches as $ forPackageHandle => $ patchList ) { if ( ! is_array ( $ patchList ) ) { $ this -> handleException ( Exception \ InvalidPackageConfigurationValue ( $ package , 'extra.patches' , $ package , "The \"{$forPackageHandle}\" value must be an array." ) ) ; continue ; } foreach ( $ patchList as $ patchDescription => $ patchData ) { try { list ( $ path , $ levels ) = $ this -> extractPatchData ( $ package , $ patchData ) ; $ localFile = $ this -> pathResolver -> resolve ( $ path , $ packageDirectory ) ; if ( $ localFile === '' ) { $ this -> handleException ( Exception \ InvalidPackageConfigurationValue ( $ package , 'extra.patches' , $ package , "The path of the \"{$patchDescription}\" patch is empty or is not a string." ) ) ; } $ collectedPatches -> addPatch ( new Patch ( $ package , $ forPackageHandle , $ path , $ localFile , $ patchDescription , $ levels ) ) ; } catch ( BaseException $ x ) { $ this -> handleException ( $ x ) ; } } } } return $ collectedPatches ; }
Collect the patches from the patches configuration key .
21,334
protected function extractPatchData ( PackageInterface $ package , $ patchData ) { $ levels = null ; if ( is_string ( $ patchData ) ) { $ path = $ patchData ; } else { if ( ! is_array ( $ patchData ) || ! isset ( $ patchData [ 'path' ] ) || is_string ( $ patchData [ 'path' ] ) ) { throw new Exception \ InvalidPackageConfigurationValue ( $ package , 'extra.patches.[...]' , $ package , "The value of a patch must be a string or an array with a 'path' node value." ) ; } $ path = $ patchData [ 'path' ] ; if ( isset ( $ patchData [ 'levels' ] ) ) { $ levels = $ patchData [ 'levels' ] ; if ( ! is_array ( $ levels ) || empty ( $ levels ) ) { throw new Exception \ InvalidPackageConfigurationValue ( $ package , 'extra.patches.[...].levels' , $ package , 'The patch levels must be an array of strings.' ) ; } } } if ( $ levels === null ) { $ levels = $ this -> getDefaultPatchLevels ( ) ; } return array ( $ path , $ levels ) ; }
Extract the data of a single patch .
21,335
protected function resolveJsonFile ( PackageInterface $ package , $ jsonPath ) { $ collectedPatches = new PatchCollection ( ) ; if ( ! is_string ( $ jsonPath ) || $ jsonPath === '' ) { $ this -> handleException ( Exception \ InvalidPackageConfigurationValue ( $ package ( ) , 'extra.patches-file' , $ jsonPath , 'The extra.patches-file configuration must be a non empty string.' ) ) ; } else { $ packageDirectory = $ this -> installationManager -> getInstallPath ( $ package ) ; $ fullJsonPath = $ this -> pathResolver -> resolve ( $ jsonPath , $ packageDirectory ) ; $ jsonReader = new JsonFile ( $ fullJsonPath , null , $ this -> io ) ; $ data = $ jsonReader -> read ( ) ; if ( ! is_array ( $ data ) ) { $ this -> handleException ( Exception \ InvalidPackageConfigurationValue ( $ package , 'extra.patches-file' , $ jsonPath , "The JSON file at \"{$jsonPath}\" must contain an array." ) ) ; } elseif ( ! isset ( $ data [ 'patches' ] ) ) { $ this -> handleException ( Exception \ InvalidPackageConfigurationValue ( $ package , 'extra.patches-file' , $ jsonPath , "The JSON file at \"{$jsonPath}\" must contain an array with a \"patches\" key." ) ) ; } else { $ collectedPatches -> merge ( $ this -> resolveExplicitList ( $ package , $ data [ 'patches' ] ) ) ; } } return $ collectedPatches ; }
Collect the patches from the patches - file configuration key .
21,336
public function start ( $ host , $ port , $ nonce , $ resource = '/' , array $ protocols = array ( ) ) { $ version = Net_Notifier_WebSocket_Handshake :: VERSION ; $ request = "GET " . $ resource . " HTTP/1.1\r\n" . "Host: " . $ host . "\r\n" . "Connection: Upgrade\r\n" . "Upgrade: websocket\r\n" . "Sec-WebSocket-Key: " . $ nonce . "\r\n" . "Sec-WebSocket-Version: " . $ version . "\r\n" ; if ( count ( $ protocols ) > 0 ) { $ protocols = implode ( ',' , $ protocols ) ; $ request .= "Sec-WebSocket-Protocol: " . $ protocols . "\r\n" ; } $ request .= "\r\n" ; return $ request ; }
Initiates a WebSocket handshake
21,337
public function receive ( $ data , $ nonce , array $ protocols = array ( ) ) { $ handshake = $ this -> parseHeaders ( $ data ) ; $ headers = $ handshake [ 'headers' ] ; $ status_parts = explode ( ' ' , $ handshake [ 'status' ] ) ; if ( count ( $ status_parts ) > 1 ) { $ status = ( integer ) $ status_parts [ 1 ] ; } else { $ status = 400 ; } $ method = $ status_parts [ 0 ] ; if ( $ status == '101' ) { $ response = $ this -> receiveServerHandshake ( $ headers , $ nonce , $ protocols ) ; } elseif ( $ method === 'GET' ) { $ response = $ this -> receiveClientHandshake ( $ headers , $ protocols ) ; } else { $ response = "HTTP/1.1 400 Bad Request\r\n\r\n" ; } return $ response ; }
Does the actual WebSocket handshake
21,338
protected function receiveClientHandshake ( array $ headers , array $ supportedProtocols ) { if ( ! isset ( $ headers [ 'Host' ] ) ) { $ response = "HTTP/1.1 400 Bad Request\r\n" . "X-WebSocket-Message: Client request Host header is " . "missing.\r\n" ; } elseif ( ! isset ( $ headers [ 'Upgrade' ] ) || ! in_array ( 'websocket' , $ this -> parseHeaderValue ( $ headers [ 'Upgrade' ] ) ) ) { $ response = "HTTP/1.1 400 Bad Request\r\n" . "X-WebSocket-Message: Client request Upgrade header is " . "missing or does not contain the 'websocket' product.\r\n" ; } elseif ( ! isset ( $ headers [ 'Connection' ] ) || ! in_array ( 'upgrade' , $ this -> parseHeaderValue ( $ headers [ 'Connection' ] ) ) ) { $ response = "HTTP/1.1 400 Bad Request\r\n" . "X-WebSocket-Message: Client request Connection header is " . "missing or does not contain the'Upgrade' token.\r\n" ; } elseif ( ! isset ( $ headers [ 'Sec-WebSocket-Key' ] ) ) { $ response = "HTTP/1.1 400 Bad Request\r\n" . "X-WebSocket-Message: Client request Sec-WebSocket-Key " . "header is missing.\r\n" ; } elseif ( ! isset ( $ headers [ 'Sec-WebSocket-Version' ] ) ) { $ response = "HTTP/1.1 400 Bad Request\r\n" . "X-WebSocket-Message: Client request Sec-WebSocket-Version " . "header is missing.\r\n" ; } elseif ( $ headers [ 'Sec-WebSocket-Version' ] !== self :: VERSION ) { $ response = "HTTP/1.1 426 Upgrade Required\r\n" . "Sec-WebSocket-Version: " . self :: VERSION . "\r\n" . "X-WebSocket-Message: Client request protocol version is " . "unsupported.\r\n" ; } else { $ key = $ headers [ 'Sec-WebSocket-Key' ] ; $ accept = $ this -> getAccept ( $ key ) ; $ version = $ headers [ 'Sec-WebSocket-Version' ] ; $ response = "HTTP/1.1 101 Switching Protocols\r\n" . "Upgrade: websocket\r\n" . "Connection: Upgrade\r\n" . "Sec-WebSocket-Accept: " . $ accept . "\r\n" ; if ( isset ( $ headers [ 'Sec-WebSocket-Protocol' ] ) ) { $ protocols = explode ( ',' , $ headers [ 'Sec-WebSocket-Protocol' ] ) ; $ protocols = array_map ( 'trim' , $ protocols ) ; $ supportedProtocol = $ this -> getSupportedProtocol ( $ supportedProtocols , $ protocols ) ; if ( $ supportedProtocol !== null ) { $ response .= 'Sec-WebSocket-Protocol: ' . $ supportedProtocol . "\r\n" ; } } } $ response .= "\r\n" ; return $ response ; }
Receives and validates a client handshake request and returns an appropriate server response
21,339
protected function receiveServerHandshake ( array $ headers , $ nonce , array $ protocols = array ( ) ) { if ( ! isset ( $ headers [ 'Sec-WebSocket-Accept' ] ) ) { throw new Net_Notifier_WebSocket_HandshakeFailureException ( 'Sec-WebSocket-Accept header missing.' ) ; } if ( ! isset ( $ headers [ 'Upgrade' ] ) || mb_strtolower ( $ headers [ 'Upgrade' ] ) !== 'websocket' ) { throw new Net_Notifier_WebSocket_HandshakeFailureException ( 'Upgrade header missing or not set to "websocket".' ) ; } if ( ! isset ( $ headers [ 'Connection' ] ) || mb_strtolower ( $ headers [ 'Connection' ] ) !== 'upgrade' ) { throw new Net_Notifier_WebSocket_HandshakeFailureException ( 'Connection header missing or not set to "Upgrade".' ) ; } $ responseAccept = trim ( $ headers [ 'Sec-WebSocket-Accept' ] ) ; $ validAccept = $ this -> getAccept ( $ nonce ) ; if ( $ responseAccept !== $ validAccept ) { throw new Net_Notifier_WebSocket_HandshakeFailureException ( sprintf ( 'Sec-WebSocket-Accept header "%s" does not validate ' . 'against nonce "%s"' , $ responseAccept , $ nonce ) ) ; } if ( count ( $ protocols ) > 0 ) { if ( ! isset ( $ headers [ 'Sec-WebSocket-Protocol' ] ) ) { throw new Net_Notifier_WebSocket_ProtocolException ( sprintf ( "Client requested '%s' sub-protocols but server does " . "not support any of them." , implode ( ' ' , $ protocols ) ) , 0 , null , $ protocols ) ; } if ( ! in_array ( $ headers [ 'Sec-WebSocket-Protocol' ] , $ protocols ) ) { throw new Net_Notifier_WebSocket_ProtocolException ( sprintf ( "Client requested '%s' sub-protocols. Server " . "responded with unsupported sub-protocol: '%s'." , implode ( ' ' , $ protocols ) , $ headers [ 'Sec-WebSocket-Protocol' ] ) , 0 , $ headers [ 'Sec-WebSocket-Protocol' ] , $ protocols ) ; } } return null ; }
Receives and validates a server handshake response
21,340
protected function getSupportedProtocol ( array $ supported , array $ requested ) { $ supportedProtocol = null ; foreach ( $ requested as $ protocol ) { if ( in_array ( $ protocol , $ supported ) ) { $ supportedProtocol = $ protocol ; break ; } } return $ supportedProtocol ; }
Gets the first supported protocol from a list of requested protocols
21,341
protected function parseHeaders ( $ header ) { $ parsedHeaders = array ( 'status' => '' , 'headers' => array ( ) ) ; $ headers = explode ( "\r\n" , $ header ) ; $ parsedHeaders [ 'status' ] = array_shift ( $ headers ) ; foreach ( $ headers as $ header ) { list ( $ name , $ value ) = explode ( ':' , $ header , 2 ) ; $ parsedHeaders [ 'headers' ] [ $ name ] = ltrim ( $ value ) ; } return $ parsedHeaders ; }
Parses the raw handshake header into an array of headers
21,342
protected function parseHeaderValue ( $ value ) { $ values = explode ( ',' , $ value ) ; $ values = array_map ( 'trim' , $ values ) ; $ values = array_filter ( $ values , create_function ( '$value' , 'return ($value != \'\');' ) ) ; $ values = array_map ( 'mb_strtolower' , $ values ) ; return $ values ; }
Parses a HTTP header value containing one or more tokens separated by commas
21,343
protected function getAccept ( $ key ) { $ accept = $ key . self :: GUID ; $ accept = sha1 ( $ accept , true ) ; $ accept = base64_encode ( $ accept ) ; return $ accept ; }
Gets the accept header value for this handshake
21,344
public function getLanguage ( ) { if ( isset ( $ _SERVER [ "SERVER_NAME" ] ) ) { $ domain = $ _SERVER [ "SERVER_NAME" ] ; if ( isset ( $ this -> domains [ $ domain ] ) ) { return $ this -> domains [ $ domain ] ; } } return "default" ; }
Returns the language used for the domain name . Check if the value exit in keys array . If this value doesn t exist the function return default .
21,345
public function getDisplayLocales ( ) { $ locales = array ( ) ; foreach ( $ this -> allowedLocales as $ locale ) { $ locales [ $ locale ] = \ Locale :: getDisplayName ( $ locale ) ; } return $ locales ; }
Get display locales .
21,346
public function delete_custom_group ( ) { global $ wpdb ; check_admin_referer ( 'delete_custom_group' ) ; if ( isset ( $ _GET [ 'custom_group_id' ] ) ) { $ id = ( int ) $ _GET [ 'custom_group_id' ] ; if ( is_int ( $ id ) ) { $ group = $ this -> get_group ( $ id ) ; $ sql = $ wpdb -> prepare ( "DELETE FROM " . MF_TABLE_CUSTOM_GROUPS . " WHERE id = %d" , $ id ) ; $ wpdb -> query ( $ sql ) ; $ sql_fields = $ wpdb -> prepare ( "DELETE FROM " . MF_TABLE_CUSTOM_FIELDS . " WHERE custom_group_id = %d" , $ id ) ; $ wpdb -> query ( $ sql_fields ) ; $ this -> mf_redirect ( 'mf_custom_fields' , 'fields_list' , array ( 'message' => 'success' , 'post_type' => $ group [ 'post_type' ] ) ) ; } } }
Delete a custom group
21,347
private function runProcess ( Process $ process ) { $ process -> setTimeout ( null ) -> mustRun ( ) ; foreach ( explode ( PHP_EOL , $ process -> getOutput ( ) ) as $ line ) { $ this -> notice ( $ line ) ; } }
Run the passed process and add every line from the output to the log .
21,348
public function exchangeAction ( Request $ request ) { try { $ authCode = $ this -> getAuthCode ( $ request ) ; $ this -> info ( '> Exchange request' , [ 'method' => $ request -> getMethod ( ) , 'auth_code' => $ authCode ] ) ; $ clientSecret = $ this -> getClientSecret ( $ request ) ; $ credentials = $ this -> accessProvider -> exchange ( $ authCode , $ clientSecret ) ; $ response = new JsonResponse ( [ 'access_code' => $ credentials -> getAccessCode ( ) , 'refresh_code' => $ credentials -> getRefreshCode ( ) , 'lifetime' => $ credentials -> getLifetime ( ) ] ) ; } catch ( SoauthException $ e ) { $ data = [ ] ; if ( $ e instanceof BadDataException ) { $ data [ 'errors' ] = $ e -> getErrors ( ) ; } $ response = new JsonResponse ( $ data , Response :: HTTP_BAD_REQUEST ) ; } $ this -> info ( '< Response' , [ 'status_code' => $ response -> getStatusCode ( ) ] ) ; return $ response ; }
exchange auth for an access code
21,349
public function refreshAction ( Request $ request ) { try { $ refreshCode = $ this -> getRefreshCode ( $ request ) ; $ clientSecret = $ this -> getClientSecret ( $ request ) ; $ credentials = $ this -> accessProvider -> refresh ( $ request , $ refreshCode , $ clientSecret ) ; $ response = new JsonResponse ( [ 'access_code' => $ credentials -> getAccessCode ( ) , 'refresh_code' => $ credentials -> getRefreshCode ( ) , 'lifetime' => $ credentials -> getLifetime ( ) ] ) ; } catch ( SoauthException $ e ) { $ data = [ ] ; if ( $ e instanceof BadDataException ) { $ data [ 'errors' ] = $ e -> getErrors ( ) ; } $ response = new JsonResponse ( $ data , Response :: HTTP_BAD_REQUEST ) ; } $ this -> info ( '< Response' , [ 'status_code' => $ response -> getStatusCode ( ) ] ) ; return $ response ; }
refresh a given access credentials
21,350
public function publish ( $ targetDir = null , array $ extensions = array ( ) ) { if ( ! $ targetDir ) { $ targetDir = $ this -> targetDir ; } $ this -> publishResources ( $ targetDir , $ extensions ) ; $ this -> publishThemeFiles ( $ targetDir , $ extensions ) ; return $ this ; }
Publish all module resources
21,351
public function create ( $ msg ) { if ( is_string ( $ msg ) && ( $ this -> lang -> has ( $ msg ) ) ) $ msg = $ this -> lang -> get ( $ msg ) ; if ( is_object ( $ msg ) || is_array ( $ msg ) ) $ msg = print_r ( $ msg , true ) ; $ args = func_get_args ( ) ; $ args [ 0 ] = $ msg ; $ msg = trim ( call_user_func_array ( 'sprintf' , $ args ) ) ; $ code = $ args [ count ( $ args ) - 1 ] ; if ( is_numeric ( $ code ) ) return new \ Exception ( $ msg , $ code ) ; else return new \ Exception ( $ msg ) ; }
Gera uma excecao e retorna o Exception
21,352
private function setCategoryFullSlug ( Category $ category ) : void { static $ languages ; if ( ! $ languages ) { $ languages = $ this -> language ? [ $ this -> language ] : TransHelper :: getAllLanguages ( ) ; } foreach ( $ languages as $ language ) { $ category -> translations ( ) -> where ( 'locale' , $ language -> iso_code ) -> update ( [ 'full_slug' => $ this -> getSlugForCategory ( $ category -> id , $ language -> iso_code ) , ] ) ; } foreach ( $ category -> descendants ( ) -> get ( ) as $ descendant ) { foreach ( $ languages as $ language ) { $ descendant -> translations ( ) -> where ( 'locale' , $ language -> iso_code ) -> update ( [ 'full_slug' => $ this -> getSlugForCategory ( $ descendant -> id , $ language -> iso_code ) , ] ) ; } } }
Generate full slug for category
21,353
private function getSlugForCategory ( int $ categoryId , string $ locale ) : string { $ reversed = array_reverse ( $ this -> getSlugParts ( $ categoryId , $ locale ) ) ; return implode ( '/' , $ reversed ) ; }
Build full slug for category
21,354
private function getSlugParts ( int $ categoryId , string $ locale ) : array { $ category = $ this -> repo -> getCategoriesPlain ( ) -> where ( 'id' , $ categoryId ) -> first ( ) ; $ slugParts = [ ] ; if ( ! $ category ) { $ category = Category :: find ( $ categoryId ) ; if ( ! $ category ) { return [ ] ; } $ category = [ 'id' => $ category -> id , 'parent_id' => $ category -> parent_id , 'slugs' => $ category -> translations -> pluck ( 'slug' , 'locale' ) -> toArray ( ) , ] ; } $ slugParts [ ] = array_get ( $ category , 'slugs.' . $ locale ) ; if ( isset ( $ category [ 'parent_id' ] ) && $ category [ 'parent_id' ] ) { $ slugParts = array_merge ( $ slugParts , $ this -> getSlugParts ( $ category [ 'parent_id' ] , $ locale ) ) ; } return $ slugParts ; }
Get slug parts recursively without querying database
21,355
protected function clean ( $ str ) { if ( $ this -> options -> get ( 'cleanupInput' ) != true ) { return $ str ; } $ str = mb_eregi_replace ( "'\s+>" , "'>" , $ str ) ; $ str = mb_eregi_replace ( '"\s+>' , '">' , $ str ) ; $ replace = ' ' ; if ( $ this -> options -> get ( 'preserveLineBreaks' ) ) { $ replace = '&#10;' ; } $ str = str_replace ( [ "\r\n" , "\r" , "\n" ] , $ replace , $ str ) ; $ str = mb_eregi_replace ( "<!doctype(.*?)>" , '' , $ str ) ; $ str = mb_eregi_replace ( "<!--(.*?) , '' , $ str ) ; $ str = mb_eregi_replace ( "<!\[CDATA\[(.*?)\]\]>" , '' , $ str ) ; if ( $ this -> options -> get ( 'removeScripts' ) == true ) { $ str = mb_eregi_replace ( "<\s*script[^>]*[^/]>(.*?)<\s*/\s*script\s*>" , '' , $ str ) ; $ str = mb_eregi_replace ( "<\s*script\s*>(.*?)<\s*/\s*script\s*>" , '' , $ str ) ; } if ( $ this -> options -> get ( 'removeStyles' ) == true ) { $ str = mb_eregi_replace ( "<\s*style[^>]*[^/]>(.*?)<\s*/\s*style\s*>" , '' , $ str ) ; $ str = mb_eregi_replace ( "<\s*style\s*>(.*?)<\s*/\s*style\s*>" , '' , $ str ) ; } $ str = mb_eregi_replace ( "(<\?)(.*?)(\?>)" , '' , $ str ) ; $ str = mb_eregi_replace ( "(\{\w)(.*?)(\})" , '' , $ str ) ; return $ str ; }
Cleans the html of any none - html information .
21,356
protected function renderCss ( ) { $ html = "" ; foreach ( $ this -> css as $ item ) { $ html .= sprintf ( MPageController :: CSS_TEMPLATE , $ item [ "rel" ] , $ item [ "href" ] , $ item [ "media" ] ) . "\n" ; } $ domQuery = $ this -> qp -> find ( "head" ) ; if ( $ domQuery -> count ( ) <= 0 ) { trigger_error ( 'head tag not found in page' , E_USER_WARNING ) ; } else { $ domQuery -> append ( $ html ) ; } }
Render the link tag for CSS at the end of head tag .
21,357
protected function renderJavascript ( ) { $ html = "" ; foreach ( $ this -> javascript as $ item ) { $ html .= sprintf ( MPageController :: JAVASCRIPT_TEMPLATE , $ item [ "src" ] ) . "\n" ; } $ domQuery = $ this -> qp -> find ( "head" ) ; if ( $ domQuery -> count ( ) <= 0 ) { trigger_error ( 'head tag not found in page' , E_USER_WARNING ) ; } else { $ domQuery -> append ( $ html ) ; } }
Render the script tag for Javascript at the end of head tag .
21,358
protected function renderTitle ( ) { if ( $ this -> pageTitle != null ) { $ title = mb_convert_encoding ( $ this -> pageTitle , $ this -> getCharset ( ) , 'auto' ) ; $ domQuery = $ this -> qp -> find ( "title" ) ; if ( $ domQuery -> count ( ) <= 0 ) { trigger_error ( 'title tag not found in page' , E_USER_WARNING ) ; } else { $ domQuery -> append ( $ title ) ; } } }
Write the title in the title tag of the page .
21,359
public static function convert ( $ number , $ from , $ to , $ ratio = 0.75 ) { switch ( $ from ) { case 'in' : switch ( $ to ) { case 'in' : return $ number ; case 'cm' : return $ number * 2.54 ; case 'mm' : return $ number * 25.4 ; case 'pt' : return $ number * 72 ; case 'pc' : return $ number * 6 ; case 'px' : return $ number * 72 * $ ratio ; } case 'cm' : switch ( $ to ) { case 'in' : return $ number / 2.54 ; case 'cm' : return $ number ; case 'mm' : return $ number / 10 ; case 'pt' : return $ number * 72 / 2.54 ; case 'pc' : return $ number * 6 / 2.54 ; case 'px' : return $ number * 72 * $ ratio / 2.54 ; } case 'mm' : switch ( $ to ) { case 'in' : return $ number / 25.4 ; case 'cm' : return $ number * 10 ; case 'mm' : return $ number ; case 'pt' : return $ number * 72 / 25.4 ; case 'pc' : return $ number * 6 / 25.4 ; case 'px' : return $ number * 72 * $ ratio / 25.4 ; } case 'pt' : switch ( $ to ) { case 'in' : return $ number / 72 ; case 'cm' : return $ number * 2.54 / 72 ; case 'mm' : return $ number * 25.4 / 72 ; case 'pt' : return $ number ; case 'pc' : return $ number * 12 ; case 'px' : return $ number * 72 * $ ratio / 72 ; } case 'pc' : switch ( $ to ) { case 'in' : return $ number / 6 ; case 'cm' : return $ number * 2.54 / 6 ; case 'mm' : return $ number * 25.4 / 6 ; case 'pt' : return $ number / 12 ; case 'pc' : return $ number ; case 'px' : return $ number * 72 * $ ratio / 6 ; } case 'px' : switch ( $ to ) { case 'in' : return $ number / 72 * $ ratio ; case 'cm' : return $ number * 2.54 / 72 * $ ratio ; case 'mm' : return $ number * 25.4 / 72 * $ ratio ; case 'pt' : return $ number * $ ratio ; case 'pc' : return $ number * 6 / 72 * $ ratio ; case 'px' : return $ number ; } } throw new \ Exception ( "Invalid conversion from $from to $to with a value of $number" ) ; }
Convert units from x to y
21,360
public function get ( string $ path ) : ? EntityInterface { $ entity = null ; $ name = null ; $ subtree = $ this -> subtree ( $ path , $ name ) ; if ( null !== $ subtree && isset ( $ subtree -> ownData [ $ name ] ) ) { $ entity = $ subtree -> ownData [ $ name ] ; } return $ entity ; }
Get stream entity .
21,361
public function add ( string $ path , EntityInterface $ entity ) : bool { $ result = false ; if ( strlen ( $ path ) ) { $ name = null ; $ subtree = $ this -> subtree ( $ path , $ name , true ) ; $ subtree -> ownData [ $ name ] = $ entity ; $ result = true ; } return $ result ; }
Add stream entity to array .
21,362
public function delete ( $ path ) : bool { $ result = false ; $ parts = $ this -> split ( $ path ) ; $ name = array_shift ( $ parts ) ; if ( ! count ( $ parts ) ) { if ( isset ( $ this -> ownData [ $ name ] ) ) { unset ( $ this -> ownData [ $ name ] ) ; $ result = true ; } } elseif ( isset ( $ this -> subTrees [ $ name ] ) ) { $ subtree = $ this -> subTrees [ $ name ] ; $ result = $ subtree -> delete ( $ parts ) ; if ( $ result && ! $ subtree -> count ( ) ) { unset ( $ this -> subTrees [ $ name ] ) ; } } return $ result ; }
Delete stream entity from array .
21,363
public function own ( $ path = '' ) : array { if ( $ path ) { $ parts = $ this -> split ( $ path ) ; $ name = array_shift ( $ parts ) ; $ own = [ ] ; if ( isset ( $ this -> subTrees [ $ name ] ) ) { $ subtree = $ this -> subTrees [ $ name ] ; $ this -> appendChildren ( $ own , $ name , $ subtree -> own ( $ parts ) ) ; } } else { $ own = $ this -> ownData ; } return $ own ; }
Get subtree s own changes .
21,364
public function subtree ( $ path , string & $ name = null , bool $ create = false ) : ? self { $ parts = $ this -> split ( $ path ) ; $ dirOrFile = array_shift ( $ parts ) ; if ( ! count ( $ parts ) ) { $ name = $ dirOrFile ; $ subtree = $ this ; } else { $ exists = isset ( $ this -> subTrees [ $ dirOrFile ] ) ; if ( ! $ exists && ! $ create ) { $ subtree = null ; $ name = null ; } else { if ( ! $ exists && $ create ) { $ this -> subTrees [ $ dirOrFile ] = new self ( ) ; } $ subtree = $ this -> subTrees [ $ dirOrFile ] -> subtree ( $ parts , $ name , $ create ) ; } } return $ subtree ; }
Get subtree by path .
21,365
private function appendChildren ( array & $ children , string $ name , array $ new ) : void { foreach ( $ new as $ key => $ value ) { $ children [ $ name . '/' . $ key ] = $ value ; } }
Add new children to array .
21,366
public function addChildren ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doAddChildren ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_CHILDREN_ADD , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_CHILDREN_ADD , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Adds Children to Skill
21,367
public function addFunctionPhases ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doAddFunctionPhases ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_FUNCTION_PHASES_ADD , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_FUNCTION_PHASES_ADD , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Adds FunctionPhases to Skill
21,368
public function addGroups ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doAddGroups ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_GROUPS_ADD , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_GROUPS_ADD , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Adds Groups to Skill
21,369
public function addKstrukturs ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doAddKstrukturs ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_KSTRUKTURS_ADD , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_KSTRUKTURS_ADD , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Adds Kstrukturs to Skill
21,370
public function addLineages ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doAddLineages ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_LINEAGES_ADD , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_LINEAGES_ADD , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Adds Lineages to Skill
21,371
public function addMultiples ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doAddMultiples ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_MULTIPLES_ADD , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_MULTIPLES_ADD , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Adds Multiples to Skill
21,372
public function addParts ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doAddParts ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_PARTS_ADD , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_PARTS_ADD , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Adds Parts to Skill
21,373
public function addPictures ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doAddPictures ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_PICTURES_ADD , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_PICTURES_ADD , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Adds Pictures to Skill
21,374
public function addReferences ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doAddReferences ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_REFERENCES_ADD , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_REFERENCES_ADD , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Adds References to Skill
21,375
public function addVariations ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doAddVariations ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_VARIATIONS_ADD , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_VARIATIONS_ADD , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Adds Variations to Skill
21,376
public function read ( $ id ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } return new Found ( [ 'model' => $ model ] ) ; }
Returns one Skill with the given id
21,377
public function removeFunctionPhases ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doRemoveFunctionPhases ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_FUNCTION_PHASES_REMOVE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_FUNCTION_PHASES_REMOVE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Removes FunctionPhases from Skill
21,378
public function removeGroups ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doRemoveGroups ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_GROUPS_REMOVE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_GROUPS_REMOVE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Removes Groups from Skill
21,379
public function removeKstrukturs ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doRemoveKstrukturs ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_KSTRUKTURS_REMOVE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_KSTRUKTURS_REMOVE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Removes Kstrukturs from Skill
21,380
public function removeLineages ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doRemoveLineages ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_LINEAGES_REMOVE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_LINEAGES_REMOVE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Removes Lineages from Skill
21,381
public function removeMultiples ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doRemoveMultiples ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_MULTIPLES_REMOVE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_MULTIPLES_REMOVE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Removes Multiples from Skill
21,382
public function removeParents ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doRemoveParents ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_CHILDREN_REMOVE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_CHILDREN_REMOVE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Removes Parents from Skill
21,383
public function removeParts ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doRemoveParts ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_PARTS_REMOVE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_PARTS_REMOVE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Removes Parts from Skill
21,384
public function removePictures ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doRemovePictures ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_PICTURES_REMOVE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_PICTURES_REMOVE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Removes Pictures from Skill
21,385
public function removeReferences ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doRemoveReferences ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_REFERENCES_REMOVE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_REFERENCES_REMOVE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Removes References from Skill
21,386
public function removeVariations ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doRemoveVariations ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_VARIATIONS_REMOVE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_VARIATIONS_REMOVE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Removes Variations from Skill
21,387
public function removeVideos ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doRemoveVideos ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_VIDEOS_REMOVE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_VIDEOS_REMOVE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Removes Videos from Skill
21,388
public function setEndPositionId ( $ id , $ relatedId ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } if ( $ this -> doSetEndPositionId ( $ model , $ relatedId ) ) { $ this -> dispatch ( SkillEvent :: PRE_END_POSITION_UPDATE , $ model ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model ) ; $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_END_POSITION_UPDATE , $ model ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model ) ; return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Sets the EndPosition id
21,389
public function setFeaturedPictureId ( $ id , $ relatedId ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } if ( $ this -> doSetFeaturedPictureId ( $ model , $ relatedId ) ) { $ this -> dispatch ( SkillEvent :: PRE_FEATURED_PICTURE_UPDATE , $ model ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model ) ; $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_FEATURED_PICTURE_UPDATE , $ model ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model ) ; return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Sets the FeaturedPicture id
21,390
public function setFeaturedTutorialId ( $ id , $ relatedId ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } if ( $ this -> doSetFeaturedTutorialId ( $ model , $ relatedId ) ) { $ this -> dispatch ( SkillEvent :: PRE_FEATURED_TUTORIAL_UPDATE , $ model ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model ) ; $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_FEATURED_TUTORIAL_UPDATE , $ model ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model ) ; return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Sets the FeaturedTutorial id
21,391
public function setFeaturedVideoId ( $ id , $ relatedId ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } if ( $ this -> doSetFeaturedVideoId ( $ model , $ relatedId ) ) { $ this -> dispatch ( SkillEvent :: PRE_FEATURED_VIDEO_UPDATE , $ model ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model ) ; $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_FEATURED_VIDEO_UPDATE , $ model ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model ) ; return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Sets the FeaturedVideo id
21,392
public function setFunctionPhaseRootId ( $ id , $ relatedId ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } if ( $ this -> doSetFunctionPhaseRootId ( $ model , $ relatedId ) ) { $ this -> dispatch ( SkillEvent :: PRE_FUNCTION_PHASE_ROOT_UPDATE , $ model ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model ) ; $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_FUNCTION_PHASE_ROOT_UPDATE , $ model ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model ) ; return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Sets the FunctionPhaseRoot id
21,393
public function setKstrukturRootId ( $ id , $ relatedId ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } if ( $ this -> doSetKstrukturRootId ( $ model , $ relatedId ) ) { $ this -> dispatch ( SkillEvent :: PRE_KSTRUKTUR_ROOT_UPDATE , $ model ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model ) ; $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_KSTRUKTUR_ROOT_UPDATE , $ model ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model ) ; return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Sets the KstrukturRoot id
21,394
public function setMultipleOfId ( $ id , $ relatedId ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } if ( $ this -> doSetMultipleOfId ( $ model , $ relatedId ) ) { $ this -> dispatch ( SkillEvent :: PRE_MULTIPLE_OF_UPDATE , $ model ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model ) ; $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_MULTIPLE_OF_UPDATE , $ model ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model ) ; return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Sets the MultipleOf id
21,395
public function setObjectId ( $ id , $ relatedId ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } if ( $ this -> doSetObjectId ( $ model , $ relatedId ) ) { $ this -> dispatch ( SkillEvent :: PRE_OBJECT_UPDATE , $ model ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model ) ; $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_OBJECT_UPDATE , $ model ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model ) ; return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Sets the Object id
21,396
public function setStartPositionId ( $ id , $ relatedId ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } if ( $ this -> doSetStartPositionId ( $ model , $ relatedId ) ) { $ this -> dispatch ( SkillEvent :: PRE_START_POSITION_UPDATE , $ model ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model ) ; $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_START_POSITION_UPDATE , $ model ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model ) ; return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Sets the StartPosition id
21,397
public function setVariationOfId ( $ id , $ relatedId ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } if ( $ this -> doSetVariationOfId ( $ model , $ relatedId ) ) { $ this -> dispatch ( SkillEvent :: PRE_VARIATION_OF_UPDATE , $ model ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model ) ; $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_VARIATION_OF_UPDATE , $ model ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model ) ; return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Sets the VariationOf id
21,398
public function updateFunctionPhases ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doUpdateFunctionPhases ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_FUNCTION_PHASES_UPDATE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_FUNCTION_PHASES_UPDATE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Updates FunctionPhases on Skill
21,399
public function updateKstrukturs ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doUpdateKstrukturs ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_KSTRUKTURS_UPDATE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_KSTRUKTURS_UPDATE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Updates Kstrukturs on Skill