repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
silverorange/swat
Swat/SwatUI.php
SwatUI.checkParsedObject
private function checkParsedObject( SwatUIObject $parsed_object, $element_name ) { if ($element_name == 'widget') { if ( class_exists('SwatWidget') && $parsed_object instanceof SwatWidget && $parsed_object->id !== null ) { // make sure id is unique if (isset($this->widgets[$parsed_object->id])) { throw new SwatDuplicateIdException( "A widget with an id of '{$parsed_object->id}' " . 'already exists.', 0, $parsed_object->id ); } } elseif ( !class_exists('SwatWidget') || !$parsed_object instanceof SwatWidget ) { $class_name = get_class($parsed_object); throw new SwatInvalidClassException( "'{$class_name}' is defined in a widget element but is " . 'not an instance of SwatWidget.', 0, $parsed_object ); } } elseif ($element_name == 'object') { if ( class_exists('SwatWidget') && $parsed_object instanceof SwatWidget ) { $class_name = get_class($parsed_object); throw new SwatInvalidClassException( "'{$class_name}' is defined in an object element but is " . 'and instance of SwatWidget and should be defined in a ' . 'widget element.', 0, $parsed_object ); } } }
php
private function checkParsedObject( SwatUIObject $parsed_object, $element_name ) { if ($element_name == 'widget') { if ( class_exists('SwatWidget') && $parsed_object instanceof SwatWidget && $parsed_object->id !== null ) { // make sure id is unique if (isset($this->widgets[$parsed_object->id])) { throw new SwatDuplicateIdException( "A widget with an id of '{$parsed_object->id}' " . 'already exists.', 0, $parsed_object->id ); } } elseif ( !class_exists('SwatWidget') || !$parsed_object instanceof SwatWidget ) { $class_name = get_class($parsed_object); throw new SwatInvalidClassException( "'{$class_name}' is defined in a widget element but is " . 'not an instance of SwatWidget.', 0, $parsed_object ); } } elseif ($element_name == 'object') { if ( class_exists('SwatWidget') && $parsed_object instanceof SwatWidget ) { $class_name = get_class($parsed_object); throw new SwatInvalidClassException( "'{$class_name}' is defined in an object element but is " . 'and instance of SwatWidget and should be defined in a ' . 'widget element.', 0, $parsed_object ); } } }
[ "private", "function", "checkParsedObject", "(", "SwatUIObject", "$", "parsed_object", ",", "$", "element_name", ")", "{", "if", "(", "$", "element_name", "==", "'widget'", ")", "{", "if", "(", "class_exists", "(", "'SwatWidget'", ")", "&&", "$", "parsed_objec...
Does some error checking on a parsed object Checks to make sure widget objects are created from widget elements and other objects are created from object elements. @param SwatUIObject $parsed_object an object that has been parsed from SwatML. @param string $element_name the name of the XML element node the object was parsed from. @throws SwatDuplicateIdException, SwatInvalidClassException
[ "Does", "some", "error", "checking", "on", "a", "parsed", "object" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUI.php#L520-L568
train
silverorange/swat
Swat/SwatUI.php
SwatUI.attachToParent
private function attachToParent(SwatUIObject $object, SwatUIParent $parent) { if ($parent instanceof SwatUIParent) { $parent->addChild($object); } else { $class_name = get_class($parent); throw new SwatDoesNotImplementException( "Can not add object to parent. '{$class_name}' does not " . 'implement SwatUIParent.', 0, $parent ); } }
php
private function attachToParent(SwatUIObject $object, SwatUIParent $parent) { if ($parent instanceof SwatUIParent) { $parent->addChild($object); } else { $class_name = get_class($parent); throw new SwatDoesNotImplementException( "Can not add object to parent. '{$class_name}' does not " . 'implement SwatUIParent.', 0, $parent ); } }
[ "private", "function", "attachToParent", "(", "SwatUIObject", "$", "object", ",", "SwatUIParent", "$", "parent", ")", "{", "if", "(", "$", "parent", "instanceof", "SwatUIParent", ")", "{", "$", "parent", "->", "addChild", "(", "$", "object", ")", ";", "}",...
Attaches a widget to a parent widget in the widget tree @param SwatUIObject $object the object to attach. @param SwatUIParent $parent the parent to attach the widget to. @throws SwatDoesNotImplementException
[ "Attaches", "a", "widget", "to", "a", "parent", "widget", "in", "the", "widget", "tree" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUI.php#L581-L594
train
silverorange/swat
Swat/SwatUI.php
SwatUI.parseObject
private function parseObject($node) { // class is required in the schema $class = $node->getAttribute('class'); if (!class_exists($class)) { throw new SwatClassNotFoundException( "Class '{$class}' is not defined.", 0, $class ); } // NOTE: this works because SwatUIObject is abstract if (!is_subclass_of($class, 'SwatUIObject')) { throw new SwatInvalidClassException( "Class '{$class}' is not a a descendant of SwatUIObject and " . 'cannot be added to the widget tree.' ); } $object = new $class(); // id is optional in the schema if ($node->hasAttribute('id')) { $object->id = $node->getAttribute('id'); } return $object; }
php
private function parseObject($node) { // class is required in the schema $class = $node->getAttribute('class'); if (!class_exists($class)) { throw new SwatClassNotFoundException( "Class '{$class}' is not defined.", 0, $class ); } // NOTE: this works because SwatUIObject is abstract if (!is_subclass_of($class, 'SwatUIObject')) { throw new SwatInvalidClassException( "Class '{$class}' is not a a descendant of SwatUIObject and " . 'cannot be added to the widget tree.' ); } $object = new $class(); // id is optional in the schema if ($node->hasAttribute('id')) { $object->id = $node->getAttribute('id'); } return $object; }
[ "private", "function", "parseObject", "(", "$", "node", ")", "{", "// class is required in the schema", "$", "class", "=", "$", "node", "->", "getAttribute", "(", "'class'", ")", ";", "if", "(", "!", "class_exists", "(", "$", "class", ")", ")", "{", "throw...
Parses an XML object or widget element node into a PHP object @param array $node the XML element node to parse. @return SwatUIObject a reference to the object created. @throws SwatClassNotFoundException
[ "Parses", "an", "XML", "object", "or", "widget", "element", "node", "into", "a", "PHP", "object" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUI.php#L608-L637
train
silverorange/swat
Swat/SwatUI.php
SwatUI.parseProperty
private function parseProperty($property_node, SwatUIObject $object) { $class_properties = get_class_vars(get_class($object)); // name is required in the schema $name = trim($property_node->getAttribute('name')); $value = $property_node->nodeValue; $array_property = false; if (preg_match('/^(.*)\[(.*)\]$/u', $name, $regs)) { $array_property = true; $name = $regs[1]; $array_key = $regs[2] == '' ? null : $regs[2]; } if (!array_key_exists($name, $class_properties)) { $class_name = get_class($object); throw new SwatInvalidPropertyException( "Property '{$name}' does not exist in class '{$class_name}' " . 'but is used in SwatML.', 0, $object, $name ); } // translatable is optional in the schema if ($property_node->hasAttribute('translatable')) { $translatable = $property_node->getAttribute('translatable') == 'yes'; } else { $translatable = false; } // type is optional in the schema if ($property_node->hasAttribute('type')) { $type = $property_node->getAttribute('type'); } else { $type = 'implicit-string'; } $parsed_value = $this->parseValue( $name, $value, $type, $translatable, $object ); if ($array_property) { if ($parsed_value instanceof SwatCellRendererMapping) { // it was a type=data property, // so the parsed value is a mapping object $parsed_value->is_array = true; $parsed_value->array_key = $array_key; } else { if (!is_array($object->$name)) { $object->$name = array(); } $array_ref = &$object->$name; if ($array_key === null) { $array_ref[] = $parsed_value; } else { $array_ref[$array_key] = $parsed_value; } } } else { $object->$name = $parsed_value; } }
php
private function parseProperty($property_node, SwatUIObject $object) { $class_properties = get_class_vars(get_class($object)); // name is required in the schema $name = trim($property_node->getAttribute('name')); $value = $property_node->nodeValue; $array_property = false; if (preg_match('/^(.*)\[(.*)\]$/u', $name, $regs)) { $array_property = true; $name = $regs[1]; $array_key = $regs[2] == '' ? null : $regs[2]; } if (!array_key_exists($name, $class_properties)) { $class_name = get_class($object); throw new SwatInvalidPropertyException( "Property '{$name}' does not exist in class '{$class_name}' " . 'but is used in SwatML.', 0, $object, $name ); } // translatable is optional in the schema if ($property_node->hasAttribute('translatable')) { $translatable = $property_node->getAttribute('translatable') == 'yes'; } else { $translatable = false; } // type is optional in the schema if ($property_node->hasAttribute('type')) { $type = $property_node->getAttribute('type'); } else { $type = 'implicit-string'; } $parsed_value = $this->parseValue( $name, $value, $type, $translatable, $object ); if ($array_property) { if ($parsed_value instanceof SwatCellRendererMapping) { // it was a type=data property, // so the parsed value is a mapping object $parsed_value->is_array = true; $parsed_value->array_key = $array_key; } else { if (!is_array($object->$name)) { $object->$name = array(); } $array_ref = &$object->$name; if ($array_key === null) { $array_ref[] = $parsed_value; } else { $array_ref[$array_key] = $parsed_value; } } } else { $object->$name = $parsed_value; } }
[ "private", "function", "parseProperty", "(", "$", "property_node", ",", "SwatUIObject", "$", "object", ")", "{", "$", "class_properties", "=", "get_class_vars", "(", "get_class", "(", "$", "object", ")", ")", ";", "// name is required in the schema", "$", "name", ...
Parses a single XML property node and applies it to an object @param array $property_node the XML property node to parse. @param SwatUIObject $object the object to apply the property to. @throws SwatInvalidPropertyException, SwatInvalidPropertyTypeException, SwatInvalidConstantExpressionException, SwatUndefinedConstantException
[ "Parses", "a", "single", "XML", "property", "node", "and", "applies", "it", "to", "an", "object" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUI.php#L652-L724
train
silverorange/swat
Swat/SwatUI.php
SwatUI.parseValue
private function parseValue( $name, $value, $type, $translatable, SwatUIObject $object ) { switch ($type) { case 'string': return $this->translateValue($value, $translatable, $object); case 'boolean': return $value == 'true' ? true : false; case 'integer': return intval($value); case 'float': return floatval($value); case 'constant': return $this->parseConstantExpression($value, $object); case 'data': return $this->parseMapping($name, $value, $object); case 'date': return new SwatDate($value); case 'implicit-string': if ($value == 'false' || $value == 'true') { trigger_error( __CLASS__ . ': Possible missing type="boolean" ' . 'attribute on property element', E_USER_NOTICE ); } if (is_numeric($value)) { trigger_error( __CLASS__ . ': Possible missing type="integer" ' . ' or type="float" attribute on property element', E_USER_NOTICE ); } return $this->translateValue($value, $translatable, $object); default: throw new SwatInvalidPropertyTypeException( "Property type '{$type}' is not a recognized type " . 'but is used in SwatML.', 0, $object, $type ); } }
php
private function parseValue( $name, $value, $type, $translatable, SwatUIObject $object ) { switch ($type) { case 'string': return $this->translateValue($value, $translatable, $object); case 'boolean': return $value == 'true' ? true : false; case 'integer': return intval($value); case 'float': return floatval($value); case 'constant': return $this->parseConstantExpression($value, $object); case 'data': return $this->parseMapping($name, $value, $object); case 'date': return new SwatDate($value); case 'implicit-string': if ($value == 'false' || $value == 'true') { trigger_error( __CLASS__ . ': Possible missing type="boolean" ' . 'attribute on property element', E_USER_NOTICE ); } if (is_numeric($value)) { trigger_error( __CLASS__ . ': Possible missing type="integer" ' . ' or type="float" attribute on property element', E_USER_NOTICE ); } return $this->translateValue($value, $translatable, $object); default: throw new SwatInvalidPropertyTypeException( "Property type '{$type}' is not a recognized type " . 'but is used in SwatML.', 0, $object, $type ); } }
[ "private", "function", "parseValue", "(", "$", "name", ",", "$", "value", ",", "$", "type", ",", "$", "translatable", ",", "SwatUIObject", "$", "object", ")", "{", "switch", "(", "$", "type", ")", "{", "case", "'string'", ":", "return", "$", "this", ...
Parses the value of a property Also does error notification in the event of a missing or unknown type attribute. @param string $name the name of the property. @param string $value the value of the property. @param string $type the type of the value. @param boolean translatable whether the property is translatable. @param SwatUIObject $object the object the property applies to. @return mixed the value of the property as an appropriate PHP datatype. @throws SwatInvalidPropertyTypeException, SwatInvalidConstantExpressionException, SwatUndefinedConstantException
[ "Parses", "the", "value", "of", "a", "property" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUI.php#L747-L798
train
silverorange/swat
Swat/SwatUI.php
SwatUI.parseMapping
private function parseMapping($name, $value, SwatUIObject $object) { $renderer = null; $renderer_container = null; foreach (array_reverse($this->stack) as $ancestor) { if ($renderer === null && $ancestor instanceof SwatCellRenderer) { $renderer = $ancestor; } elseif ($ancestor instanceof SwatCellRendererContainer) { $renderer_container = $ancestor; break; } } if ($renderer === null || $renderer_container === null) { throw new SwatInvalidPropertyTypeException( "Property type 'data' is only allowed on a SwatCellRenderer " . 'or on a widget within a SwatWidgetCellRenderer.', 0, $object, 'data' ); } $mapping = $renderer_container->addMappingToRenderer( $renderer, $value, $name, $object ); return $mapping; }
php
private function parseMapping($name, $value, SwatUIObject $object) { $renderer = null; $renderer_container = null; foreach (array_reverse($this->stack) as $ancestor) { if ($renderer === null && $ancestor instanceof SwatCellRenderer) { $renderer = $ancestor; } elseif ($ancestor instanceof SwatCellRendererContainer) { $renderer_container = $ancestor; break; } } if ($renderer === null || $renderer_container === null) { throw new SwatInvalidPropertyTypeException( "Property type 'data' is only allowed on a SwatCellRenderer " . 'or on a widget within a SwatWidgetCellRenderer.', 0, $object, 'data' ); } $mapping = $renderer_container->addMappingToRenderer( $renderer, $value, $name, $object ); return $mapping; }
[ "private", "function", "parseMapping", "(", "$", "name", ",", "$", "value", ",", "SwatUIObject", "$", "object", ")", "{", "$", "renderer", "=", "null", ";", "$", "renderer_container", "=", "null", ";", "foreach", "(", "array_reverse", "(", "$", "this", "...
Handle a 'data' type property value by parsing it into a mapping object @param string $name the name of the property. @param string $value the value of the property. @param SwatUIObject $object the object the property applies to. @return SwatCellRendererMapping the parsed mapping object. @throws SwatInvalidPropertyTypeException
[ "Handle", "a", "data", "type", "property", "value", "by", "parsing", "it", "into", "a", "mapping", "object" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUI.php#L814-L846
train
silverorange/swat
Swat/SwatUI.php
SwatUI.translateValue
private function translateValue($value, $translatable, SwatUIObject $object) { if (!$translatable) { return $value; } if ($this->translation_callback !== null) { return call_user_func($this->translation_callback, $value); } return $value; }
php
private function translateValue($value, $translatable, SwatUIObject $object) { if (!$translatable) { return $value; } if ($this->translation_callback !== null) { return call_user_func($this->translation_callback, $value); } return $value; }
[ "private", "function", "translateValue", "(", "$", "value", ",", "$", "translatable", ",", "SwatUIObject", "$", "object", ")", "{", "if", "(", "!", "$", "translatable", ")", "{", "return", "$", "value", ";", "}", "if", "(", "$", "this", "->", "translat...
Translates a property value if possible @param string $value the value to be translated. @param boolean $translatable whether or not it is possible to translate the value. @param SwatUIObject $object the object the property value applies to. @return string the translated value if possible, otherwise $value.
[ "Translates", "a", "property", "value", "if", "possible" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUI.php#L861-L872
train
silverorange/swat
Swat/SwatNumericEntry.php
SwatNumericEntry.process
public function process() { parent::process(); try { $value = $this->getNumericValue($this->value); } catch (SwatIntegerOverflowException $e) { $value = null; } if ($value !== null) { if ( $this->minimum_value !== null && $value < $this->minimum_value ) { $message = $this->getValidationMessage('below-minimum'); $minimum_value = str_replace( '%', '%%', $this->getDisplayValue($this->minimum_value) ); $message->primary_content = sprintf( $message->primary_content, $minimum_value ); $this->addMessage($message); } if ( $this->maximum_value !== null && $value > $this->maximum_value ) { $message = $this->getValidationMessage('above-maximum'); $maximum_value = str_replace( '%', '%%', $this->getDisplayValue($this->maximum_value) ); $message->primary_content = sprintf( $message->primary_content, $maximum_value ); $this->addMessage($message); } } }
php
public function process() { parent::process(); try { $value = $this->getNumericValue($this->value); } catch (SwatIntegerOverflowException $e) { $value = null; } if ($value !== null) { if ( $this->minimum_value !== null && $value < $this->minimum_value ) { $message = $this->getValidationMessage('below-minimum'); $minimum_value = str_replace( '%', '%%', $this->getDisplayValue($this->minimum_value) ); $message->primary_content = sprintf( $message->primary_content, $minimum_value ); $this->addMessage($message); } if ( $this->maximum_value !== null && $value > $this->maximum_value ) { $message = $this->getValidationMessage('above-maximum'); $maximum_value = str_replace( '%', '%%', $this->getDisplayValue($this->maximum_value) ); $message->primary_content = sprintf( $message->primary_content, $maximum_value ); $this->addMessage($message); } } }
[ "public", "function", "process", "(", ")", "{", "parent", "::", "process", "(", ")", ";", "try", "{", "$", "value", "=", "$", "this", "->", "getNumericValue", "(", "$", "this", "->", "value", ")", ";", "}", "catch", "(", "SwatIntegerOverflowException", ...
Checks the minimum and maximum values of this numeric entry widget
[ "Checks", "the", "minimum", "and", "maximum", "values", "of", "this", "numeric", "entry", "widget" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatNumericEntry.php#L67-L115
train
silverorange/swat
Swat/SwatNumericEntry.php
SwatNumericEntry.getValidationMessage
protected function getValidationMessage($id) { switch ($id) { case 'below-minimum': $text = $this->show_field_title_in_messages ? Swat::_('The %%s field must not be less than %s.') : Swat::_('This field must not be less than %s.'); $message = new SwatMessage($text, 'error'); break; case 'above-maximum': $text = $this->show_field_title_in_messages ? Swat::_('The %%s field must not be more than %s.') : Swat::_('This field must not be more than %s.'); $message = new SwatMessage($text, 'error'); break; default: $message = parent::getValidationMessage($id); break; } return $message; }
php
protected function getValidationMessage($id) { switch ($id) { case 'below-minimum': $text = $this->show_field_title_in_messages ? Swat::_('The %%s field must not be less than %s.') : Swat::_('This field must not be less than %s.'); $message = new SwatMessage($text, 'error'); break; case 'above-maximum': $text = $this->show_field_title_in_messages ? Swat::_('The %%s field must not be more than %s.') : Swat::_('This field must not be more than %s.'); $message = new SwatMessage($text, 'error'); break; default: $message = parent::getValidationMessage($id); break; } return $message; }
[ "protected", "function", "getValidationMessage", "(", "$", "id", ")", "{", "switch", "(", "$", "id", ")", "{", "case", "'below-minimum'", ":", "$", "text", "=", "$", "this", "->", "show_field_title_in_messages", "?", "Swat", "::", "_", "(", "'The %%s field m...
Gets a validation message for this numeric entry @see SwatEntry::getValidationMessage() @param string $id the string identifier of the validation message. @return SwatMessage the validation message.
[ "Gets", "a", "validation", "message", "for", "this", "numeric", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatNumericEntry.php#L128-L153
train
silverorange/swat
Swat/SwatTimeEntry.php
SwatTimeEntry.display
public function display() { if (!$this->visible) { return; } parent::display(); $div_tag = new SwatHtmlTag('div'); $div_tag->id = $this->id; $div_tag->class = $this->getCSSClassString(); $div_tag->open(); echo '<span class="swat-time-entry-span">'; if ($this->display_parts & self::HOUR) { $hour_flydown = $this->getCompositeWidget('hour_flydown'); if ($hour_flydown->value === null && $this->value !== null) { // work around a bug in PEAR::Date that returns hour as a string $hour = intval($this->value->getHour()); // convert 24-hour value to 12-hour display if ($this->twelve_hour) { if ($hour > 12) { $hour -= 12; } if ($hour === 0) { $hour = 12; } } $hour_flydown->value = $hour; } $hour_flydown->display(); if ($this->display_parts & (self::MINUTE | self::SECOND)) { echo ':'; } } if ($this->display_parts & self::MINUTE) { $minute_flydown = $this->getCompositeWidget('minute_flydown'); if ($minute_flydown->value === null && $this->value !== null) { // work around a bug in PEAR::Date that returns minutes as a // 2-character string $minute = intval($this->value->getMinute()); $minute_flydown->value = $minute; } $minute_flydown->display(); if ($this->display_parts & self::SECOND) { echo ':'; } } if ($this->display_parts & self::SECOND) { $second_flydown = $this->getCompositeWidget('second_flydown'); if ($second_flydown->value === null && $this->value !== null) { $second_flydown->value = $this->value->getSecond(); } $second_flydown->display(); } if ($this->display_parts & self::HOUR && $this->twelve_hour) { $am_pm_flydown = $this->getCompositeWidget('am_pm_flydown'); if ($am_pm_flydown->value === null && $this->value !== null) { $am_pm_flydown->value = $this->value->getHour() < 12 ? 'am' : 'pm'; } $am_pm_flydown->display(); } echo '</span>'; Swat::displayInlineJavaScript($this->getInlineJavaScript()); $div_tag->close(); }
php
public function display() { if (!$this->visible) { return; } parent::display(); $div_tag = new SwatHtmlTag('div'); $div_tag->id = $this->id; $div_tag->class = $this->getCSSClassString(); $div_tag->open(); echo '<span class="swat-time-entry-span">'; if ($this->display_parts & self::HOUR) { $hour_flydown = $this->getCompositeWidget('hour_flydown'); if ($hour_flydown->value === null && $this->value !== null) { // work around a bug in PEAR::Date that returns hour as a string $hour = intval($this->value->getHour()); // convert 24-hour value to 12-hour display if ($this->twelve_hour) { if ($hour > 12) { $hour -= 12; } if ($hour === 0) { $hour = 12; } } $hour_flydown->value = $hour; } $hour_flydown->display(); if ($this->display_parts & (self::MINUTE | self::SECOND)) { echo ':'; } } if ($this->display_parts & self::MINUTE) { $minute_flydown = $this->getCompositeWidget('minute_flydown'); if ($minute_flydown->value === null && $this->value !== null) { // work around a bug in PEAR::Date that returns minutes as a // 2-character string $minute = intval($this->value->getMinute()); $minute_flydown->value = $minute; } $minute_flydown->display(); if ($this->display_parts & self::SECOND) { echo ':'; } } if ($this->display_parts & self::SECOND) { $second_flydown = $this->getCompositeWidget('second_flydown'); if ($second_flydown->value === null && $this->value !== null) { $second_flydown->value = $this->value->getSecond(); } $second_flydown->display(); } if ($this->display_parts & self::HOUR && $this->twelve_hour) { $am_pm_flydown = $this->getCompositeWidget('am_pm_flydown'); if ($am_pm_flydown->value === null && $this->value !== null) { $am_pm_flydown->value = $this->value->getHour() < 12 ? 'am' : 'pm'; } $am_pm_flydown->display(); } echo '</span>'; Swat::displayInlineJavaScript($this->getInlineJavaScript()); $div_tag->close(); }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "parent", "::", "display", "(", ")", ";", "$", "div_tag", "=", "new", "SwatHtmlTag", "(", "'div'", ")", ";", "$", "div_tag",...
Displays this time entry
[ "Displays", "this", "time", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTimeEntry.php#L190-L271
train
silverorange/swat
Swat/SwatTimeEntry.php
SwatTimeEntry.isStartTimeValid
protected function isStartTimeValid() { $this->valid_range_start->setYear(self::$date_year); $this->valid_range_start->setMonth(self::$date_month); $this->valid_range_start->setDay(self::$date_day); $this->valid_range_start->setTZById('UTC'); return SwatDate::compare( $this->value, $this->valid_range_start, true ) >= 0; }
php
protected function isStartTimeValid() { $this->valid_range_start->setYear(self::$date_year); $this->valid_range_start->setMonth(self::$date_month); $this->valid_range_start->setDay(self::$date_day); $this->valid_range_start->setTZById('UTC'); return SwatDate::compare( $this->value, $this->valid_range_start, true ) >= 0; }
[ "protected", "function", "isStartTimeValid", "(", ")", "{", "$", "this", "->", "valid_range_start", "->", "setYear", "(", "self", "::", "$", "date_year", ")", ";", "$", "this", "->", "valid_range_start", "->", "setMonth", "(", "self", "::", "$", "date_month"...
Checks if the entered time is valid with respect to the valid start time @return boolean true if the entered time is on or after the valid start time and false if the entered time is before the valid start time.
[ "Checks", "if", "the", "entered", "time", "is", "valid", "with", "respect", "to", "the", "valid", "start", "time" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTimeEntry.php#L586-L598
train
silverorange/swat
Swat/SwatTimeEntry.php
SwatTimeEntry.isEndTimeValid
protected function isEndTimeValid() { $this->valid_range_end->setYear(self::$date_year); $this->valid_range_end->setMonth(self::$date_month); $this->valid_range_end->setDay(self::$date_day); $this->valid_range_end->setTZById('UTC'); return SwatDate::compare($this->value, $this->valid_range_end, true) <= 0; }
php
protected function isEndTimeValid() { $this->valid_range_end->setYear(self::$date_year); $this->valid_range_end->setMonth(self::$date_month); $this->valid_range_end->setDay(self::$date_day); $this->valid_range_end->setTZById('UTC'); return SwatDate::compare($this->value, $this->valid_range_end, true) <= 0; }
[ "protected", "function", "isEndTimeValid", "(", ")", "{", "$", "this", "->", "valid_range_end", "->", "setYear", "(", "self", "::", "$", "date_year", ")", ";", "$", "this", "->", "valid_range_end", "->", "setMonth", "(", "self", "::", "$", "date_month", ")...
Checks if the entered time is valid with respect to the valid end time @return boolean true if the entered time is before the valid end time and false if the entered time is on or after the valid end time.
[ "Checks", "if", "the", "entered", "time", "is", "valid", "with", "respect", "to", "the", "valid", "end", "time" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTimeEntry.php#L610-L619
train
silverorange/swat
Swat/SwatTimeEntry.php
SwatTimeEntry.createCompositeWidgets
protected function createCompositeWidgets() { if ($this->display_parts & self::HOUR) { $this->addCompositeWidget( $this->createHourFlydown(), 'hour_flydown' ); if ($this->twelve_hour) { $this->addCompositeWidget( $this->createAmPmFlydown(), 'am_pm_flydown' ); } } if ($this->display_parts & self::MINUTE) { $this->addCompositeWidget( $this->createMinuteFlydown(), 'minute_flydown' ); } if ($this->display_parts & self::SECOND) { $this->addCompositeWidget( $this->createSecondFlydown(), 'second_flydown' ); } }
php
protected function createCompositeWidgets() { if ($this->display_parts & self::HOUR) { $this->addCompositeWidget( $this->createHourFlydown(), 'hour_flydown' ); if ($this->twelve_hour) { $this->addCompositeWidget( $this->createAmPmFlydown(), 'am_pm_flydown' ); } } if ($this->display_parts & self::MINUTE) { $this->addCompositeWidget( $this->createMinuteFlydown(), 'minute_flydown' ); } if ($this->display_parts & self::SECOND) { $this->addCompositeWidget( $this->createSecondFlydown(), 'second_flydown' ); } }
[ "protected", "function", "createCompositeWidgets", "(", ")", "{", "if", "(", "$", "this", "->", "display_parts", "&", "self", "::", "HOUR", ")", "{", "$", "this", "->", "addCompositeWidget", "(", "$", "this", "->", "createHourFlydown", "(", ")", ",", "'hou...
Creates the composite widgets used by this time entry @see SwatWidget::createCompositeWidgets()
[ "Creates", "the", "composite", "widgets", "used", "by", "this", "time", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTimeEntry.php#L629-L658
train
silverorange/swat
Swat/SwatTimeEntry.php
SwatTimeEntry.createHourFlydown
private function createHourFlydown() { $flydown = new SwatFlydown($this->id . '_hour'); $flydown->classes = array('swat-time-entry-hour'); if ($this->twelve_hour) { for ($i = 1; $i <= 12; $i++) { $flydown->addOption($i, $i); } } else { for ($i = 0; $i < 24; $i++) { $flydown->addOption($i, $i); } } return $flydown; }
php
private function createHourFlydown() { $flydown = new SwatFlydown($this->id . '_hour'); $flydown->classes = array('swat-time-entry-hour'); if ($this->twelve_hour) { for ($i = 1; $i <= 12; $i++) { $flydown->addOption($i, $i); } } else { for ($i = 0; $i < 24; $i++) { $flydown->addOption($i, $i); } } return $flydown; }
[ "private", "function", "createHourFlydown", "(", ")", "{", "$", "flydown", "=", "new", "SwatFlydown", "(", "$", "this", "->", "id", ".", "'_hour'", ")", ";", "$", "flydown", "->", "classes", "=", "array", "(", "'swat-time-entry-hour'", ")", ";", "if", "(...
Creates the hour flydown for this time entry @return the hour flydown for this time entry.
[ "Creates", "the", "hour", "flydown", "for", "this", "time", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTimeEntry.php#L668-L684
train
silverorange/swat
Swat/SwatTimeEntry.php
SwatTimeEntry.createMinuteFlydown
private function createMinuteFlydown() { $flydown = new SwatFlydown($this->id . '_minute'); $flydown->classes = array('swat-time-entry-minute'); for ($i = 0; $i <= 59; $i++) { $flydown->addOption($i, str_pad($i, 2, '0', STR_PAD_LEFT)); } return $flydown; }
php
private function createMinuteFlydown() { $flydown = new SwatFlydown($this->id . '_minute'); $flydown->classes = array('swat-time-entry-minute'); for ($i = 0; $i <= 59; $i++) { $flydown->addOption($i, str_pad($i, 2, '0', STR_PAD_LEFT)); } return $flydown; }
[ "private", "function", "createMinuteFlydown", "(", ")", "{", "$", "flydown", "=", "new", "SwatFlydown", "(", "$", "this", "->", "id", ".", "'_minute'", ")", ";", "$", "flydown", "->", "classes", "=", "array", "(", "'swat-time-entry-minute'", ")", ";", "for...
Creates the minute flydown for this time entry @return SwatFlydown the minute flydown for this time entry.
[ "Creates", "the", "minute", "flydown", "for", "this", "time", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTimeEntry.php#L694-L704
train
silverorange/swat
Swat/SwatTimeEntry.php
SwatTimeEntry.getFormattedTime
private function getFormattedTime(SwatDate $time) { $format = ''; if ($this->display_parts & self::HOUR) { $format .= $this->twelve_hour ? 'h' : 'H'; if ($this->display_parts & (self::MINUTE | self::SECOND)) { $format .= ':'; } } if ($this->display_parts & self::MINUTE) { $format .= 'mm'; if ($this->display_parts & self::SECOND) { $format .= ':'; } } if ($this->display_parts & self::SECOND) { $format .= 'ss'; } if ($this->display_parts & self::HOUR && $this->twelve_hour) { $format .= ' a'; } return $time->formatLikeIntl($format); }
php
private function getFormattedTime(SwatDate $time) { $format = ''; if ($this->display_parts & self::HOUR) { $format .= $this->twelve_hour ? 'h' : 'H'; if ($this->display_parts & (self::MINUTE | self::SECOND)) { $format .= ':'; } } if ($this->display_parts & self::MINUTE) { $format .= 'mm'; if ($this->display_parts & self::SECOND) { $format .= ':'; } } if ($this->display_parts & self::SECOND) { $format .= 'ss'; } if ($this->display_parts & self::HOUR && $this->twelve_hour) { $format .= ' a'; } return $time->formatLikeIntl($format); }
[ "private", "function", "getFormattedTime", "(", "SwatDate", "$", "time", ")", "{", "$", "format", "=", "''", ";", "if", "(", "$", "this", "->", "display_parts", "&", "self", "::", "HOUR", ")", "{", "$", "format", ".=", "$", "this", "->", "twelve_hour",...
Formats a time for display in error messages @param SwatDate $time the time to format. @return string the formatted time.
[ "Formats", "a", "time", "for", "display", "in", "error", "messages" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTimeEntry.php#L756-L783
train
rollun-com/rollun-datastore
src/DataStore/src/DataStore/CsvIntId.php
CsvIntId.checkIntegrityData
public function checkIntegrityData() { $prevId = 0; $identifier = $this->getIdentifier(); foreach ($this as $item) { $this->checkIdentifierType($item[$identifier]); if ($item[$identifier] < $prevId) { throw new DataStoreException("This storage type supports only a list ordered by id ASC"); } $prevId = $item[$identifier]; } return true; }
php
public function checkIntegrityData() { $prevId = 0; $identifier = $this->getIdentifier(); foreach ($this as $item) { $this->checkIdentifierType($item[$identifier]); if ($item[$identifier] < $prevId) { throw new DataStoreException("This storage type supports only a list ordered by id ASC"); } $prevId = $item[$identifier]; } return true; }
[ "public", "function", "checkIntegrityData", "(", ")", "{", "$", "prevId", "=", "0", ";", "$", "identifier", "=", "$", "this", "->", "getIdentifier", "(", ")", ";", "foreach", "(", "$", "this", "as", "$", "item", ")", "{", "$", "this", "->", "checkIde...
Checks integrity data @return bool @throws \rollun\datastore\DataStore\DataStoreException
[ "Checks", "integrity", "data" ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/CsvIntId.php#L112-L128
train
brainworxx/kreXX
src/Errorhandler/Fatal.php
Fatal.shutdownCallback
public function shutdownCallback() { $error = error_get_last(); // Do we have an error at all? if ($error !== null && $this->getIsActive() === true) { // Do we need to check this one, according to our settings? $translatedError = $this->translateErrorType($error[static::TRACE_TYPE]); if ($translatedError[1] === 'traceFatals') { // We also need to prepare some Data we want to display. $errorType = $this->translateErrorType($error[static::TRACE_TYPE]); // We prepare the error as far as we can here. // The adding of the sourcecode happens in the controller. $errorData = array( static::TRACE_TYPE => $errorType[0], static::TRACE_ERROR_STRING => $error['message'], static::TRACE_ERROR_FILE => $error[static::TRACE_FILE], static::TRACE_ERROR_LINE => $error[static::TRACE_LINE], 'handler' => __FUNCTION__, static::TRACE_FILE => $error[static::TRACE_FILE], static::TRACE_BACKTRACE => $this->tickedBacktrace, ); // Tell static main class, that we start a new analysis, to // prevent an infinite loop. AbstractController::$analysisInProgress = true; $this->pool ->createClass('Brainworxx\\Krexx\\Controller\\ErrorController') ->errorAction($errorData); } } // Clean exit. }
php
public function shutdownCallback() { $error = error_get_last(); // Do we have an error at all? if ($error !== null && $this->getIsActive() === true) { // Do we need to check this one, according to our settings? $translatedError = $this->translateErrorType($error[static::TRACE_TYPE]); if ($translatedError[1] === 'traceFatals') { // We also need to prepare some Data we want to display. $errorType = $this->translateErrorType($error[static::TRACE_TYPE]); // We prepare the error as far as we can here. // The adding of the sourcecode happens in the controller. $errorData = array( static::TRACE_TYPE => $errorType[0], static::TRACE_ERROR_STRING => $error['message'], static::TRACE_ERROR_FILE => $error[static::TRACE_FILE], static::TRACE_ERROR_LINE => $error[static::TRACE_LINE], 'handler' => __FUNCTION__, static::TRACE_FILE => $error[static::TRACE_FILE], static::TRACE_BACKTRACE => $this->tickedBacktrace, ); // Tell static main class, that we start a new analysis, to // prevent an infinite loop. AbstractController::$analysisInProgress = true; $this->pool ->createClass('Brainworxx\\Krexx\\Controller\\ErrorController') ->errorAction($errorData); } } // Clean exit. }
[ "public", "function", "shutdownCallback", "(", ")", "{", "$", "error", "=", "error_get_last", "(", ")", ";", "// Do we have an error at all?", "if", "(", "$", "error", "!==", "null", "&&", "$", "this", "->", "getIsActive", "(", ")", "===", "true", ")", "{"...
The registered shutdown callback handles fatal errors. In case that this handler is active, it will check whether a fatal error has happened and give additional info like backtrace, object analysis of the backtrace and code samples to all stations in the backtrace.
[ "The", "registered", "shutdown", "callback", "handles", "fatal", "errors", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Errorhandler/Fatal.php#L93-L127
train
silverorange/swat
Swat/SwatFloatEntry.php
SwatFloatEntry.process
public function process() { parent::process(); if ($this->value === null) { return; } $float_value = $this->getNumericValue($this->value); if ($float_value === null) { $this->addMessage($this->getValidationMessage('float')); } else { $this->value = $float_value; } }
php
public function process() { parent::process(); if ($this->value === null) { return; } $float_value = $this->getNumericValue($this->value); if ($float_value === null) { $this->addMessage($this->getValidationMessage('float')); } else { $this->value = $float_value; } }
[ "public", "function", "process", "(", ")", "{", "parent", "::", "process", "(", ")", ";", "if", "(", "$", "this", "->", "value", "===", "null", ")", "{", "return", ";", "}", "$", "float_value", "=", "$", "this", "->", "getNumericValue", "(", "$", "...
Checks to make sure value is a number If the value of this widget is not a number then an error message is attached to this widget.
[ "Checks", "to", "make", "sure", "value", "is", "a", "number" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatFloatEntry.php#L20-L35
train
silverorange/swat
Swat/SwatFloatEntry.php
SwatFloatEntry.getDisplayValue
protected function getDisplayValue($value) { if (is_numeric($value)) { $locale = SwatI18NLocale::get(); $thousands_separator = $this->show_thousands_separator ? null : ''; $value = $locale->formatNumber($value, null, array( 'thousands_separator' => $thousands_separator )); } else { $value = parent::getDisplayValue($value); } return $value; }
php
protected function getDisplayValue($value) { if (is_numeric($value)) { $locale = SwatI18NLocale::get(); $thousands_separator = $this->show_thousands_separator ? null : ''; $value = $locale->formatNumber($value, null, array( 'thousands_separator' => $thousands_separator )); } else { $value = parent::getDisplayValue($value); } return $value; }
[ "protected", "function", "getDisplayValue", "(", "$", "value", ")", "{", "if", "(", "is_numeric", "(", "$", "value", ")", ")", "{", "$", "locale", "=", "SwatI18NLocale", "::", "get", "(", ")", ";", "$", "thousands_separator", "=", "$", "this", "->", "s...
Formats a float value to display @param string $value the value to format for display. @return string the formatted value.
[ "Formats", "a", "float", "value", "to", "display" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatFloatEntry.php#L47-L61
train
brainworxx/kreXX
src/Analyse/Callback/Analyse/Objects/DebugMethods.php
DebugMethods.callMe
public function callMe() { /** @var \Brainworxx\Krexx\Service\Reflection\ReflectionClass $reflectionClass */ $reflectionClass = $this->parameters[static::PARAM_REF]; $data = $reflectionClass->getData(); $output = $this->dispatchStartEvent(); foreach (explode(',', $this->pool->config->getSetting(Fallback::SETTING_DEBUG_METHODS)) as $funcName) { if ($this->checkIfAccessible($data, $funcName, $reflectionClass) === true) { // Add a try to prevent the hosting CMS from doing something stupid. try { // We need to deactivate the current error handling to // prevent the host system to do anything stupid. set_error_handler( function () { // Do nothing. } ); $result = $data->$funcName(); } catch (\Throwable $e) { //Restore the previous error handler, and return an empty string. restore_error_handler(); continue; } catch (\Exception $e) { // Restore the old error handler and move to the next method. restore_error_handler(); continue; } // Reactivate whatever error handling we had previously. restore_error_handler(); // We ignore NULL values, as well as the exceptions from above. if (isset($result) === true) { $output .= $this->pool->render->renderExpandableChild( $this->dispatchEventWithModel( $funcName, $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setName($funcName) ->setType(static::TYPE_DEBUG_METHOD) ->setNormal(static::UNKNOWN_VALUE) ->setHelpid($funcName) ->setConnectorType(Connectors::METHOD) ->addParameter(static::PARAM_DATA, $result) ->injectCallback( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Debug') ) ) ); unset($result); } } } return $output; }
php
public function callMe() { /** @var \Brainworxx\Krexx\Service\Reflection\ReflectionClass $reflectionClass */ $reflectionClass = $this->parameters[static::PARAM_REF]; $data = $reflectionClass->getData(); $output = $this->dispatchStartEvent(); foreach (explode(',', $this->pool->config->getSetting(Fallback::SETTING_DEBUG_METHODS)) as $funcName) { if ($this->checkIfAccessible($data, $funcName, $reflectionClass) === true) { // Add a try to prevent the hosting CMS from doing something stupid. try { // We need to deactivate the current error handling to // prevent the host system to do anything stupid. set_error_handler( function () { // Do nothing. } ); $result = $data->$funcName(); } catch (\Throwable $e) { //Restore the previous error handler, and return an empty string. restore_error_handler(); continue; } catch (\Exception $e) { // Restore the old error handler and move to the next method. restore_error_handler(); continue; } // Reactivate whatever error handling we had previously. restore_error_handler(); // We ignore NULL values, as well as the exceptions from above. if (isset($result) === true) { $output .= $this->pool->render->renderExpandableChild( $this->dispatchEventWithModel( $funcName, $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setName($funcName) ->setType(static::TYPE_DEBUG_METHOD) ->setNormal(static::UNKNOWN_VALUE) ->setHelpid($funcName) ->setConnectorType(Connectors::METHOD) ->addParameter(static::PARAM_DATA, $result) ->injectCallback( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Debug') ) ) ); unset($result); } } } return $output; }
[ "public", "function", "callMe", "(", ")", "{", "/** @var \\Brainworxx\\Krexx\\Service\\Reflection\\ReflectionClass $reflectionClass */", "$", "reflectionClass", "=", "$", "this", "->", "parameters", "[", "static", "::", "PARAM_REF", "]", ";", "$", "data", "=", "$", "r...
Calls all configured debug methods in die class. I've added a try and an empty error function callback to catch possible problems with this. This will, of cause, not stop a possible fatal in the function itself. @return string The generated markup.
[ "Calls", "all", "configured", "debug", "methods", "in", "die", "class", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects/DebugMethods.php#L71-L126
train
brainworxx/kreXX
src/Analyse/Callback/Analyse/Objects/DebugMethods.php
DebugMethods.checkIfAccessible
protected function checkIfAccessible($data, $funcName, ReflectionClass $reflectionClass) { // We need to check if: // 1.) Method exists. It may be protected though. // 2.) Method can be called. There may be a magical method, though. // 3.) It's not blacklisted. if (method_exists($data, $funcName) === true && is_callable(array($data, $funcName)) === true && $this->pool->config->isAllowedDebugCall($data) === true) { // We need to check if the callable function requires any parameters. // We will not call those, because we simply can not provide them. $ref = $reflectionClass->getMethod($funcName); /** @var \ReflectionParameter $param */ foreach ($ref->getParameters() as $param) { if ($param->isOptional() === false) { // We've got a required parameter! // We will not call this one. return false; } } return true; } return false; }
php
protected function checkIfAccessible($data, $funcName, ReflectionClass $reflectionClass) { // We need to check if: // 1.) Method exists. It may be protected though. // 2.) Method can be called. There may be a magical method, though. // 3.) It's not blacklisted. if (method_exists($data, $funcName) === true && is_callable(array($data, $funcName)) === true && $this->pool->config->isAllowedDebugCall($data) === true) { // We need to check if the callable function requires any parameters. // We will not call those, because we simply can not provide them. $ref = $reflectionClass->getMethod($funcName); /** @var \ReflectionParameter $param */ foreach ($ref->getParameters() as $param) { if ($param->isOptional() === false) { // We've got a required parameter! // We will not call this one. return false; } } return true; } return false; }
[ "protected", "function", "checkIfAccessible", "(", "$", "data", ",", "$", "funcName", ",", "ReflectionClass", "$", "reflectionClass", ")", "{", "// We need to check if:", "// 1.) Method exists. It may be protected though.", "// 2.) Method can be called. There may be a magical metho...
Check if we are allowed to access this class method as a debug method for this class. @param mixed $data The class that we are currently analysing. @param string $funcName The name of the function that we want to call. @param ReflectionClass $reflectionClass The reflection of the class that we are currently analysing. @return boolean Whether or not we are allowed toi access this method.
[ "Check", "if", "we", "are", "allowed", "to", "access", "this", "class", "method", "as", "a", "debug", "method", "for", "this", "class", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects/DebugMethods.php#L141-L167
train
brainworxx/kreXX
src/Analyse/Routing/Process/ProcessNull.php
ProcessNull.process
public function process(Model $model) { $data = 'NULL'; return $this->pool->render->renderSingleChild( $model->setData($data)->setNormal($data)->setType(static::TYPE_NULL) ); }
php
public function process(Model $model) { $data = 'NULL'; return $this->pool->render->renderSingleChild( $model->setData($data)->setNormal($data)->setType(static::TYPE_NULL) ); }
[ "public", "function", "process", "(", "Model", "$", "model", ")", "{", "$", "data", "=", "'NULL'", ";", "return", "$", "this", "->", "pool", "->", "render", "->", "renderSingleChild", "(", "$", "model", "->", "setData", "(", "$", "data", ")", "->", "...
Render a 'dump' for a NULL value. @param Model $model The model with the data for the output. @return string The rendered markup.
[ "Render", "a", "dump", "for", "a", "NULL", "value", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Routing/Process/ProcessNull.php#L57-L63
train
brainworxx/kreXX
src/Controller/BacktraceController.php
BacktraceController.backtraceAction
public function backtraceAction(array $backtrace = null) { if ($this->pool->emergencyHandler->checkMaxCall() === true) { // Called too often, we might get into trouble here! return $this; } $this->pool->reset(); // Find caller. $caller = $this->callerFinder->findCaller(static::TRACE_BACKTRACE, array()); $this->pool->scope->setScope($caller[static::TRACE_VARNAME]); $analysis = $this->pool ->createClass('Brainworxx\\Krexx\\Analyse\\Routing\\Process\\ProcessBacktrace') ->process($backtrace); // Detect the encoding on the start-chunk-string of the analysis // for a complete encoding picture. $this->pool->chunks->detectEncoding($analysis); // Now that our analysis is done, we must check if there was an emergency // break. if ($this->pool->emergencyHandler->checkEmergencyBreak() === true) { return $this; } // Add the caller as metadata to the chunks class. It will be saved as // additional info, in case we are logging to a file. $this->pool->chunks->addMetadata($caller); // We need to get the footer before the generating of the header, // because we need to display messages in the header from the configuration. $footer = $this->outputFooter($caller); $this->outputService ->addChunkString($this->pool->render->renderHeader(static::TRACE_BACKTRACE, $this->outputCssAndJs())) ->addChunkString($analysis) ->addChunkString($footer) ->finalize(); return $this; }
php
public function backtraceAction(array $backtrace = null) { if ($this->pool->emergencyHandler->checkMaxCall() === true) { // Called too often, we might get into trouble here! return $this; } $this->pool->reset(); // Find caller. $caller = $this->callerFinder->findCaller(static::TRACE_BACKTRACE, array()); $this->pool->scope->setScope($caller[static::TRACE_VARNAME]); $analysis = $this->pool ->createClass('Brainworxx\\Krexx\\Analyse\\Routing\\Process\\ProcessBacktrace') ->process($backtrace); // Detect the encoding on the start-chunk-string of the analysis // for a complete encoding picture. $this->pool->chunks->detectEncoding($analysis); // Now that our analysis is done, we must check if there was an emergency // break. if ($this->pool->emergencyHandler->checkEmergencyBreak() === true) { return $this; } // Add the caller as metadata to the chunks class. It will be saved as // additional info, in case we are logging to a file. $this->pool->chunks->addMetadata($caller); // We need to get the footer before the generating of the header, // because we need to display messages in the header from the configuration. $footer = $this->outputFooter($caller); $this->outputService ->addChunkString($this->pool->render->renderHeader(static::TRACE_BACKTRACE, $this->outputCssAndJs())) ->addChunkString($analysis) ->addChunkString($footer) ->finalize(); return $this; }
[ "public", "function", "backtraceAction", "(", "array", "$", "backtrace", "=", "null", ")", "{", "if", "(", "$", "this", "->", "pool", "->", "emergencyHandler", "->", "checkMaxCall", "(", ")", "===", "true", ")", "{", "// Called too often, we might get into troub...
Outputs a backtrace. @param array|null $backtrace An already existing backtrace. @return $this Return $this for chaining.
[ "Outputs", "a", "backtrace", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Controller/BacktraceController.php#L54-L96
train
silverorange/swat
Swat/SwatTableViewCheckboxColumn.php
SwatTableViewCheckboxColumn.init
public function init() { parent::init(); $this->createEmbeddedWidgets(); $this->check_all->init(); if ($this->show_check_all && $this->visible) { $this->parent->appendRow($this->check_all); } }
php
public function init() { parent::init(); $this->createEmbeddedWidgets(); $this->check_all->init(); if ($this->show_check_all && $this->visible) { $this->parent->appendRow($this->check_all); } }
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "$", "this", "->", "createEmbeddedWidgets", "(", ")", ";", "$", "this", "->", "check_all", "->", "init", "(", ")", ";", "if", "(", "$", "this", "->", "show_check_all"...
Initializes this checkbox column
[ "Initializes", "this", "checkbox", "column" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewCheckboxColumn.php#L121-L131
train
silverorange/swat
Swat/SwatTableViewCheckboxColumn.php
SwatTableViewCheckboxColumn.process
public function process() { parent::process(); if ($this->show_check_all) { $this->check_all->process(); } // this is part of the old selection API $item_name = $this->getCheckboxRendererId(); if (isset($_POST[$item_name]) && is_array($_POST[$item_name])) { $this->items = $_POST[$item_name]; } }
php
public function process() { parent::process(); if ($this->show_check_all) { $this->check_all->process(); } // this is part of the old selection API $item_name = $this->getCheckboxRendererId(); if (isset($_POST[$item_name]) && is_array($_POST[$item_name])) { $this->items = $_POST[$item_name]; } }
[ "public", "function", "process", "(", ")", "{", "parent", "::", "process", "(", ")", ";", "if", "(", "$", "this", "->", "show_check_all", ")", "{", "$", "this", "->", "check_all", "->", "process", "(", ")", ";", "}", "// this is part of the old selection A...
Processes this checkbox column Column-level processing is needed for the deprecated selection API. @see SwatView::getSelection()
[ "Processes", "this", "checkbox", "column" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewCheckboxColumn.php#L143-L156
train
silverorange/swat
Swat/SwatInputCell.php
SwatInputCell.init
public function init() { if ($this->widget !== null) { $this->widget->init(); } // ensure the widget has an id if ($this->widget->id === null) { $this->widget->id = $this->widget->getUniqueId(); } }
php
public function init() { if ($this->widget !== null) { $this->widget->init(); } // ensure the widget has an id if ($this->widget->id === null) { $this->widget->id = $this->widget->getUniqueId(); } }
[ "public", "function", "init", "(", ")", "{", "if", "(", "$", "this", "->", "widget", "!==", "null", ")", "{", "$", "this", "->", "widget", "->", "init", "(", ")", ";", "}", "// ensure the widget has an id", "if", "(", "$", "this", "->", "widget", "->...
Initializes this input cell This calls {@link SwatWidget::init()} on the cell's prototype widget.
[ "Initializes", "this", "input", "cell" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatInputCell.php#L106-L116
train
silverorange/swat
Swat/SwatInputCell.php
SwatInputCell.getWidget
public function getWidget($row_identifier, $widget_id = null) { $this->getClonedWidget($row_identifier); if ($widget_id === null && isset($this->clones[$row_identifier])) { return $this->clones[$row_identifier]; } elseif ( $widget_id !== null && isset($this->widgets[$row_identifier][$widget_id]) ) { return $this->widgets[$row_identifier][$widget_id]; } throw new SwatException( 'The specified widget was not found with the ' . 'specified row identifier.' ); }
php
public function getWidget($row_identifier, $widget_id = null) { $this->getClonedWidget($row_identifier); if ($widget_id === null && isset($this->clones[$row_identifier])) { return $this->clones[$row_identifier]; } elseif ( $widget_id !== null && isset($this->widgets[$row_identifier][$widget_id]) ) { return $this->widgets[$row_identifier][$widget_id]; } throw new SwatException( 'The specified widget was not found with the ' . 'specified row identifier.' ); }
[ "public", "function", "getWidget", "(", "$", "row_identifier", ",", "$", "widget_id", "=", "null", ")", "{", "$", "this", "->", "getClonedWidget", "(", "$", "row_identifier", ")", ";", "if", "(", "$", "widget_id", "===", "null", "&&", "isset", "(", "$", ...
Gets a particular widget in this input cell @param integer $row_identifier the numeric row identifier of the widget. @param string $widget_id optional. The unique identifier of the widget. If no <i>$widget_id</i> is specified, the root widget of this cell is returned for the given <i>$row_identifier</i>. @return SwatWidget the requested widget object. @throws SwatException if the specified widget does not exist in this input cell.
[ "Gets", "a", "particular", "widget", "in", "this", "input", "cell" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatInputCell.php#L240-L257
train
silverorange/swat
Swat/SwatInputCell.php
SwatInputCell.unsetWidget
public function unsetWidget($replicator_id) { if (isset($this->widgets[$replicator_id])) { unset($this->widgets[$replicator_id]); } if (isset($this->clones[$replicator_id])) { unset($this->clones[$replicator_id]); } }
php
public function unsetWidget($replicator_id) { if (isset($this->widgets[$replicator_id])) { unset($this->widgets[$replicator_id]); } if (isset($this->clones[$replicator_id])) { unset($this->clones[$replicator_id]); } }
[ "public", "function", "unsetWidget", "(", "$", "replicator_id", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "widgets", "[", "$", "replicator_id", "]", ")", ")", "{", "unset", "(", "$", "this", "->", "widgets", "[", "$", "replicator_id", "]", ...
Unsets a cloned widget within this cell This is useful if you are deleting a row from an input row. @param integer replicator_id the replicator id of the cloned widget to unset. @see SwatTableViewInputRow::removeReplicatedRow()
[ "Unsets", "a", "cloned", "widget", "within", "this", "cell" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatInputCell.php#L272-L281
train
silverorange/swat
Swat/SwatInputCell.php
SwatInputCell.getHtmlHeadEntrySet
public function getHtmlHeadEntrySet() { $set = parent::getHtmlHeadEntrySet(); $set->addEntrySet($this->widget->getHtmlHeadEntrySet()); return $set; }
php
public function getHtmlHeadEntrySet() { $set = parent::getHtmlHeadEntrySet(); $set->addEntrySet($this->widget->getHtmlHeadEntrySet()); return $set; }
[ "public", "function", "getHtmlHeadEntrySet", "(", ")", "{", "$", "set", "=", "parent", "::", "getHtmlHeadEntrySet", "(", ")", ";", "$", "set", "->", "addEntrySet", "(", "$", "this", "->", "widget", "->", "getHtmlHeadEntrySet", "(", ")", ")", ";", "return",...
Gets the SwatHtmlHeadEntry objects needed by this input cell @return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects needed by this input cell. @see SwatUIObject::getHtmlHeadEntrySet()
[ "Gets", "the", "SwatHtmlHeadEntry", "objects", "needed", "by", "this", "input", "cell" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatInputCell.php#L294-L299
train
silverorange/swat
Swat/SwatInputCell.php
SwatInputCell.getAvailableHtmlHeadEntrySet
public function getAvailableHtmlHeadEntrySet() { $set = parent::getAvailableHtmlHeadEntrySet(); $set->addEntrySet($this->widget->getAvailableHtmlHeadEntrySet()); return $set; }
php
public function getAvailableHtmlHeadEntrySet() { $set = parent::getAvailableHtmlHeadEntrySet(); $set->addEntrySet($this->widget->getAvailableHtmlHeadEntrySet()); return $set; }
[ "public", "function", "getAvailableHtmlHeadEntrySet", "(", ")", "{", "$", "set", "=", "parent", "::", "getAvailableHtmlHeadEntrySet", "(", ")", ";", "$", "set", "->", "addEntrySet", "(", "$", "this", "->", "widget", "->", "getAvailableHtmlHeadEntrySet", "(", ")"...
Gets the SwatHtmlHeadEntry objects that may be needed by this input cell @return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects that may be needed by this input cell. @see SwatUIObject::getAvailableHtmlHeadEntrySet()
[ "Gets", "the", "SwatHtmlHeadEntry", "objects", "that", "may", "be", "needed", "by", "this", "input", "cell" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatInputCell.php#L312-L317
train
silverorange/swat
Swat/SwatInputCell.php
SwatInputCell.getInputRow
protected function getInputRow() { $view = $this->getFirstAncestor('SwatTableView'); if ($view === null) { return null; } $row = $view->getFirstRowByClass('SwatTableViewInputRow'); return $row; }
php
protected function getInputRow() { $view = $this->getFirstAncestor('SwatTableView'); if ($view === null) { return null; } $row = $view->getFirstRowByClass('SwatTableViewInputRow'); return $row; }
[ "protected", "function", "getInputRow", "(", ")", "{", "$", "view", "=", "$", "this", "->", "getFirstAncestor", "(", "'SwatTableView'", ")", ";", "if", "(", "$", "view", "===", "null", ")", "{", "return", "null", ";", "}", "$", "row", "=", "$", "view...
Gets the input row this cell belongs to If this input-cell is not yet added to a table-view, or if the parent table-view of this cell does not have an input-row, null is returned. @return SwatTableViewInputRow the input row this cell belongs to.
[ "Gets", "the", "input", "row", "this", "cell", "belongs", "to" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatInputCell.php#L516-L526
train
silverorange/swat
Swat/SwatInputCell.php
SwatInputCell.getClonedWidget
protected function getClonedWidget($replicator_id) { if (isset($this->clones[$replicator_id])) { return $this->clones[$replicator_id]; } if ($this->widget === null) { return null; } $row = $this->getInputRow(); if ($row === null) { throw new SwatException( 'Cannot clone widgets until cell is ' . 'added to a table-view and an input-row is added to the ' . 'table-view.' ); } $view = $this->getFirstAncestor('SwatTableView'); $view_id = $view === null ? null : $view->id; $suffix = $view_id === null ? '_' . $row->id . '_' . $replicator_id : '_' . $view_id . '_' . $row->id . '_' . $replicator_id; $new_widget = $this->widget->copy($suffix); $new_widget->parent = $this; if ($new_widget->id !== null) { // lookup array uses original ids $old_id = mb_substr($new_widget->id, 0, -mb_strlen($suffix)); $this->widgets[$replicator_id][$old_id] = $new_widget; } if ($new_widget instanceof SwatUIParent) { foreach ($new_widget->getDescendants() as $descendant) { if ($descendant->id !== null) { // lookup array uses original ids $old_id = mb_substr( $descendant->id, 0, -mb_strlen($suffix) ); $this->widgets[$replicator_id][$old_id] = $descendant; } } } $this->clones[$replicator_id] = $new_widget; return $new_widget; }
php
protected function getClonedWidget($replicator_id) { if (isset($this->clones[$replicator_id])) { return $this->clones[$replicator_id]; } if ($this->widget === null) { return null; } $row = $this->getInputRow(); if ($row === null) { throw new SwatException( 'Cannot clone widgets until cell is ' . 'added to a table-view and an input-row is added to the ' . 'table-view.' ); } $view = $this->getFirstAncestor('SwatTableView'); $view_id = $view === null ? null : $view->id; $suffix = $view_id === null ? '_' . $row->id . '_' . $replicator_id : '_' . $view_id . '_' . $row->id . '_' . $replicator_id; $new_widget = $this->widget->copy($suffix); $new_widget->parent = $this; if ($new_widget->id !== null) { // lookup array uses original ids $old_id = mb_substr($new_widget->id, 0, -mb_strlen($suffix)); $this->widgets[$replicator_id][$old_id] = $new_widget; } if ($new_widget instanceof SwatUIParent) { foreach ($new_widget->getDescendants() as $descendant) { if ($descendant->id !== null) { // lookup array uses original ids $old_id = mb_substr( $descendant->id, 0, -mb_strlen($suffix) ); $this->widgets[$replicator_id][$old_id] = $descendant; } } } $this->clones[$replicator_id] = $new_widget; return $new_widget; }
[ "protected", "function", "getClonedWidget", "(", "$", "replicator_id", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "clones", "[", "$", "replicator_id", "]", ")", ")", "{", "return", "$", "this", "->", "clones", "[", "$", "replicator_id", "]", ...
Gets a cloned widget given a unique identifier @param string $replicator_id the unique identifier of the new cloned widget. The actual cloned widget id is constructed from this identifier and from the input row that this input cell belongs to. @return SwatWidget the new cloned widget or the cloned widget retrieved from the {@link SwatInputCell::$clones} array. @throws SwatException if this input cell does not belong to a table-view with an input row.
[ "Gets", "a", "cloned", "widget", "given", "a", "unique", "identifier" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatInputCell.php#L546-L598
train
brainworxx/kreXX
src/Service/Misc/File.php
File.readSourcecode
public function readSourcecode($filePath, $highlight, $readFrom, $readTo) { $result = ''; // Read the file into our cache array. We may need to reed this file a // few times. $content = $this->getFileContentsArray($filePath); if ($readFrom < 0) { $readFrom = 0; } if (isset($content[$readFrom]) === false) { // We can not even start reading this file! // Return empty string. return ''; } if ($readTo < 0) { $readTo = 0; } if (isset($content[$readTo]) === false) { // We can not read this far, set it to the last line. $readTo = count($content) - 1; } for ($currentLineNo = $readFrom; $currentLineNo <= $readTo; ++$currentLineNo) { // Add it to the result. $realLineNo = $currentLineNo + 1; if ($currentLineNo === $highlight) { $result .= $this->pool->render->renderBacktraceSourceLine( 'highlight', $realLineNo, $this->pool->encodingService->encodeString($content[$currentLineNo], true) ); } else { $result .= $this->pool->render->renderBacktraceSourceLine( 'source', $realLineNo, $this->pool->encodingService->encodeString($content[$currentLineNo], true) ); } } return $result; }
php
public function readSourcecode($filePath, $highlight, $readFrom, $readTo) { $result = ''; // Read the file into our cache array. We may need to reed this file a // few times. $content = $this->getFileContentsArray($filePath); if ($readFrom < 0) { $readFrom = 0; } if (isset($content[$readFrom]) === false) { // We can not even start reading this file! // Return empty string. return ''; } if ($readTo < 0) { $readTo = 0; } if (isset($content[$readTo]) === false) { // We can not read this far, set it to the last line. $readTo = count($content) - 1; } for ($currentLineNo = $readFrom; $currentLineNo <= $readTo; ++$currentLineNo) { // Add it to the result. $realLineNo = $currentLineNo + 1; if ($currentLineNo === $highlight) { $result .= $this->pool->render->renderBacktraceSourceLine( 'highlight', $realLineNo, $this->pool->encodingService->encodeString($content[$currentLineNo], true) ); } else { $result .= $this->pool->render->renderBacktraceSourceLine( 'source', $realLineNo, $this->pool->encodingService->encodeString($content[$currentLineNo], true) ); } } return $result; }
[ "public", "function", "readSourcecode", "(", "$", "filePath", ",", "$", "highlight", ",", "$", "readFrom", ",", "$", "readTo", ")", "{", "$", "result", "=", "''", ";", "// Read the file into our cache array. We may need to reed this file a", "// few times.", "$", "c...
Reads sourcecode from files, for the backtrace. @param string $filePath Path to the file you want to read. @param int $highlight The line number you want to highlight @param int $readFrom The start line. @param int $readTo The end line. @return string The source code, HTML formatted.
[ "Reads", "sourcecode", "from", "files", "for", "the", "backtrace", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Misc/File.php#L97-L144
train
brainworxx/kreXX
src/Service/Misc/File.php
File.readFile
public function readFile($filePath, $readFrom = 0, $readTo = 0) { $result = ''; // Read the file into our cache array. $content = $this->getFileContentsArray($filePath); if ($readFrom < 0) { $readFrom = 0; } if ($readTo < 0) { $readTo = 0; } $countContent = count($content); if ($countContent === 0) { return $result; } // Do we have enough lines in there? if ($countContent <= $readTo) { $readTo = $countContent - 1; } for ($currentLineNo = $readFrom; $currentLineNo <= $readTo; ++$currentLineNo) { $result .= $content[$currentLineNo]; } return $result; }
php
public function readFile($filePath, $readFrom = 0, $readTo = 0) { $result = ''; // Read the file into our cache array. $content = $this->getFileContentsArray($filePath); if ($readFrom < 0) { $readFrom = 0; } if ($readTo < 0) { $readTo = 0; } $countContent = count($content); if ($countContent === 0) { return $result; } // Do we have enough lines in there? if ($countContent <= $readTo) { $readTo = $countContent - 1; } for ($currentLineNo = $readFrom; $currentLineNo <= $readTo; ++$currentLineNo) { $result .= $content[$currentLineNo]; } return $result; }
[ "public", "function", "readFile", "(", "$", "filePath", ",", "$", "readFrom", "=", "0", ",", "$", "readTo", "=", "0", ")", "{", "$", "result", "=", "''", ";", "// Read the file into our cache array.", "$", "content", "=", "$", "this", "->", "getFileContent...
Simply read a file into a string. @param string $filePath @param int $readFrom @param int $readTo @return string The content of the file, between the $from and $to.
[ "Simply", "read", "a", "file", "into", "a", "string", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Misc/File.php#L156-L187
train
brainworxx/kreXX
src/Service/Misc/File.php
File.getFileContentsArray
protected function getFileContentsArray($filePath) { $filePath = realpath($filePath); static $filecache = array(); if (isset($filecache[$filePath]) === true) { return $filecache[$filePath]; } // Using \SplFixedArray to save some memory, as it can get // quire huge, depending on your system. 4mb is nothing here. if ($this->fileIsReadable($filePath) === true) { return $filecache[$filePath] = \SplFixedArray::fromArray(file($filePath)); } // Not readable! return $filecache[$filePath] = new \SplFixedArray(0); }
php
protected function getFileContentsArray($filePath) { $filePath = realpath($filePath); static $filecache = array(); if (isset($filecache[$filePath]) === true) { return $filecache[$filePath]; } // Using \SplFixedArray to save some memory, as it can get // quire huge, depending on your system. 4mb is nothing here. if ($this->fileIsReadable($filePath) === true) { return $filecache[$filePath] = \SplFixedArray::fromArray(file($filePath)); } // Not readable! return $filecache[$filePath] = new \SplFixedArray(0); }
[ "protected", "function", "getFileContentsArray", "(", "$", "filePath", ")", "{", "$", "filePath", "=", "realpath", "(", "$", "filePath", ")", ";", "static", "$", "filecache", "=", "array", "(", ")", ";", "if", "(", "isset", "(", "$", "filecache", "[", ...
Reads a file into an array and uses some caching. @param string $filePath The path to the file we want to read. @return \SplFixedArray The file in a \SplFixedArray.
[ "Reads", "a", "file", "into", "an", "array", "and", "uses", "some", "caching", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Misc/File.php#L198-L215
train
brainworxx/kreXX
src/Service/Misc/File.php
File.getFileContents
public function getFileContents($filePath, $showError = true) { $filePath = realpath($filePath); if ($this->fileIsReadable($filePath) === false) { if ($showError === true) { // This file was not readable! We need to tell the user! $this->pool->messages->addMessage('fileserviceAccess', array($this->filterFilePath($filePath))); } // Return empty string. return ''; } // Is it readable and does it have any content? $size = filesize($filePath); if ($size > 0) { $file = fopen($filePath, 'r'); $result = fread($file, $size); fclose($file); return $result; } // Empty file returns an empty string. return ''; }
php
public function getFileContents($filePath, $showError = true) { $filePath = realpath($filePath); if ($this->fileIsReadable($filePath) === false) { if ($showError === true) { // This file was not readable! We need to tell the user! $this->pool->messages->addMessage('fileserviceAccess', array($this->filterFilePath($filePath))); } // Return empty string. return ''; } // Is it readable and does it have any content? $size = filesize($filePath); if ($size > 0) { $file = fopen($filePath, 'r'); $result = fread($file, $size); fclose($file); return $result; } // Empty file returns an empty string. return ''; }
[ "public", "function", "getFileContents", "(", "$", "filePath", ",", "$", "showError", "=", "true", ")", "{", "$", "filePath", "=", "realpath", "(", "$", "filePath", ")", ";", "if", "(", "$", "this", "->", "fileIsReadable", "(", "$", "filePath", ")", "=...
Reads the content of a file. @param string $filePath The path to the file. @param boolean $showError Do we need to display na error message? @return string The content of the file, if readable.
[ "Reads", "the", "content", "of", "a", "file", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Misc/File.php#L228-L252
train
brainworxx/kreXX
src/Service/Misc/File.php
File.putFileContents
public function putFileContents($filePath, $string) { if ($this->fileIsReadable($filePath) === true) { // Existing file. Most likely a html log file. file_put_contents($filePath, $string, FILE_APPEND); return; } // New file. We tell the caching, that we have read access here. file_put_contents($filePath, $string, FILE_APPEND); static::$isReadableCache[$filePath] = true; }
php
public function putFileContents($filePath, $string) { if ($this->fileIsReadable($filePath) === true) { // Existing file. Most likely a html log file. file_put_contents($filePath, $string, FILE_APPEND); return; } // New file. We tell the caching, that we have read access here. file_put_contents($filePath, $string, FILE_APPEND); static::$isReadableCache[$filePath] = true; }
[ "public", "function", "putFileContents", "(", "$", "filePath", ",", "$", "string", ")", "{", "if", "(", "$", "this", "->", "fileIsReadable", "(", "$", "filePath", ")", "===", "true", ")", "{", "// Existing file. Most likely a html log file.", "file_put_contents", ...
Write the content of a string to a file. When the file already exists, we will append the content. Caches weather we are allowed to write, to reduce the overhead. @param string $filePath Path and filename. @param string $string The string we want to write.
[ "Write", "the", "content", "of", "a", "string", "to", "a", "file", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Misc/File.php#L265-L276
train
brainworxx/kreXX
src/Service/Misc/File.php
File.deleteFile
public function deleteFile($filePath) { $filePath = realpath($filePath); // Check if it is an actual file and if it is writable. if (is_file($filePath) === true) { set_error_handler( function () { /* do nothing */ } ); // Make sure it is unlinkable. chmod($filePath, 0777); if (unlink($filePath) === true) { restore_error_handler(); return; } // We have a permission problem here! $this->pool->messages->addMessage('fileserviceDelete', array($this->filterFilePath($filePath))); restore_error_handler(); } }
php
public function deleteFile($filePath) { $filePath = realpath($filePath); // Check if it is an actual file and if it is writable. if (is_file($filePath) === true) { set_error_handler( function () { /* do nothing */ } ); // Make sure it is unlinkable. chmod($filePath, 0777); if (unlink($filePath) === true) { restore_error_handler(); return; } // We have a permission problem here! $this->pool->messages->addMessage('fileserviceDelete', array($this->filterFilePath($filePath))); restore_error_handler(); } }
[ "public", "function", "deleteFile", "(", "$", "filePath", ")", "{", "$", "filePath", "=", "realpath", "(", "$", "filePath", ")", ";", "// Check if it is an actual file and if it is writable.", "if", "(", "is_file", "(", "$", "filePath", ")", "===", "true", ")", ...
Tries to delete a file. @param string $filePath
[ "Tries", "to", "delete", "a", "file", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Misc/File.php#L283-L305
train
brainworxx/kreXX
src/Service/Misc/File.php
File.fileIsReadable
public function fileIsReadable($filePath) { $filePath = realpath($filePath); // Return the cache, if we have any. if (isset(static::$isReadableCache[$filePath]) === true) { return static::$isReadableCache[$filePath]; } // Set the cache and return it. return static::$isReadableCache[$filePath] = is_readable($filePath) && is_file($filePath); }
php
public function fileIsReadable($filePath) { $filePath = realpath($filePath); // Return the cache, if we have any. if (isset(static::$isReadableCache[$filePath]) === true) { return static::$isReadableCache[$filePath]; } // Set the cache and return it. return static::$isReadableCache[$filePath] = is_readable($filePath) && is_file($filePath); }
[ "public", "function", "fileIsReadable", "(", "$", "filePath", ")", "{", "$", "filePath", "=", "realpath", "(", "$", "filePath", ")", ";", "// Return the cache, if we have any.", "if", "(", "isset", "(", "static", "::", "$", "isReadableCache", "[", "$", "filePa...
Checks if a file exists and is readable, with some caching. @param string $filePath The path to the file we are checking. @return bool If the file is readable, or not.
[ "Checks", "if", "a", "file", "exists", "and", "is", "readable", "with", "some", "caching", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Misc/File.php#L346-L357
train
silverorange/swat
Swat/SwatEmailEntry.php
SwatEmailEntry.process
public function process() { parent::process(); if ($this->value === null) { return; } if ($this->value == '') { $this->value = null; return; } if (!$this->validateEmailAddress()) { $this->addMessage($this->getValidationMessage('email')); } }
php
public function process() { parent::process(); if ($this->value === null) { return; } if ($this->value == '') { $this->value = null; return; } if (!$this->validateEmailAddress()) { $this->addMessage($this->getValidationMessage('email')); } }
[ "public", "function", "process", "(", ")", "{", "parent", "::", "process", "(", ")", ";", "if", "(", "$", "this", "->", "value", "===", "null", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "value", "==", "''", ")", "{", "$", "thi...
Processes this email entry Ensures this email address is formatted correctly. If the email address is not formatted correctly, adds an error message to this entry widget.
[ "Processes", "this", "email", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatEmailEntry.php#L23-L39
train
silverorange/swat
Swat/SwatEmailEntry.php
SwatEmailEntry.getValidationMessage
protected function getValidationMessage($id) { switch ($id) { case 'email': $text = Swat::_( 'The email address you have entered is not ' . 'properly formatted.' ); $message = new SwatMessage($text, 'error'); break; default: $message = parent::getValidationMessage($id); break; } return $message; }
php
protected function getValidationMessage($id) { switch ($id) { case 'email': $text = Swat::_( 'The email address you have entered is not ' . 'properly formatted.' ); $message = new SwatMessage($text, 'error'); break; default: $message = parent::getValidationMessage($id); break; } return $message; }
[ "protected", "function", "getValidationMessage", "(", "$", "id", ")", "{", "switch", "(", "$", "id", ")", "{", "case", "'email'", ":", "$", "text", "=", "Swat", "::", "_", "(", "'The email address you have entered is not '", ".", "'properly formatted.'", ")", ...
Gets a validation message for this email entry @see SwatEntry::getValidationMessage() @param string $id the string identifier of the validation message. @return SwatMessage the validation message.
[ "Gets", "a", "validation", "message", "for", "this", "email", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatEmailEntry.php#L66-L84
train
brainworxx/kreXX
src/Analyse/Caller/AbstractCaller.php
AbstractCaller.getType
protected function getType($headline, $varname, $data) { if (empty($headline) === true) { if (is_object($data) === true) { $type = get_class($data); } else { $type = gettype($data); } return 'Analysis of ' . $varname . ', ' . $type; } // We already have a headline and will not touch it. return $headline; }
php
protected function getType($headline, $varname, $data) { if (empty($headline) === true) { if (is_object($data) === true) { $type = get_class($data); } else { $type = gettype($data); } return 'Analysis of ' . $varname . ', ' . $type; } // We already have a headline and will not touch it. return $headline; }
[ "protected", "function", "getType", "(", "$", "headline", ",", "$", "varname", ",", "$", "data", ")", "{", "if", "(", "empty", "(", "$", "headline", ")", "===", "true", ")", "{", "if", "(", "is_object", "(", "$", "data", ")", "===", "true", ")", ...
Get the analysis type for the metadata and the page title. @param string $headline The headline from the call. We will use this one, if not empty. @param string $varname The name of the variable that we were able to determine. @param mixed $data The variable tht we are analysing. @return string The analysis type.
[ "Get", "the", "analysis", "type", "for", "the", "metadata", "and", "the", "page", "title", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Caller/AbstractCaller.php#L146-L159
train
silverorange/swat
Swat/SwatNoteBookPage.php
SwatNoteBookPage.display
public function display() { if (!$this->visible) { return; } $div_tag = new SwatHtmlTag('div'); $div_tag->id = $this->id; $div_tag->class = $this->getCSSClassString(); $div_tag->open(); parent::display(); $div_tag->close(); }
php
public function display() { if (!$this->visible) { return; } $div_tag = new SwatHtmlTag('div'); $div_tag->id = $this->id; $div_tag->class = $this->getCSSClassString(); $div_tag->open(); parent::display(); $div_tag->close(); }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "$", "div_tag", "=", "new", "SwatHtmlTag", "(", "'div'", ")", ";", "$", "div_tag", "->", "id", "=", "$", "this", "->", "id...
Displays this notebook page Displays this notebook page as well as recursively displaying all child- widgets of this page.
[ "Displays", "this", "notebook", "page" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatNoteBookPage.php#L55-L67
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.init
public function init() { parent::init(); foreach ($this->columns as $column) { $column->init(); // index the column by id if it is not already indexed if (!array_key_exists($column->id, $this->columns_by_id)) { $this->columns_by_id[$column->id] = $column; } } foreach ($this->extra_rows as $row) { $row->init(); // index the row by id if it is not already indexed if (!array_key_exists($row->id, $this->rows_by_id)) { $this->rows_by_id[$row->id] = $row; } } foreach ($this->groups as $group) { $group->init(); // index the group by id if it is not already indexed if (!array_key_exists($group->id, $this->groups_by_id)) { $this->groups_by_id[$group->id] = $group; } } foreach ($this->spanning_columns as $column) { $column->init(); // index the row column by id if it is not already indexed if (!array_key_exists($column->id, $this->spanning_columns_by_id)) { $this->spanning_columns_by_id[$column->id] = $column; } } }
php
public function init() { parent::init(); foreach ($this->columns as $column) { $column->init(); // index the column by id if it is not already indexed if (!array_key_exists($column->id, $this->columns_by_id)) { $this->columns_by_id[$column->id] = $column; } } foreach ($this->extra_rows as $row) { $row->init(); // index the row by id if it is not already indexed if (!array_key_exists($row->id, $this->rows_by_id)) { $this->rows_by_id[$row->id] = $row; } } foreach ($this->groups as $group) { $group->init(); // index the group by id if it is not already indexed if (!array_key_exists($group->id, $this->groups_by_id)) { $this->groups_by_id[$group->id] = $group; } } foreach ($this->spanning_columns as $column) { $column->init(); // index the row column by id if it is not already indexed if (!array_key_exists($column->id, $this->spanning_columns_by_id)) { $this->spanning_columns_by_id[$column->id] = $column; } } }
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "foreach", "(", "$", "this", "->", "columns", "as", "$", "column", ")", "{", "$", "column", "->", "init", "(", ")", ";", "// index the column by id if it is not already ind...
Initializes this table-view This initializes all columns, extra rows and groupsin this table-view. @see SwatWidget::init()
[ "Initializes", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L222-L257
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.display
public function display() { if (!$this->visible) { return; } if ($this->model === null) { return; } parent::display(); $show_no_records = true; $row_count = count($this->model); foreach ($this->extra_rows as $row) { if ($row->getVisibleByCount($row_count)) { $show_no_records = false; break; } } if ($row_count === 0 && $show_no_records) { if ($this->no_records_message != '') { $div = new SwatHtmlTag('div'); $div->class = 'swat-none'; $div->setContent( $this->no_records_message, $this->no_records_message_type ); $div->display(); } return; } $table_tag = new SwatHtmlTag('table'); $table_tag->id = $this->id; $table_tag->class = $this->getCSSClassString(); $table_tag->cellspacing = '0'; $table_tag->open(); if ($this->hasHeader()) { $this->displayHeader(); } if ($this->use_invalid_tfoot_ordering) { $this->displayBody(); $this->displayFooter(); } else { $this->displayFooter(); $this->displayBody(); } $table_tag->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
php
public function display() { if (!$this->visible) { return; } if ($this->model === null) { return; } parent::display(); $show_no_records = true; $row_count = count($this->model); foreach ($this->extra_rows as $row) { if ($row->getVisibleByCount($row_count)) { $show_no_records = false; break; } } if ($row_count === 0 && $show_no_records) { if ($this->no_records_message != '') { $div = new SwatHtmlTag('div'); $div->class = 'swat-none'; $div->setContent( $this->no_records_message, $this->no_records_message_type ); $div->display(); } return; } $table_tag = new SwatHtmlTag('table'); $table_tag->id = $this->id; $table_tag->class = $this->getCSSClassString(); $table_tag->cellspacing = '0'; $table_tag->open(); if ($this->hasHeader()) { $this->displayHeader(); } if ($this->use_invalid_tfoot_ordering) { $this->displayBody(); $this->displayFooter(); } else { $this->displayFooter(); $this->displayBody(); } $table_tag->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "model", "===", "null", ")", "{", "return", ";", "}", "parent", "::", "display", "(", ")", ...
Displays this table-view The table view is displayed as an XHTML table.
[ "Displays", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L267-L325
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.process
public function process() { parent::process(); foreach ($this->columns as $column) { $column->process(); } foreach ($this->spanning_columns as $column) { $column->process(); } foreach ($this->extra_rows as $row) { $row->process(); } // this is part of the old selection API if ($this->hasColumn('checkbox')) { $items = $this->getColumn('checkbox'); $this->checked_items = $items->getItems(); } }
php
public function process() { parent::process(); foreach ($this->columns as $column) { $column->process(); } foreach ($this->spanning_columns as $column) { $column->process(); } foreach ($this->extra_rows as $row) { $row->process(); } // this is part of the old selection API if ($this->hasColumn('checkbox')) { $items = $this->getColumn('checkbox'); $this->checked_items = $items->getItems(); } }
[ "public", "function", "process", "(", ")", "{", "parent", "::", "process", "(", ")", ";", "foreach", "(", "$", "this", "->", "columns", "as", "$", "column", ")", "{", "$", "column", "->", "process", "(", ")", ";", "}", "foreach", "(", "$", "this", ...
Processes this table-view
[ "Processes", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L333-L354
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.getMessages
public function getMessages() { $messages = parent::getMessages(); if ($this->model !== null) { foreach ($this->model as $row) { foreach ($this->columns as $column) { $messages = array_merge( $messages, $column->getMessages($row) ); } foreach ($this->spanning_columns as $column) { $messages = array_merge( $messages, $column->getMessages($row) ); } } foreach ($this->extra_rows as $row) { if ($row instanceof SwatTableViewWidgetRow) { $messages = array_merge($messages, $row->getMessages()); } } } return $messages; }
php
public function getMessages() { $messages = parent::getMessages(); if ($this->model !== null) { foreach ($this->model as $row) { foreach ($this->columns as $column) { $messages = array_merge( $messages, $column->getMessages($row) ); } foreach ($this->spanning_columns as $column) { $messages = array_merge( $messages, $column->getMessages($row) ); } } foreach ($this->extra_rows as $row) { if ($row instanceof SwatTableViewWidgetRow) { $messages = array_merge($messages, $row->getMessages()); } } } return $messages; }
[ "public", "function", "getMessages", "(", ")", "{", "$", "messages", "=", "parent", "::", "getMessages", "(", ")", ";", "if", "(", "$", "this", "->", "model", "!==", "null", ")", "{", "foreach", "(", "$", "this", "->", "model", "as", "$", "row", ")...
Gathers all messages from this table-view @return array an array of {@link SwatMessage} objects.
[ "Gathers", "all", "messages", "from", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L409-L438
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.hasMessage
public function hasMessage() { $has_message = parent::hasMessage(); if (!$has_message && $this->model !== null) { foreach ($this->model as $row) { foreach ($this->columns as $column) { if ($column->hasMessage($row)) { $has_message = true; break 2; } } foreach ($this->spanning_columns as $column) { if ($column->hasMessage($row)) { $has_message = true; break 2; } } } } if (!$has_message) { foreach ($this->extra_rows as $row) { if ($row->hasMessage()) { $has_message = true; break; } } } return $has_message; }
php
public function hasMessage() { $has_message = parent::hasMessage(); if (!$has_message && $this->model !== null) { foreach ($this->model as $row) { foreach ($this->columns as $column) { if ($column->hasMessage($row)) { $has_message = true; break 2; } } foreach ($this->spanning_columns as $column) { if ($column->hasMessage($row)) { $has_message = true; break 2; } } } } if (!$has_message) { foreach ($this->extra_rows as $row) { if ($row->hasMessage()) { $has_message = true; break; } } } return $has_message; }
[ "public", "function", "hasMessage", "(", ")", "{", "$", "has_message", "=", "parent", "::", "hasMessage", "(", ")", ";", "if", "(", "!", "$", "has_message", "&&", "$", "this", "->", "model", "!==", "null", ")", "{", "foreach", "(", "$", "this", "->",...
Gets whether or not this table-view has any messages @return boolean true if this table-view has one or more messages and false if it does not.
[ "Gets", "whether", "or", "not", "this", "table", "-", "view", "has", "any", "messages" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L449-L481
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.getXhtmlColspan
public function getXhtmlColspan() { $colspan = 0; // Add all colspans of visible columns to get table colspan. foreach ($this->getVisibleColumns() as $column) { $colspan += $column->getXhtmlColspan(); } // Check each spanning column. If it has more colspan than the colspan // defined by the columns, set the table colspan to the spanning column // colspan. foreach ($this->getVisibleSpanningColumns() as $column) { $spanning_colspan = $column->getXhtmlColspan(); if ($spanning_colspan > $colspan) { $colspan = $spanning_colspan; } } return $colspan; }
php
public function getXhtmlColspan() { $colspan = 0; // Add all colspans of visible columns to get table colspan. foreach ($this->getVisibleColumns() as $column) { $colspan += $column->getXhtmlColspan(); } // Check each spanning column. If it has more colspan than the colspan // defined by the columns, set the table colspan to the spanning column // colspan. foreach ($this->getVisibleSpanningColumns() as $column) { $spanning_colspan = $column->getXhtmlColspan(); if ($spanning_colspan > $colspan) { $colspan = $spanning_colspan; } } return $colspan; }
[ "public", "function", "getXhtmlColspan", "(", ")", "{", "$", "colspan", "=", "0", ";", "// Add all colspans of visible columns to get table colspan.", "foreach", "(", "$", "this", "->", "getVisibleColumns", "(", ")", "as", "$", "column", ")", "{", "$", "colspan", ...
Gets how many XHTML table columns the visible column objects of this table-view object span on display @return integer the number of XHTML table columns the visible column objects of this table-view object span on display.
[ "Gets", "how", "many", "XHTML", "table", "columns", "the", "visible", "column", "objects", "of", "this", "table", "-", "view", "object", "span", "on", "display" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L493-L513
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.getHtmlHeadEntrySet
public function getHtmlHeadEntrySet() { $set = parent::getHtmlHeadEntrySet(); foreach ($this->columns as $column) { $set->addEntrySet($column->getHtmlHeadEntrySet()); } foreach ($this->spanning_columns as $column) { $set->addEntrySet($column->getHtmlHeadEntrySet()); } foreach ($this->extra_rows as $row) { $set->addEntrySet($row->getHtmlHeadEntrySet()); } foreach ($this->groups as $group) { $set->addEntrySet($group->getHtmlHeadEntrySet()); } return $set; }
php
public function getHtmlHeadEntrySet() { $set = parent::getHtmlHeadEntrySet(); foreach ($this->columns as $column) { $set->addEntrySet($column->getHtmlHeadEntrySet()); } foreach ($this->spanning_columns as $column) { $set->addEntrySet($column->getHtmlHeadEntrySet()); } foreach ($this->extra_rows as $row) { $set->addEntrySet($row->getHtmlHeadEntrySet()); } foreach ($this->groups as $group) { $set->addEntrySet($group->getHtmlHeadEntrySet()); } return $set; }
[ "public", "function", "getHtmlHeadEntrySet", "(", ")", "{", "$", "set", "=", "parent", "::", "getHtmlHeadEntrySet", "(", ")", ";", "foreach", "(", "$", "this", "->", "columns", "as", "$", "column", ")", "{", "$", "set", "->", "addEntrySet", "(", "$", "...
Gets the SwatHtmlHeadEntry objects needed by this table @return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects needed by this table-view. @see SwatUIObject::getHtmlHeadEntrySet()
[ "Gets", "the", "SwatHtmlHeadEntry", "objects", "needed", "by", "this", "table" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L526-L547
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.hasHeader
protected function hasHeader() { $has_header = false; foreach ($this->columns as $column) { if ($column->hasHeader()) { $has_header = true; break; } } return $has_header; }
php
protected function hasHeader() { $has_header = false; foreach ($this->columns as $column) { if ($column->hasHeader()) { $has_header = true; break; } } return $has_header; }
[ "protected", "function", "hasHeader", "(", ")", "{", "$", "has_header", "=", "false", ";", "foreach", "(", "$", "this", "->", "columns", "as", "$", "column", ")", "{", "if", "(", "$", "column", "->", "hasHeader", "(", ")", ")", "{", "$", "has_header"...
Whether this table has a header to display Each column is asked whether is has a header to display.
[ "Whether", "this", "table", "has", "a", "header", "to", "display" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L873-L885
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.displayBody
protected function displayBody() { $count = 0; // this uses read-ahead iteration $this->model->rewind(); $row = $this->model->valid() ? $this->model->current() : null; $this->model->next(); $next_row = $this->model->valid() ? $this->model->current() : null; if (count($this->model) > 0) { echo '<tbody>'; while ($row !== null) { $count++; $this->displayRow($row, $next_row, $count); $row = $next_row; $this->model->next(); $next_row = $this->model->valid() ? $this->model->current() : null; } echo '</tbody>'; } else { // to validate in the case where the form has a tfoot but no rows echo '<tbody class="swat-hidden"><tr><td></td></tr></tbody>'; } }
php
protected function displayBody() { $count = 0; // this uses read-ahead iteration $this->model->rewind(); $row = $this->model->valid() ? $this->model->current() : null; $this->model->next(); $next_row = $this->model->valid() ? $this->model->current() : null; if (count($this->model) > 0) { echo '<tbody>'; while ($row !== null) { $count++; $this->displayRow($row, $next_row, $count); $row = $next_row; $this->model->next(); $next_row = $this->model->valid() ? $this->model->current() : null; } echo '</tbody>'; } else { // to validate in the case where the form has a tfoot but no rows echo '<tbody class="swat-hidden"><tr><td></td></tr></tbody>'; } }
[ "protected", "function", "displayBody", "(", ")", "{", "$", "count", "=", "0", ";", "// this uses read-ahead iteration", "$", "this", "->", "model", "->", "rewind", "(", ")", ";", "$", "row", "=", "$", "this", "->", "model", "->", "valid", "(", ")", "?...
Displays the contents of this view The contents reflect the data stored in the model of this table-view. Things like row highlighting are done here. Table rows are displayed inside a <tbody> XHTML tag.
[ "Displays", "the", "contents", "of", "this", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L920-L952
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.displayRow
protected function displayRow($row, $next_row, $count) { $this->displayRowGroupHeaders($row, $next_row, $count); $this->displayRowColumns($row, $next_row, $count); $this->displayRowSpanningColumns($row, $next_row, $count); $this->displayRowMessages($row); $this->displayRowGroupFooters($row, $next_row, $count); }
php
protected function displayRow($row, $next_row, $count) { $this->displayRowGroupHeaders($row, $next_row, $count); $this->displayRowColumns($row, $next_row, $count); $this->displayRowSpanningColumns($row, $next_row, $count); $this->displayRowMessages($row); $this->displayRowGroupFooters($row, $next_row, $count); }
[ "protected", "function", "displayRow", "(", "$", "row", ",", "$", "next_row", ",", "$", "count", ")", "{", "$", "this", "->", "displayRowGroupHeaders", "(", "$", "row", ",", "$", "next_row", ",", "$", "count", ")", ";", "$", "this", "->", "displayRowCo...
Displays a single row The contents reflect the data stored in the model of this table-view. Things like row highlighting are done here. @param mixed $row the row to display. @param mixed $next_row the next row that will be displayed. If there is no next row, this is null. @param integer $count the ordinal position of the current row. Starts at one.
[ "Displays", "a", "single", "row" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L969-L976
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.displayRowColumns
protected function displayRowColumns($row, $next_row, $count) { // Make sure we should display a row for the current data. If there // are no visible columns for the row data, just skip displaying the // entire row. $should_show_row = false; foreach ($this->getVisibleColumns() as $column) { if ($column->hasVisibleRenderer($row)) { $should_show_row = true; break; } } // Display a row of data. if ($should_show_row) { $tr_tag = new SwatHtmlTag('tr'); $tr_tag->class = $this->getRowClassString($row, $count); foreach ($this->columns as $column) { $tr_tag->addAttributes($column->getTrAttributes($row)); } if ($this->rowHasMessage($row)) { $tr_tag->class .= ' swat-error'; } $tr_tag->open(); foreach ($this->columns as $column) { $column->display($row); } $tr_tag->close(); } }
php
protected function displayRowColumns($row, $next_row, $count) { // Make sure we should display a row for the current data. If there // are no visible columns for the row data, just skip displaying the // entire row. $should_show_row = false; foreach ($this->getVisibleColumns() as $column) { if ($column->hasVisibleRenderer($row)) { $should_show_row = true; break; } } // Display a row of data. if ($should_show_row) { $tr_tag = new SwatHtmlTag('tr'); $tr_tag->class = $this->getRowClassString($row, $count); foreach ($this->columns as $column) { $tr_tag->addAttributes($column->getTrAttributes($row)); } if ($this->rowHasMessage($row)) { $tr_tag->class .= ' swat-error'; } $tr_tag->open(); foreach ($this->columns as $column) { $column->display($row); } $tr_tag->close(); } }
[ "protected", "function", "displayRowColumns", "(", "$", "row", ",", "$", "next_row", ",", "$", "count", ")", "{", "// Make sure we should display a row for the current data. If there", "// are no visible columns for the row data, just skip displaying the", "// entire row.", "$", ...
Displays the columns for a row @param mixed $row the row to display. @param mixed $next_row the next row that will be displayed. If there is no next row, this is null. @param integer $count the ordinal position of the current row. Starts at one.
[ "Displays", "the", "columns", "for", "a", "row" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1028-L1062
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.displayRowSpanningColumns
protected function displayRowSpanningColumns($row, $next_row, $count) { $tr_tag = new SwatHtmlTag('tr'); $tr_tag->class = $this->getRowClassString($row, $count); if ($this->rowHasMessage($row)) { $tr_tag->class = $tr_tag->class . ' swat-error'; } $tr_tag->class .= ' swat-table-view-spanning-column'; foreach ($this->spanning_columns as $column) { if ($column->visible && $column->hasVisibleRenderer($row)) { $tr_tag->open(); $column->display($row); $tr_tag->close(); } } }
php
protected function displayRowSpanningColumns($row, $next_row, $count) { $tr_tag = new SwatHtmlTag('tr'); $tr_tag->class = $this->getRowClassString($row, $count); if ($this->rowHasMessage($row)) { $tr_tag->class = $tr_tag->class . ' swat-error'; } $tr_tag->class .= ' swat-table-view-spanning-column'; foreach ($this->spanning_columns as $column) { if ($column->visible && $column->hasVisibleRenderer($row)) { $tr_tag->open(); $column->display($row); $tr_tag->close(); } } }
[ "protected", "function", "displayRowSpanningColumns", "(", "$", "row", ",", "$", "next_row", ",", "$", "count", ")", "{", "$", "tr_tag", "=", "new", "SwatHtmlTag", "(", "'tr'", ")", ";", "$", "tr_tag", "->", "class", "=", "$", "this", "->", "getRowClassS...
Displays row spanning columns @param mixed $row the row to display. @param mixed $next_row the next row that will be displayed. If there is no next row, this is null. @param integer $count the ordinal position of the current row. Starts at one.
[ "Displays", "row", "spanning", "columns" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1076-L1094
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.displayFooter
protected function displayFooter() { ob_start(); foreach ($this->extra_rows as $row) { $row->display(); } $footer_content = ob_get_clean(); if ($footer_content != '') { $tfoot_tag = new SwatHtmlTag('tfoot'); if ($this->use_invalid_tfoot_ordering) { $tfoot_tag->class = 'swat-table-view-invalid-tfoot-ordering'; } $tfoot_tag->setContent($footer_content, 'text/xml'); $tfoot_tag->display(); } }
php
protected function displayFooter() { ob_start(); foreach ($this->extra_rows as $row) { $row->display(); } $footer_content = ob_get_clean(); if ($footer_content != '') { $tfoot_tag = new SwatHtmlTag('tfoot'); if ($this->use_invalid_tfoot_ordering) { $tfoot_tag->class = 'swat-table-view-invalid-tfoot-ordering'; } $tfoot_tag->setContent($footer_content, 'text/xml'); $tfoot_tag->display(); } }
[ "protected", "function", "displayFooter", "(", ")", "{", "ob_start", "(", ")", ";", "foreach", "(", "$", "this", "->", "extra_rows", "as", "$", "row", ")", "{", "$", "row", "->", "display", "(", ")", ";", "}", "$", "footer_content", "=", "ob_get_clean"...
Displays any footer content for this table-view Rows in the footer are outputted inside a <tfoot> HTML tag.
[ "Displays", "any", "footer", "content", "for", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1155-L1174
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.rowHasMessage
protected function rowHasMessage($row) { $has_message = false; foreach ($this->columns as $column) { if ($column->hasMessage($row)) { $has_message = true; break; } } if (!$has_message) { foreach ($this->spanning_columns as $column) { if ($column->hasMessage($row)) { $has_message = true; break; } } } return $has_message; }
php
protected function rowHasMessage($row) { $has_message = false; foreach ($this->columns as $column) { if ($column->hasMessage($row)) { $has_message = true; break; } } if (!$has_message) { foreach ($this->spanning_columns as $column) { if ($column->hasMessage($row)) { $has_message = true; break; } } } return $has_message; }
[ "protected", "function", "rowHasMessage", "(", "$", "row", ")", "{", "$", "has_message", "=", "false", ";", "foreach", "(", "$", "this", "->", "columns", "as", "$", "column", ")", "{", "if", "(", "$", "column", "->", "hasMessage", "(", "$", "row", ")...
Whether any of the columns in the row has a message @param mixed $row the data object to use to check the column for messages. @return boolean true if any of the columns in the row has a message, otherwise false.
[ "Whether", "any", "of", "the", "columns", "in", "the", "row", "has", "a", "message" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1188-L1209
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.getRowClasses
protected function getRowClasses($row, $count) { $classes = array(); if ($count % 2 === 1) { $classes[] = 'odd'; } if ($count === 1) { $classes[] = 'first'; } if ($count === count($this->model)) { $classes[] = 'last'; } return $classes; }
php
protected function getRowClasses($row, $count) { $classes = array(); if ($count % 2 === 1) { $classes[] = 'odd'; } if ($count === 1) { $classes[] = 'first'; } if ($count === count($this->model)) { $classes[] = 'last'; } return $classes; }
[ "protected", "function", "getRowClasses", "(", "$", "row", ",", "$", "count", ")", "{", "$", "classes", "=", "array", "(", ")", ";", "if", "(", "$", "count", "%", "2", "===", "1", ")", "{", "$", "classes", "[", "]", "=", "'odd'", ";", "}", "if"...
Gets CSS classes for the XHTML tr tag @param mixed $row a data object containing the data to be displayed in this row. @param integer $count the ordinal position of this row in the table. @return array CSS class names.
[ "Gets", "CSS", "classes", "for", "the", "XHTML", "tr", "tag" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1239-L1256
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.getRowClassString
protected function getRowClassString($row, $count) { $class_string = null; $classes = $this->getRowClasses($row, $count); if (count($classes) > 0) { $class_string = implode(' ', $classes); } return $class_string; }
php
protected function getRowClassString($row, $count) { $class_string = null; $classes = $this->getRowClasses($row, $count); if (count($classes) > 0) { $class_string = implode(' ', $classes); } return $class_string; }
[ "protected", "function", "getRowClassString", "(", "$", "row", ",", "$", "count", ")", "{", "$", "class_string", "=", "null", ";", "$", "classes", "=", "$", "this", "->", "getRowClasses", "(", "$", "row", ",", "$", "count", ")", ";", "if", "(", "coun...
Gets CSS class string for the XHTML tr tag @param mixed $row a data object containing the data to be displayed in this row. @param integer $count the ordinal position of this row in the table. @return string CSS class string.
[ "Gets", "CSS", "class", "string", "for", "the", "XHTML", "tr", "tag" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1270-L1281
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.insertColumnBefore
public function insertColumnBefore( SwatTableViewColumn $column, SwatTableViewColumn $reference_column ) { $this->insertColumn($column, $reference_column, false); }
php
public function insertColumnBefore( SwatTableViewColumn $column, SwatTableViewColumn $reference_column ) { $this->insertColumn($column, $reference_column, false); }
[ "public", "function", "insertColumnBefore", "(", "SwatTableViewColumn", "$", "column", ",", "SwatTableViewColumn", "$", "reference_column", ")", "{", "$", "this", "->", "insertColumn", "(", "$", "column", ",", "$", "reference_column", ",", "false", ")", ";", "}"...
Inserts a column before an existing column in this table-view @param SwatTableViewColumn $column the column to insert. @param SwatTableViewColumn $reference_column the column before which the column will be inserted. @throws SwatWidgetNotFoundException if the reference column does not exist in this table-view. @throws SwatDuplicateIdException if the column has the same id as a column already in this table-view.
[ "Inserts", "a", "column", "before", "an", "existing", "column", "in", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1388-L1393
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.insertColumnAfter
public function insertColumnAfter( SwatTableViewColumn $column, SwatTableViewColumn $reference_column ) { $this->insertColumn($column, $reference_column, true); }
php
public function insertColumnAfter( SwatTableViewColumn $column, SwatTableViewColumn $reference_column ) { $this->insertColumn($column, $reference_column, true); }
[ "public", "function", "insertColumnAfter", "(", "SwatTableViewColumn", "$", "column", ",", "SwatTableViewColumn", "$", "reference_column", ")", "{", "$", "this", "->", "insertColumn", "(", "$", "column", ",", "$", "reference_column", ",", "true", ")", ";", "}" ]
Inserts a column after an existing column in this table-view @param SwatTableViewColumn $column the column to insert. @param SwatTableViewColumn $reference_column the column after which the column will be inserted. @throws SwatWidgetNotFoundException if the reference column does not exist in this table-view. @throws SwatDuplicateIdException if the column has the same id as a column already in this table-view.
[ "Inserts", "a", "column", "after", "an", "existing", "column", "in", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1410-L1415
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.getColumn
public function getColumn($id) { if (!array_key_exists($id, $this->columns_by_id)) { throw new SwatWidgetNotFoundException( "Column with an id of '{$id}' not found." ); } return $this->columns_by_id[$id]; }
php
public function getColumn($id) { if (!array_key_exists($id, $this->columns_by_id)) { throw new SwatWidgetNotFoundException( "Column with an id of '{$id}' not found." ); } return $this->columns_by_id[$id]; }
[ "public", "function", "getColumn", "(", "$", "id", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "id", ",", "$", "this", "->", "columns_by_id", ")", ")", "{", "throw", "new", "SwatWidgetNotFoundException", "(", "\"Column with an id of '{$id}' not found...
Gets a column in this table-view by the column's id @param string $id the id of the column to get. @return SwatTableViewColumn the requested column. @throws SwatWidgetNotFoundException if no column with the specified id exists in this table-view.
[ "Gets", "a", "column", "in", "this", "table", "-", "view", "by", "the", "column", "s", "id" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1448-L1457
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.getVisibleColumns
public function getVisibleColumns() { $columns = array(); foreach ($this->columns as $column) { if ($column->visible) { $columns[] = $column; } } return $columns; }
php
public function getVisibleColumns() { $columns = array(); foreach ($this->columns as $column) { if ($column->visible) { $columns[] = $column; } } return $columns; }
[ "public", "function", "getVisibleColumns", "(", ")", "{", "$", "columns", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "columns", "as", "$", "column", ")", "{", "if", "(", "$", "column", "->", "visible", ")", "{", "$", "columns", ...
Gets all visible columns of this table-view as an array @return array the visible columns of this table-view.
[ "Gets", "all", "visible", "columns", "of", "this", "table", "-", "view", "as", "an", "array" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1493-L1503
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.setDefaultOrderbyColumn
public function setDefaultOrderbyColumn( SwatTableViewOrderableColumn $column, $direction = SwatTableViewOrderableColumn::ORDER_BY_DIR_DESCENDING ) { if ($column->view !== $this) { throw new SwatException( 'Can only set the default orderby on ' . 'orderable columns in this view.' ); } // this method sets properties on the table-view $column->setDirection($direction); }
php
public function setDefaultOrderbyColumn( SwatTableViewOrderableColumn $column, $direction = SwatTableViewOrderableColumn::ORDER_BY_DIR_DESCENDING ) { if ($column->view !== $this) { throw new SwatException( 'Can only set the default orderby on ' . 'orderable columns in this view.' ); } // this method sets properties on the table-view $column->setDirection($direction); }
[ "public", "function", "setDefaultOrderbyColumn", "(", "SwatTableViewOrderableColumn", "$", "column", ",", "$", "direction", "=", "SwatTableViewOrderableColumn", "::", "ORDER_BY_DIR_DESCENDING", ")", "{", "if", "(", "$", "column", "->", "view", "!==", "$", "this", ")...
Sets a default column to use for ordering the data of this table-view @param SwatTableViewOrderableColumn the column in this view to use for default ordering @param integer $direction the default direction of the ordered column. @throws SwatException @see SwatTableView::$default_orderby_column
[ "Sets", "a", "default", "column", "to", "use", "for", "ordering", "the", "data", "of", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1532-L1545
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.validateColumn
protected function validateColumn(SwatTableViewColumn $column) { // note: This works because the id property is set before children are // added to parents in SwatUI. if ($column->id !== null) { if (array_key_exists($column->id, $this->columns_by_id)) { throw new SwatDuplicateIdException( "A column with the id '{$column->id}' already exists " . 'in this table view.', 0, $column->id ); } } }
php
protected function validateColumn(SwatTableViewColumn $column) { // note: This works because the id property is set before children are // added to parents in SwatUI. if ($column->id !== null) { if (array_key_exists($column->id, $this->columns_by_id)) { throw new SwatDuplicateIdException( "A column with the id '{$column->id}' already exists " . 'in this table view.', 0, $column->id ); } } }
[ "protected", "function", "validateColumn", "(", "SwatTableViewColumn", "$", "column", ")", "{", "// note: This works because the id property is set before children are", "// added to parents in SwatUI.", "if", "(", "$", "column", "->", "id", "!==", "null", ")", "{", "if", ...
Ensures a column added to this table-view is valid for this table-view @param SwatTableViewColumn $column the column to check. @throws SwatDuplicateIdException if the column has the same id as a column already in this table-view.
[ "Ensures", "a", "column", "added", "to", "this", "table", "-", "view", "is", "valid", "for", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1558-L1572
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.insertColumn
protected function insertColumn( SwatTableViewColumn $column, SwatTableViewColumn $reference_column = null, $after = true ) { $this->validateColumn($column); if ($reference_column !== null) { $key = array_search($reference_column, $this->columns, true); if ($key === false) { throw new SwatWidgetNotFoundException( 'The reference column ' . 'could not be found in this table-view.' ); } if ($after) { // insert after reference column array_splice($this->columns, $key, 1, array( $reference_column, $column )); } else { // insert before reference column array_splice($this->columns, $key, 1, array( $column, $reference_column )); } } else { if ($after) { // append to array $this->columns[] = $column; } else { // prepend to array array_unshift($this->columns, $column); } } if ($column->id !== null) { $this->columns_by_id[$column->id] = $column; } $column->view = $this; // deprecated reference $column->parent = $this; }
php
protected function insertColumn( SwatTableViewColumn $column, SwatTableViewColumn $reference_column = null, $after = true ) { $this->validateColumn($column); if ($reference_column !== null) { $key = array_search($reference_column, $this->columns, true); if ($key === false) { throw new SwatWidgetNotFoundException( 'The reference column ' . 'could not be found in this table-view.' ); } if ($after) { // insert after reference column array_splice($this->columns, $key, 1, array( $reference_column, $column )); } else { // insert before reference column array_splice($this->columns, $key, 1, array( $column, $reference_column )); } } else { if ($after) { // append to array $this->columns[] = $column; } else { // prepend to array array_unshift($this->columns, $column); } } if ($column->id !== null) { $this->columns_by_id[$column->id] = $column; } $column->view = $this; // deprecated reference $column->parent = $this; }
[ "protected", "function", "insertColumn", "(", "SwatTableViewColumn", "$", "column", ",", "SwatTableViewColumn", "$", "reference_column", "=", "null", ",", "$", "after", "=", "true", ")", "{", "$", "this", "->", "validateColumn", "(", "$", "column", ")", ";", ...
Helper method to insert columns into this table-view @param SwatTableViewColumn $column the column to insert. @param SwatTableViewColumn $reference_column optional. An existing column within this table-view to which the inserted column is relatively positioned. If not specified, the column is inserted at the beginning or the end of this table-view's list of columns. @param boolean $after optional. If true and a reference column is specified, the column is inserted immediately before the reference column. If true and no reference column is specified, the column is inserted at the beginning of the column list. If false and a reference column is specified, the column is inserted immediately after the reference column. If false and no reference column is specified, the column is inserted at the end of the column list. Defaults to false. @throws SwatWidgetNotFoundException if the reference column does not exist in this table-view. @throws SwatDuplicateIdException if the column to be inserted has the same id as a column already in this table-view. @see SwatTableView::appendColumn() @see SwatTableView::insertColumnBefore() @see SwatTableView::insertColumnAfter()
[ "Helper", "method", "to", "insert", "columns", "into", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1611-L1657
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.appendSpanningColumn
public function appendSpanningColumn(SwatTableViewSpanningColumn $column) { $this->spanning_columns[] = $column; $column->view = $this; $column->parent = $this; }
php
public function appendSpanningColumn(SwatTableViewSpanningColumn $column) { $this->spanning_columns[] = $column; $column->view = $this; $column->parent = $this; }
[ "public", "function", "appendSpanningColumn", "(", "SwatTableViewSpanningColumn", "$", "column", ")", "{", "$", "this", "->", "spanning_columns", "[", "]", "=", "$", "column", ";", "$", "column", "->", "view", "=", "$", "this", ";", "$", "column", "->", "p...
Appends a spanning column object to this table-view @param SwatTableViewSpanningColumn $column the table-view spanning column to use for this table-view. @see SwatTableViewSpanningColumn
[ "Appends", "a", "spanning", "column", "object", "to", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1672-L1677
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.getSpanningColumn
public function getSpanningColumn($id) { if (!array_key_exists($id, $this->spanning_columns_by_id)) { throw new SwatWidgetNotFoundException( "Spanning column with an id of '{$id}' not found." ); } return $this->spanning_columns_by_id[$id]; }
php
public function getSpanningColumn($id) { if (!array_key_exists($id, $this->spanning_columns_by_id)) { throw new SwatWidgetNotFoundException( "Spanning column with an id of '{$id}' not found." ); } return $this->spanning_columns_by_id[$id]; }
[ "public", "function", "getSpanningColumn", "(", "$", "id", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "id", ",", "$", "this", "->", "spanning_columns_by_id", ")", ")", "{", "throw", "new", "SwatWidgetNotFoundException", "(", "\"Spanning column with ...
Gets a spanning column in this table-view by the spanning column's id @param string $id the id of the row to get. @return SwatTableViewSpanningColumn the requested spanning column. @throws SwatWidgetNotFoundException if no spanning column with the specified id exists in this table-view.
[ "Gets", "a", "spanning", "column", "in", "this", "table", "-", "view", "by", "the", "spanning", "column", "s", "id" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1706-L1715
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.getVisibleSpanningColumns
public function getVisibleSpanningColumns() { $columns = array(); foreach ($this->spanning_columns as $column) { if ($column->visible) { $columns[] = $column; } } return $columns; }
php
public function getVisibleSpanningColumns() { $columns = array(); foreach ($this->spanning_columns as $column) { if ($column->visible) { $columns[] = $column; } } return $columns; }
[ "public", "function", "getVisibleSpanningColumns", "(", ")", "{", "$", "columns", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "spanning_columns", "as", "$", "column", ")", "{", "if", "(", "$", "column", "->", "visible", ")", "{", "$...
Gets all visible spanning columns of this table-view as an array @return array the visible spanning columns of this table-view.
[ "Gets", "all", "visible", "spanning", "columns", "of", "this", "table", "-", "view", "as", "an", "array" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1738-L1749
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.appendGroup
public function appendGroup(SwatTableViewGroup $group) { $this->validateGroup($group); $this->groups[] = $group; if ($group->id !== null) { $this->groups_by_id[$group->id] = $group; } $group->view = $this; $group->parent = $this; }
php
public function appendGroup(SwatTableViewGroup $group) { $this->validateGroup($group); $this->groups[] = $group; if ($group->id !== null) { $this->groups_by_id[$group->id] = $group; } $group->view = $this; $group->parent = $this; }
[ "public", "function", "appendGroup", "(", "SwatTableViewGroup", "$", "group", ")", "{", "$", "this", "->", "validateGroup", "(", "$", "group", ")", ";", "$", "this", "->", "groups", "[", "]", "=", "$", "group", ";", "if", "(", "$", "group", "->", "id...
Appends a grouping object to this table-view A grouping object affects how the data in the table model is displayed in this table-view. With a grouping, rows are split into groups with special group headers above each group. Multiple groupings may be added to table-views. @param SwatTableViewGroup $group the table-view grouping to append to this table-view. @see SwatTableViewGroup @throws SwatDuplicateIdException if the group has the same id as a group already in this table-view.
[ "Appends", "a", "grouping", "object", "to", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1773-L1785
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.getGroup
public function getGroup($id) { if (!array_key_exists($id, $this->groups_by_id)) { throw new SwatWidgetNotFoundException( "Group with an id of '{$id}' not found." ); } return $this->groups_by_id[$id]; }
php
public function getGroup($id) { if (!array_key_exists($id, $this->groups_by_id)) { throw new SwatWidgetNotFoundException( "Group with an id of '{$id}' not found." ); } return $this->groups_by_id[$id]; }
[ "public", "function", "getGroup", "(", "$", "id", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "id", ",", "$", "this", "->", "groups_by_id", ")", ")", "{", "throw", "new", "SwatWidgetNotFoundException", "(", "\"Group with an id of '{$id}' not found.\"...
Gets a group in this table-view by the group's id @param string $id the id of the group to get. @return SwatTableViewGroup the requested group. @throws SwatWidgetNotFoundException if no group with the specified id exists in this table-view.
[ "Gets", "a", "group", "in", "this", "table", "-", "view", "by", "the", "group", "s", "id" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1817-L1826
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.insertRowBefore
public function insertRowBefore( SwatTableViewRow $row, SwatTableViewRow $reference_row ) { $this->insertRow($row, $reference_row, false); }
php
public function insertRowBefore( SwatTableViewRow $row, SwatTableViewRow $reference_row ) { $this->insertRow($row, $reference_row, false); }
[ "public", "function", "insertRowBefore", "(", "SwatTableViewRow", "$", "row", ",", "SwatTableViewRow", "$", "reference_row", ")", "{", "$", "this", "->", "insertRow", "(", "$", "row", ",", "$", "reference_row", ",", "false", ")", ";", "}" ]
Inserts a row before an existing row in this table-view @param SwatTableViewRow $row the row to insert. @param SwatTableViewRow $reference_row the row before which the row will be inserted. @throws SwatWidgetNotFoundException if the reference row does not exist in this table-view. @throws SwatDuplicateIdException if the row has the same id as a row already in this table-view. @throws SwatException if the row is an input row and this table-view already contains an input-row.
[ "Inserts", "a", "row", "before", "an", "existing", "row", "in", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1906-L1911
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.insertRowAfter
public function insertRowAfter( SwatTableViewRow $row, SwatTableViewRow $reference_row ) { $this->insertRow($row, $reference_row, true); }
php
public function insertRowAfter( SwatTableViewRow $row, SwatTableViewRow $reference_row ) { $this->insertRow($row, $reference_row, true); }
[ "public", "function", "insertRowAfter", "(", "SwatTableViewRow", "$", "row", ",", "SwatTableViewRow", "$", "reference_row", ")", "{", "$", "this", "->", "insertRow", "(", "$", "row", ",", "$", "reference_row", ",", "true", ")", ";", "}" ]
Inserts a row after an existing row in this table-view @param SwatTableViewRow $row the row to insert. @param SwatTableViewRow $reference_row the row after which the row will be inserted. @throws SwatWidgetNotFoundException if the reference row does not exist in this table-view. @throws SwatDuplicateIdException if the row has the same id as a row already in this table-view. @throws SwatException if the row is an input row and this table-view already contains an input-row.
[ "Inserts", "a", "row", "after", "an", "existing", "row", "in", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1930-L1935
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.getRow
public function getRow($id) { if (!array_key_exists($id, $this->rows_by_id)) { throw new SwatWidgetNotFoundException( "Row with an id of '{$id}' not found." ); } return $this->rows_by_id[$id]; }
php
public function getRow($id) { if (!array_key_exists($id, $this->rows_by_id)) { throw new SwatWidgetNotFoundException( "Row with an id of '{$id}' not found." ); } return $this->rows_by_id[$id]; }
[ "public", "function", "getRow", "(", "$", "id", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "id", ",", "$", "this", "->", "rows_by_id", ")", ")", "{", "throw", "new", "SwatWidgetNotFoundException", "(", "\"Row with an id of '{$id}' not found.\"", "...
Gets a row in this table-view by the row's id @param string $id the id of the row to get. @return SwatTableViewRow the requested row. @throws SwatWidgetNotFoundException if no row with the specified id exists in this table-view.
[ "Gets", "a", "row", "in", "this", "table", "-", "view", "by", "the", "row", "s", "id" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1967-L1976
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.getRowsByClass
public function getRowsByClass($class_name) { $rows = array(); foreach ($this->extra_rows as $row) { if ($row instanceof $class_name) { $rows[] = $row; } } return $rows; }
php
public function getRowsByClass($class_name) { $rows = array(); foreach ($this->extra_rows as $row) { if ($row instanceof $class_name) { $rows[] = $row; } } return $rows; }
[ "public", "function", "getRowsByClass", "(", "$", "class_name", ")", "{", "$", "rows", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "extra_rows", "as", "$", "row", ")", "{", "if", "(", "$", "row", "instanceof", "$", "class_name", "...
Gets all the extra rows of the specified class from this table-view @param string $class_name the class name to filter by. @return array all the extra rows of the specified class.
[ "Gets", "all", "the", "extra", "rows", "of", "the", "specified", "class", "from", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1988-L1998
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.getFirstRowByClass
public function getFirstRowByClass($class_name) { $my_row = null; foreach ($this->extra_rows as $row) { if ($row instanceof $class_name) { $my_row = $row; break; } } return $my_row; }
php
public function getFirstRowByClass($class_name) { $my_row = null; foreach ($this->extra_rows as $row) { if ($row instanceof $class_name) { $my_row = $row; break; } } return $my_row; }
[ "public", "function", "getFirstRowByClass", "(", "$", "class_name", ")", "{", "$", "my_row", "=", "null", ";", "foreach", "(", "$", "this", "->", "extra_rows", "as", "$", "row", ")", "{", "if", "(", "$", "row", "instanceof", "$", "class_name", ")", "{"...
Gets the first extra row of the specified class from this table-view Unlike the {@link SwatUIParent::getFirstDescendant()} method, this method only checks this table-view and does not check the child objects of this table-view. @param string $class_name the class name to filter by. @return SwatTableViewRow the first extra row of the specified class or null if no such row object exists in this table-view. @see SwatUIParent::getFirstDescendant()
[ "Gets", "the", "first", "extra", "row", "of", "the", "specified", "class", "from", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L2018-L2028
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.validateRow
protected function validateRow(SwatTableViewRow $row) { if ($row instanceof SwatTableViewInputRow) { if ($this->has_input_row) { throw new SwatException( 'Only one input row may be added to a table-view.' ); } else { $this->has_input_row = true; } } if ($row->id !== null) { if (array_key_exists($row->id, $this->rows_by_id)) { throw new SwatDuplicateIdException( "A row with the id '{$row->id}' already exists " . 'in this table-view.', 0, $row->id ); } } }
php
protected function validateRow(SwatTableViewRow $row) { if ($row instanceof SwatTableViewInputRow) { if ($this->has_input_row) { throw new SwatException( 'Only one input row may be added to a table-view.' ); } else { $this->has_input_row = true; } } if ($row->id !== null) { if (array_key_exists($row->id, $this->rows_by_id)) { throw new SwatDuplicateIdException( "A row with the id '{$row->id}' already exists " . 'in this table-view.', 0, $row->id ); } } }
[ "protected", "function", "validateRow", "(", "SwatTableViewRow", "$", "row", ")", "{", "if", "(", "$", "row", "instanceof", "SwatTableViewInputRow", ")", "{", "if", "(", "$", "this", "->", "has_input_row", ")", "{", "throw", "new", "SwatException", "(", "'On...
Ensures a row added to this table-view is valid for this table-view @param SwatTableViewRow $row the row to check. @throws SwatDuplicateIdException if the row has the same id as a row already in this table-view. @throws SwatException if the row is an input row and this table-view already contains an input-row.
[ "Ensures", "a", "row", "added", "to", "this", "table", "-", "view", "is", "valid", "for", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L2043-L2065
train
silverorange/swat
Swat/SwatTableView.php
SwatTableView.insertRow
protected function insertRow( SwatTableViewRow $row, SwatTableViewRow $reference_row = null, $after = true ) { $this->validateRow($row); if ($reference_row !== null) { $key = array_search($reference_row, $this->extra_rows, true); if ($key === false) { throw new SwatWidgetNotFoundException( 'The reference row ' . 'could not be found in this table-view.' ); } if ($after) { // insert after reference row array_splice($this->extra_rows, $key, 1, array( $reference_row, $row )); } else { // insert before reference row array_splice($this->extra_rows, $key, 1, array( $row, $reference_row )); } } else { if ($after) { // append to array $this->extra_rows[] = $row; } else { // prepend to array array_unshift($this->extra_rows, $row); } } if ($row->id !== null) { $this->rows_by_id[$row->id] = $row; } $row->view = $this; // deprecated reference $row->parent = $this; }
php
protected function insertRow( SwatTableViewRow $row, SwatTableViewRow $reference_row = null, $after = true ) { $this->validateRow($row); if ($reference_row !== null) { $key = array_search($reference_row, $this->extra_rows, true); if ($key === false) { throw new SwatWidgetNotFoundException( 'The reference row ' . 'could not be found in this table-view.' ); } if ($after) { // insert after reference row array_splice($this->extra_rows, $key, 1, array( $reference_row, $row )); } else { // insert before reference row array_splice($this->extra_rows, $key, 1, array( $row, $reference_row )); } } else { if ($after) { // append to array $this->extra_rows[] = $row; } else { // prepend to array array_unshift($this->extra_rows, $row); } } if ($row->id !== null) { $this->rows_by_id[$row->id] = $row; } $row->view = $this; // deprecated reference $row->parent = $this; }
[ "protected", "function", "insertRow", "(", "SwatTableViewRow", "$", "row", ",", "SwatTableViewRow", "$", "reference_row", "=", "null", ",", "$", "after", "=", "true", ")", "{", "$", "this", "->", "validateRow", "(", "$", "row", ")", ";", "if", "(", "$", ...
Helper method to insert rows into this table-view @param SwatTableViewRow $row the row to insert. @param SwatTableViewRow $reference_row optional. An existing row within this table-view to which the inserted row is relatively positioned. If not specified, the row is inserted at the beginning or the end of this table-view's list of extra rows. @param boolean $after optional. If true and a reference row is specified, the row is inserted immediately before the reference row. If true and no reference row is specified, the row is inserted at the beginning of the extra row list. If false and a reference row is specified, the row is inserted immediately after the reference row. If false and no reference row is specified, the row is inserted at the end of the extra row list. Defaults to false. @throws SwatWidgetNotFoundException if the reference row does not exist in this table-view. @throws SwatDuplicateIdException if the row to be inserted has the same id as a row already in this table-view. @see SwatTableView::appendRow() @see SwatTableView::insertRowBefore() @see SwatTableView::insertRowAfter()
[ "Helper", "method", "to", "insert", "rows", "into", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L2101-L2147
train
brainworxx/kreXX
src/Analyse/Callback/Analyse/Objects/Methods.php
Methods.callMe
public function callMe() { $output = $this->dispatchStartEvent(); /** @var \ReflectionClass $ref */ $ref = $this->parameters[static::PARAM_REF]; $doProtected = $this->pool->config->getSetting(Fallback::SETTING_ANALYSE_PROTECTED_METHODS) || $this->pool->scope->isInScope(); $doPrivate = $this->pool->config->getSetting(Fallback::SETTING_ANALYSE_PRIVATE_METHODS) || $this->pool->scope->isInScope(); $domId = $this->generateDomIdFromClassname($ref->getName(), $doProtected, $doPrivate); // We need to check, if we have a meta recursion here. if ($this->pool->recursionHandler->isInMetaHive($domId) === true) { // We have been here before. // We skip this one, and leave it to the js recursion handler! return $output . $this->pool->render->renderRecursion( $this->dispatchEventWithModel( 'recursion', $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setDomid($domId) ->setNormal('Methods') ->setName('Methods') ->setType(static::TYPE_INTERNALS) ) ); } return $output . $this->analyseMethods($ref, $domId, $doProtected, $doPrivate); }
php
public function callMe() { $output = $this->dispatchStartEvent(); /** @var \ReflectionClass $ref */ $ref = $this->parameters[static::PARAM_REF]; $doProtected = $this->pool->config->getSetting(Fallback::SETTING_ANALYSE_PROTECTED_METHODS) || $this->pool->scope->isInScope(); $doPrivate = $this->pool->config->getSetting(Fallback::SETTING_ANALYSE_PRIVATE_METHODS) || $this->pool->scope->isInScope(); $domId = $this->generateDomIdFromClassname($ref->getName(), $doProtected, $doPrivate); // We need to check, if we have a meta recursion here. if ($this->pool->recursionHandler->isInMetaHive($domId) === true) { // We have been here before. // We skip this one, and leave it to the js recursion handler! return $output . $this->pool->render->renderRecursion( $this->dispatchEventWithModel( 'recursion', $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setDomid($domId) ->setNormal('Methods') ->setName('Methods') ->setType(static::TYPE_INTERNALS) ) ); } return $output . $this->analyseMethods($ref, $domId, $doProtected, $doPrivate); }
[ "public", "function", "callMe", "(", ")", "{", "$", "output", "=", "$", "this", "->", "dispatchStartEvent", "(", ")", ";", "/** @var \\ReflectionClass $ref */", "$", "ref", "=", "$", "this", "->", "parameters", "[", "static", "::", "PARAM_REF", "]", ";", "...
Decides which methods we want to analyse and then starts the dump. @return string The generated markup.
[ "Decides", "which", "methods", "we", "want", "to", "analyse", "and", "then", "starts", "the", "dump", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects/Methods.php#L64-L95
train
brainworxx/kreXX
src/Analyse/Callback/Analyse/Objects/Methods.php
Methods.generateDomIdFromClassname
protected function generateDomIdFromClassname($data, $doProtected, $doPrivate) { $string = 'k' . $this->pool->emergencyHandler->getKrexxCount() . '_m_'; if ($doProtected === true) { $string .= 'pro_'; } if ($doPrivate === true) { $string .= 'pri_'; } return $string . md5($data); }
php
protected function generateDomIdFromClassname($data, $doProtected, $doPrivate) { $string = 'k' . $this->pool->emergencyHandler->getKrexxCount() . '_m_'; if ($doProtected === true) { $string .= 'pro_'; } if ($doPrivate === true) { $string .= 'pri_'; } return $string . md5($data); }
[ "protected", "function", "generateDomIdFromClassname", "(", "$", "data", ",", "$", "doProtected", ",", "$", "doPrivate", ")", "{", "$", "string", "=", "'k'", ".", "$", "this", "->", "pool", "->", "emergencyHandler", "->", "getKrexxCount", "(", ")", ".", "'...
Generates a id for the DOM. This is used to jump from a recursion to the object analysis data. The ID is simply the md5 hash of the classname with the namespace. @param string $data The object name from which we want the ID. @param boolean $doProtected Are we analysing the protected methods here? @param boolean $doPrivate Are we analysing private methods here? @return string The generated id.
[ "Generates", "a", "id", "for", "the", "DOM", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects/Methods.php#L171-L183
train
flextype-components/filesystem
Filesystem.php
Filesystem.getMimeType
public static function getMimeType(string $file, bool $guess = true) { // Get mime using the file information functions if (function_exists('finfo_open')) { $info = finfo_open(FILEINFO_MIME_TYPE); $mime = finfo_file($info, $file); finfo_close($info); return $mime; } else { // Just guess mime by using the file extension if ($guess === true) { $mime_types = Filesystem::$mime_types; $extension = pathinfo($file, PATHINFO_EXTENSION); return isset($mime_types[$extension]) ? $mime_types[$extension] : false; } else { return false; } } }
php
public static function getMimeType(string $file, bool $guess = true) { // Get mime using the file information functions if (function_exists('finfo_open')) { $info = finfo_open(FILEINFO_MIME_TYPE); $mime = finfo_file($info, $file); finfo_close($info); return $mime; } else { // Just guess mime by using the file extension if ($guess === true) { $mime_types = Filesystem::$mime_types; $extension = pathinfo($file, PATHINFO_EXTENSION); return isset($mime_types[$extension]) ? $mime_types[$extension] : false; } else { return false; } } }
[ "public", "static", "function", "getMimeType", "(", "string", "$", "file", ",", "bool", "$", "guess", "=", "true", ")", "{", "// Get mime using the file information functions", "if", "(", "function_exists", "(", "'finfo_open'", ")", ")", "{", "$", "info", "=", ...
Returns the mime type of a file. Returns false if the mime type is not found. @param string $file Full path to the file @param bool $guess Set to false to disable mime type guessing @return mixed
[ "Returns", "the", "mime", "type", "of", "a", "file", ".", "Returns", "false", "if", "the", "mime", "type", "is", "not", "found", "." ]
4a007ea30d05028a7ca7e96f9066d20210064b28
https://github.com/flextype-components/filesystem/blob/4a007ea30d05028a7ca7e96f9066d20210064b28/Filesystem.php#L140-L165
train
flextype-components/filesystem
Filesystem.php
Filesystem.write
public static function write(string $path, string $contents, string $visibility = 'public', int $flags = LOCK_EX) { if (file_put_contents($path, $contents, $flags) === false) { return false; } Filesystem::setVisibility($path, $visibility); return true; }
php
public static function write(string $path, string $contents, string $visibility = 'public', int $flags = LOCK_EX) { if (file_put_contents($path, $contents, $flags) === false) { return false; } Filesystem::setVisibility($path, $visibility); return true; }
[ "public", "static", "function", "write", "(", "string", "$", "path", ",", "string", "$", "contents", ",", "string", "$", "visibility", "=", "'public'", ",", "int", "$", "flags", "=", "LOCK_EX", ")", "{", "if", "(", "file_put_contents", "(", "$", "path", ...
Write a file. @param string $path The path of the new file. @param string $contents The file contents. @param string $visibility An optional configuration array. @param int $flags Flags @return bool True on success, false on failure.
[ "Write", "a", "file", "." ]
4a007ea30d05028a7ca7e96f9066d20210064b28
https://github.com/flextype-components/filesystem/blob/4a007ea30d05028a7ca7e96f9066d20210064b28/Filesystem.php#L358-L367
train
rollun-com/rollun-datastore
src/DataStore/src/DataStore/CsvBase.php
CsvBase.flush
protected function flush($item, $delete = false) { // Create and open temporary file for writing $tmpFile = tempnam(sys_get_temp_dir(), uniqid() . '.tmp'); $tempHandler = fopen($tmpFile, 'w'); // Write headings fputcsv($tempHandler, $this->columns, $this->csvDelimiter); $identifier = $this->getIdentifier(); $inserted = false; foreach ($this as $index => $row) { // Check an identifier; if equals and it doesn't need to delete - inserts new item if ($item[$identifier] == $row[$identifier]) { if (!$delete) { $this->writeRow($tempHandler, $item); } // anyway marks row as inserted $inserted = true; } else { // Just it inserts row from source-file (copying) $this->writeRow($tempHandler, $row); } } // If the same item was not found and changed inserts the new item as the last row in the file if (!$inserted) { $this->writeRow($tempHandler, $item); } fclose($tempHandler); // Copies the original file to a temporary one. if (!copy($tmpFile, $this->filename)) { unlink($tmpFile); throw new DataStoreException("Failed to write the results to a file."); } unlink($tmpFile); }
php
protected function flush($item, $delete = false) { // Create and open temporary file for writing $tmpFile = tempnam(sys_get_temp_dir(), uniqid() . '.tmp'); $tempHandler = fopen($tmpFile, 'w'); // Write headings fputcsv($tempHandler, $this->columns, $this->csvDelimiter); $identifier = $this->getIdentifier(); $inserted = false; foreach ($this as $index => $row) { // Check an identifier; if equals and it doesn't need to delete - inserts new item if ($item[$identifier] == $row[$identifier]) { if (!$delete) { $this->writeRow($tempHandler, $item); } // anyway marks row as inserted $inserted = true; } else { // Just it inserts row from source-file (copying) $this->writeRow($tempHandler, $row); } } // If the same item was not found and changed inserts the new item as the last row in the file if (!$inserted) { $this->writeRow($tempHandler, $item); } fclose($tempHandler); // Copies the original file to a temporary one. if (!copy($tmpFile, $this->filename)) { unlink($tmpFile); throw new DataStoreException("Failed to write the results to a file."); } unlink($tmpFile); }
[ "protected", "function", "flush", "(", "$", "item", ",", "$", "delete", "=", "false", ")", "{", "// Create and open temporary file for writing", "$", "tmpFile", "=", "tempnam", "(", "sys_get_temp_dir", "(", ")", ",", "uniqid", "(", ")", ".", "'.tmp'", ")", "...
Flushes all changes to temporary file which then will change the original one @param $item @param bool|false $delete @throws \rollun\datastore\DataStore\DataStoreException
[ "Flushes", "all", "changes", "to", "temporary", "file", "which", "then", "will", "change", "the", "original", "one" ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/CsvBase.php#L241-L281
train
rollun-com/rollun-datastore
src/DataStore/src/DataStore/CsvBase.php
CsvBase.openFile
protected function openFile($seekFirstDataRow = true) { $this->lockFile(); try { $this->fileHandler = fopen($this->filename, 'r'); if ($seekFirstDataRow) { fgets($this->fileHandler); } } catch (\Exception $e) { throw new DataStoreException( "Failed to open file. The specified file does not exist or one is closed for reading." ); } finally { $this->lockHandler->release(); } }
php
protected function openFile($seekFirstDataRow = true) { $this->lockFile(); try { $this->fileHandler = fopen($this->filename, 'r'); if ($seekFirstDataRow) { fgets($this->fileHandler); } } catch (\Exception $e) { throw new DataStoreException( "Failed to open file. The specified file does not exist or one is closed for reading." ); } finally { $this->lockHandler->release(); } }
[ "protected", "function", "openFile", "(", "$", "seekFirstDataRow", "=", "true", ")", "{", "$", "this", "->", "lockFile", "(", ")", ";", "try", "{", "$", "this", "->", "fileHandler", "=", "fopen", "(", "$", "this", "->", "filename", ",", "'r'", ")", "...
Opens file for reading. @param bool $seekFirstDataRow - the first row in csv-file contains the column headings; this parameter says, if it is need to pass it (row) after the opening the file. @throws \rollun\datastore\DataStore\DataStoreException
[ "Opens", "file", "for", "reading", "." ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/CsvBase.php#L290-L306
train
rollun-com/rollun-datastore
src/DataStore/src/DataStore/CsvBase.php
CsvBase.lockFile
protected function lockFile($nbTries = 0) { if (!$this->lockHandler->lock()) { if ($nbTries >= static::MAX_LOCK_TRIES) { throw new DataStoreException( sprintf("Reach max retry (%s) for locking queue file {$this->filename}", static::MAX_LOCK_TRIES) ); } usleep(10); return $this->lockFile($nbTries + 1); } return true; }
php
protected function lockFile($nbTries = 0) { if (!$this->lockHandler->lock()) { if ($nbTries >= static::MAX_LOCK_TRIES) { throw new DataStoreException( sprintf("Reach max retry (%s) for locking queue file {$this->filename}", static::MAX_LOCK_TRIES) ); } usleep(10); return $this->lockFile($nbTries + 1); } return true; }
[ "protected", "function", "lockFile", "(", "$", "nbTries", "=", "0", ")", "{", "if", "(", "!", "$", "this", "->", "lockHandler", "->", "lock", "(", ")", ")", "{", "if", "(", "$", "nbTries", ">=", "static", "::", "MAX_LOCK_TRIES", ")", "{", "throw", ...
Locks the file @param int $nbTries - count of tries of locking queue @return bool @throws \rollun\datastore\DataStore\DataStoreException
[ "Locks", "the", "file" ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/CsvBase.php#L315-L330
train
rollun-com/rollun-datastore
src/DataStore/src/DataStore/CsvBase.php
CsvBase.getHeaders
public function getHeaders() { // Don't pass the first row!! $this->openFile(0); $this->columns = fgetcsv($this->fileHandler, null, $this->csvDelimiter); $this->closeFile(); }
php
public function getHeaders() { // Don't pass the first row!! $this->openFile(0); $this->columns = fgetcsv($this->fileHandler, null, $this->csvDelimiter); $this->closeFile(); }
[ "public", "function", "getHeaders", "(", ")", "{", "// Don't pass the first row!!", "$", "this", "->", "openFile", "(", "0", ")", ";", "$", "this", "->", "columns", "=", "fgetcsv", "(", "$", "this", "->", "fileHandler", ",", "null", ",", "$", "this", "->...
Sets the column headings @throws \rollun\datastore\DataStore\DataStoreException
[ "Sets", "the", "column", "headings" ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/CsvBase.php#L361-L367
train
rollun-com/rollun-datastore
src/DataStore/src/DataStore/CsvBase.php
CsvBase.createNewItem
protected function createNewItem($itemData) { $item = array_flip($this->columns); foreach ($item as $key => $value) { if (isset($itemData[$key])) { $item[$key] = $itemData[$key]; } else { $item[$key] = null; } } return $item; }
php
protected function createNewItem($itemData) { $item = array_flip($this->columns); foreach ($item as $key => $value) { if (isset($itemData[$key])) { $item[$key] = $itemData[$key]; } else { $item[$key] = null; } } return $item; }
[ "protected", "function", "createNewItem", "(", "$", "itemData", ")", "{", "$", "item", "=", "array_flip", "(", "$", "this", "->", "columns", ")", ";", "foreach", "(", "$", "item", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "isset", ...
Creates a new item, combines data with the column headings @param $itemData @return array
[ "Creates", "a", "new", "item", "combines", "data", "with", "the", "column", "headings" ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/CsvBase.php#L374-L387
train
rollun-com/rollun-datastore
src/DataStore/src/DataStore/CsvBase.php
CsvBase.getTrueRow
public function getTrueRow($row) { if ($row) { array_walk( $row, function (&$item, $key) { if ('' === $item) { $item = null; } if ($item === '""') { $item = ''; } $isZeroFirstString = strlen($item) > 1 && substr($item, 0, 1) == "0"; if (is_numeric($item) && !$isZeroFirstString) { if (intval($item) == $item) { $item = intval($item); } else { $item = floatval($item); } } } ); return array_combine($this->columns, $row); } return null; }
php
public function getTrueRow($row) { if ($row) { array_walk( $row, function (&$item, $key) { if ('' === $item) { $item = null; } if ($item === '""') { $item = ''; } $isZeroFirstString = strlen($item) > 1 && substr($item, 0, 1) == "0"; if (is_numeric($item) && !$isZeroFirstString) { if (intval($item) == $item) { $item = intval($item); } else { $item = floatval($item); } } } ); return array_combine($this->columns, $row); } return null; }
[ "public", "function", "getTrueRow", "(", "$", "row", ")", "{", "if", "(", "$", "row", ")", "{", "array_walk", "(", "$", "row", ",", "function", "(", "&", "$", "item", ",", "$", "key", ")", "{", "if", "(", "''", "===", "$", "item", ")", "{", "...
Returns the associative array with the column headings; also checks and sanitize empty string and null value and converts type for the numeric fields @param $row @return array|null
[ "Returns", "the", "associative", "array", "with", "the", "column", "headings", ";", "also", "checks", "and", "sanitize", "empty", "string", "and", "null", "value", "and", "converts", "type", "for", "the", "numeric", "fields" ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/CsvBase.php#L409-L439
train
silverorange/swat
Swat/SwatRadioList.php
SwatRadioList.display
public function display() { $options = $this->getOptions(); if (!$this->visible || $options === null) { return; } SwatWidget::display(); // add a hidden field so we can check if this list was submitted on // the process step $this->getForm()->addHiddenField($this->id . '_submitted', 1); if (count($options) === 1) { // get first and only element $this->displaySingle(current($options)); return; } $ul_tag = new SwatHtmlTag('ul'); $ul_tag->id = $this->id; $ul_tag->class = $this->getCSSClassString(); $ul_tag->open(); $li_tag = new SwatHtmlTag('li'); $index = 0; foreach ($options as $option) { // add option-specific CSS classes from option metadata $classes = $this->getOptionMetadata($option, 'classes'); if (is_array($classes)) { $li_tag->class = implode(' ', $classes); } elseif ($classes) { $li_tag->class = strval($classes); } else { $li_tag->removeAttribute('class'); } $sensitive = $this->getOptionMetadata($option, 'sensitive'); if ($sensitive === false || !$this->isSensitive()) { if ($li_tag->class === null) { $li_tag->class = 'swat-insensitive'; } else { $li_tag->class .= ' swat-insensitive'; } } if ($option instanceof SwatFlydownDivider) { if ($li_tag->class === null) { $li_tag->class = 'swat-radio-list-divider-li'; } else { $li_tag->class .= ' swat-radio-list-divider-li'; } } $li_tag->id = $this->id . '_li_' . (string) $index; $li_tag->open(); if ($option instanceof SwatFlydownDivider) { $this->displayDivider($option, $index); } else { $this->displayOption($option, $index); $this->displayOptionLabel($option, $index); } $li_tag->close(); $index++; } $ul_tag->close(); }
php
public function display() { $options = $this->getOptions(); if (!$this->visible || $options === null) { return; } SwatWidget::display(); // add a hidden field so we can check if this list was submitted on // the process step $this->getForm()->addHiddenField($this->id . '_submitted', 1); if (count($options) === 1) { // get first and only element $this->displaySingle(current($options)); return; } $ul_tag = new SwatHtmlTag('ul'); $ul_tag->id = $this->id; $ul_tag->class = $this->getCSSClassString(); $ul_tag->open(); $li_tag = new SwatHtmlTag('li'); $index = 0; foreach ($options as $option) { // add option-specific CSS classes from option metadata $classes = $this->getOptionMetadata($option, 'classes'); if (is_array($classes)) { $li_tag->class = implode(' ', $classes); } elseif ($classes) { $li_tag->class = strval($classes); } else { $li_tag->removeAttribute('class'); } $sensitive = $this->getOptionMetadata($option, 'sensitive'); if ($sensitive === false || !$this->isSensitive()) { if ($li_tag->class === null) { $li_tag->class = 'swat-insensitive'; } else { $li_tag->class .= ' swat-insensitive'; } } if ($option instanceof SwatFlydownDivider) { if ($li_tag->class === null) { $li_tag->class = 'swat-radio-list-divider-li'; } else { $li_tag->class .= ' swat-radio-list-divider-li'; } } $li_tag->id = $this->id . '_li_' . (string) $index; $li_tag->open(); if ($option instanceof SwatFlydownDivider) { $this->displayDivider($option, $index); } else { $this->displayOption($option, $index); $this->displayOptionLabel($option, $index); } $li_tag->close(); $index++; } $ul_tag->close(); }
[ "public", "function", "display", "(", ")", "{", "$", "options", "=", "$", "this", "->", "getOptions", "(", ")", ";", "if", "(", "!", "$", "this", "->", "visible", "||", "$", "options", "===", "null", ")", "{", "return", ";", "}", "SwatWidget", "::"...
Displays this radio list
[ "Displays", "this", "radio", "list" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatRadioList.php#L54-L125
train
silverorange/swat
Swat/SwatRadioList.php
SwatRadioList.displayDivider
protected function displayDivider(SwatOption $option, $index) { $span_tag = new SwatHtmlTag('span'); $span_tag->class = 'swat-radio-list-divider'; if ($option->value !== null) { $span_tag->id = $this->id . '_' . (string) $option->value; } $span_tag->setContent($option->title, $option->content_type); $span_tag->display(); }
php
protected function displayDivider(SwatOption $option, $index) { $span_tag = new SwatHtmlTag('span'); $span_tag->class = 'swat-radio-list-divider'; if ($option->value !== null) { $span_tag->id = $this->id . '_' . (string) $option->value; } $span_tag->setContent($option->title, $option->content_type); $span_tag->display(); }
[ "protected", "function", "displayDivider", "(", "SwatOption", "$", "option", ",", "$", "index", ")", "{", "$", "span_tag", "=", "new", "SwatHtmlTag", "(", "'span'", ")", ";", "$", "span_tag", "->", "class", "=", "'swat-radio-list-divider'", ";", "if", "(", ...
Displays a divider option in this radio list @param SwatOption $option the divider option to display. @param integer $index the numeric index of the option in this list. Starts at 0.
[ "Displays", "a", "divider", "option", "in", "this", "radio", "list" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatRadioList.php#L172-L182
train
brainworxx/kreXX
src/Analyse/Code/Scope.php
Scope.isInScope
public function isInScope() { return $this->pool->emergencyHandler->getNestingLevel() <= 1 && $this->scope === static::THIS_SCOPE && $this->pool->config->getSetting(Fallback::SETTING_USE_SCOPE_ANALYSIS); }
php
public function isInScope() { return $this->pool->emergencyHandler->getNestingLevel() <= 1 && $this->scope === static::THIS_SCOPE && $this->pool->config->getSetting(Fallback::SETTING_USE_SCOPE_ANALYSIS); }
[ "public", "function", "isInScope", "(", ")", "{", "return", "$", "this", "->", "pool", "->", "emergencyHandler", "->", "getNestingLevel", "(", ")", "<=", "1", "&&", "$", "this", "->", "scope", "===", "static", "::", "THIS_SCOPE", "&&", "$", "this", "->",...
We decide if a method or property is currently within a reachable scope. @return bool Whether it is within the scope or not.
[ "We", "decide", "if", "a", "method", "or", "property", "is", "currently", "within", "a", "reachable", "scope", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Code/Scope.php#L119-L124
train
brainworxx/kreXX
src/Analyse/Routing/Process/ProcessBoolean.php
ProcessBoolean.process
public function process(Model $model) { $data = $model->getData() ? 'TRUE' : 'FALSE'; return $this->pool->render->renderSingleChild( $model->setData($data) ->setNormal($data) ->setType(static::TYPE_BOOL) ); }
php
public function process(Model $model) { $data = $model->getData() ? 'TRUE' : 'FALSE'; return $this->pool->render->renderSingleChild( $model->setData($data) ->setNormal($data) ->setType(static::TYPE_BOOL) ); }
[ "public", "function", "process", "(", "Model", "$", "model", ")", "{", "$", "data", "=", "$", "model", "->", "getData", "(", ")", "?", "'TRUE'", ":", "'FALSE'", ";", "return", "$", "this", "->", "pool", "->", "render", "->", "renderSingleChild", "(", ...
Render a dump for a boolean value. @param Model $model The data we are analysing. @return string The rendered markup.
[ "Render", "a", "dump", "for", "a", "boolean", "value", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Routing/Process/ProcessBoolean.php#L56-L64
train
brainworxx/kreXX
src/Analyse/Callback/Analyse/Objects/Constants.php
Constants.callMe
public function callMe() { $output = $this->dispatchStartEvent(); // This is actually an array, we ara analysing. But We do not want to render // an array, so we need to process it like the return from an iterator. /** @var \ReflectionClass $ref */ $ref = $this->parameters[static::PARAM_REF]; $refConst = $ref->getConstants(); if (empty($refConst) === true) { // Nothing to see here, return an empty string. return ''; } // We've got some values, we will dump them. $classname = '\\' . $ref->getName(); return $output . $this->pool->render->renderExpandableChild( $this->dispatchEventWithModel( static::EVENT_MARKER_ANALYSES_END, $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setName('Constants') ->setType(static::TYPE_INTERNALS) ->setIsMetaConstants(true) ->addParameter(static::PARAM_DATA, $refConst) ->addParameter(static::PARAM_CLASSNAME, $classname) ->injectCallback( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughConstants') ) ) ); }
php
public function callMe() { $output = $this->dispatchStartEvent(); // This is actually an array, we ara analysing. But We do not want to render // an array, so we need to process it like the return from an iterator. /** @var \ReflectionClass $ref */ $ref = $this->parameters[static::PARAM_REF]; $refConst = $ref->getConstants(); if (empty($refConst) === true) { // Nothing to see here, return an empty string. return ''; } // We've got some values, we will dump them. $classname = '\\' . $ref->getName(); return $output . $this->pool->render->renderExpandableChild( $this->dispatchEventWithModel( static::EVENT_MARKER_ANALYSES_END, $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setName('Constants') ->setType(static::TYPE_INTERNALS) ->setIsMetaConstants(true) ->addParameter(static::PARAM_DATA, $refConst) ->addParameter(static::PARAM_CLASSNAME, $classname) ->injectCallback( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughConstants') ) ) ); }
[ "public", "function", "callMe", "(", ")", "{", "$", "output", "=", "$", "this", "->", "dispatchStartEvent", "(", ")", ";", "// This is actually an array, we ara analysing. But We do not want to render", "// an array, so we need to process it like the return from an iterator.", "/...
Dumps the constants of a class, @return string The generated markup.
[ "Dumps", "the", "constants", "of", "a", "class" ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects/Constants.php#L58-L89
train
brainworxx/kreXX
src/Analyse/Comment/Methods.php
Methods.getTraitComment
protected function getTraitComment($originalComment, \ReflectionClass $reflection) { // We need to check if we can get traits here. if (method_exists($reflection, 'getTraits') === true) { // Get the traits from this class. // Now we should have an array with reflections of all // traits in the class we are currently looking at. foreach ($reflection->getTraits() as $trait) { if ($this->checkComment($originalComment) === true) { // Looks like we've resolved them all. return $originalComment; } // We need to look further! if ($trait->hasMethod($this->methodName) === true) { $traitComment = $this->prettifyComment( $trait->getMethod($this->methodName)->getDocComment() ); // Replace it. $originalComment = $this->replaceInheritComment($originalComment, $traitComment); } } // Return what we could resolve so far. return $originalComment; } // Wrong PHP version. Traits are not available. return $originalComment; }
php
protected function getTraitComment($originalComment, \ReflectionClass $reflection) { // We need to check if we can get traits here. if (method_exists($reflection, 'getTraits') === true) { // Get the traits from this class. // Now we should have an array with reflections of all // traits in the class we are currently looking at. foreach ($reflection->getTraits() as $trait) { if ($this->checkComment($originalComment) === true) { // Looks like we've resolved them all. return $originalComment; } // We need to look further! if ($trait->hasMethod($this->methodName) === true) { $traitComment = $this->prettifyComment( $trait->getMethod($this->methodName)->getDocComment() ); // Replace it. $originalComment = $this->replaceInheritComment($originalComment, $traitComment); } } // Return what we could resolve so far. return $originalComment; } // Wrong PHP version. Traits are not available. return $originalComment; }
[ "protected", "function", "getTraitComment", "(", "$", "originalComment", ",", "\\", "ReflectionClass", "$", "reflection", ")", "{", "// We need to check if we can get traits here.", "if", "(", "method_exists", "(", "$", "reflection", ",", "'getTraits'", ")", "===", "t...
Gets the comment from all added traits. Iterated through an array of traits, to see if we can resolve the inherited comment. Traits are only supported since PHP 5.4, so we need to check if they are available. @param string $originalComment The original comment, so far. @param \ReflectionClass $reflection A reflection of the object we are currently analysing. @return string The comment from one of the trait.
[ "Gets", "the", "comment", "from", "all", "added", "traits", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Comment/Methods.php#L153-L182
train
brainworxx/kreXX
src/Analyse/Comment/Methods.php
Methods.getInterfaceComment
protected function getInterfaceComment($originalComment, \ReflectionClass $reflectionClass) { foreach ($reflectionClass->getInterfaces() as $interface) { if ($interface->hasMethod($this->methodName) === true) { $interfaceComment = $this->prettifyComment($interface->getMethod($this->methodName)->getDocComment()); // Replace it. $originalComment = $this->replaceInheritComment($originalComment, $interfaceComment); } if ($this->checkComment($originalComment) === true) { // Looks like we've resolved them all. return $originalComment; } // We need to look further. } // Return what we could resolve so far. return $originalComment; }
php
protected function getInterfaceComment($originalComment, \ReflectionClass $reflectionClass) { foreach ($reflectionClass->getInterfaces() as $interface) { if ($interface->hasMethod($this->methodName) === true) { $interfaceComment = $this->prettifyComment($interface->getMethod($this->methodName)->getDocComment()); // Replace it. $originalComment = $this->replaceInheritComment($originalComment, $interfaceComment); } if ($this->checkComment($originalComment) === true) { // Looks like we've resolved them all. return $originalComment; } // We need to look further. } // Return what we could resolve so far. return $originalComment; }
[ "protected", "function", "getInterfaceComment", "(", "$", "originalComment", ",", "\\", "ReflectionClass", "$", "reflectionClass", ")", "{", "foreach", "(", "$", "reflectionClass", "->", "getInterfaces", "(", ")", "as", "$", "interface", ")", "{", "if", "(", "...
Gets the comment from all implemented interfaces. Iterated through an array of interfaces, to see if we can resolve the inherited comment. @param string $originalComment The original comment, so far. @param \ReflectionClass $reflectionClass A reflection of the object we are currently analysing. @return string The comment from one of the interfaces.
[ "Gets", "the", "comment", "from", "all", "implemented", "interfaces", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Comment/Methods.php#L198-L215
train
honey-comb/core
src/Services/HCMenuService.php
HCMenuService.sortByWeight
private function sortByWeight(array $adminMenu): array { usort($adminMenu, function ($a, $b) { if (!array_key_exists('priority', $a)) { $a['priority'] = 0; } if (!array_key_exists('priority', $b)) { $b['priority'] = 0; } return $b['priority'] <=> $a['priority']; }); foreach ($adminMenu as &$item) { if (array_key_exists('children', $item)) { $item['children'] = $this->sortByWeight($item['children']); } } return $adminMenu; }
php
private function sortByWeight(array $adminMenu): array { usort($adminMenu, function ($a, $b) { if (!array_key_exists('priority', $a)) { $a['priority'] = 0; } if (!array_key_exists('priority', $b)) { $b['priority'] = 0; } return $b['priority'] <=> $a['priority']; }); foreach ($adminMenu as &$item) { if (array_key_exists('children', $item)) { $item['children'] = $this->sortByWeight($item['children']); } } return $adminMenu; }
[ "private", "function", "sortByWeight", "(", "array", "$", "adminMenu", ")", ":", "array", "{", "usort", "(", "$", "adminMenu", ",", "function", "(", "$", "a", ",", "$", "b", ")", "{", "if", "(", "!", "array_key_exists", "(", "'priority'", ",", "$", "...
Sort admin menu by given priority DESC @param array $adminMenu @return array
[ "Sort", "admin", "menu", "by", "given", "priority", "DESC" ]
5c12aba31cae092e9681f0ae3e3664ed3fcec956
https://github.com/honey-comb/core/blob/5c12aba31cae092e9681f0ae3e3664ed3fcec956/src/Services/HCMenuService.php#L82-L103
train
honey-comb/core
src/Services/HCMenuService.php
HCMenuService.getAccessibleMenuItems
private function getAccessibleMenuItems(HCUser $user, array $menus): array { foreach ($menus as $key => $menu) { if (!array_key_exists('aclPermission', $menu) || $user->cannot($menu['aclPermission'])) { unset($menus[$key]); } } return array_values($menus); }
php
private function getAccessibleMenuItems(HCUser $user, array $menus): array { foreach ($menus as $key => $menu) { if (!array_key_exists('aclPermission', $menu) || $user->cannot($menu['aclPermission'])) { unset($menus[$key]); } } return array_values($menus); }
[ "private", "function", "getAccessibleMenuItems", "(", "HCUser", "$", "user", ",", "array", "$", "menus", ")", ":", "array", "{", "foreach", "(", "$", "menus", "as", "$", "key", "=>", "$", "menu", ")", "{", "if", "(", "!", "array_key_exists", "(", "'acl...
Filter acl permissions @param HCUser $user @param array $menus @return array
[ "Filter", "acl", "permissions" ]
5c12aba31cae092e9681f0ae3e3664ed3fcec956
https://github.com/honey-comb/core/blob/5c12aba31cae092e9681f0ae3e3664ed3fcec956/src/Services/HCMenuService.php#L152-L161
train
honey-comb/core
src/Services/HCMenuService.php
HCMenuService.existInArray
private function existInArray($items, $routeName): bool { foreach ($items as $item) { if ($item['route'] == $routeName) { return true; } if (array_key_exists('children', $item)) { $found = $this->existInArray($item['children'], $routeName); if ($found) { return true; } } } return false; }
php
private function existInArray($items, $routeName): bool { foreach ($items as $item) { if ($item['route'] == $routeName) { return true; } if (array_key_exists('children', $item)) { $found = $this->existInArray($item['children'], $routeName); if ($found) { return true; } } } return false; }
[ "private", "function", "existInArray", "(", "$", "items", ",", "$", "routeName", ")", ":", "bool", "{", "foreach", "(", "$", "items", "as", "$", "item", ")", "{", "if", "(", "$", "item", "[", "'route'", "]", "==", "$", "routeName", ")", "{", "retur...
Check if exists in array @param $items @param $routeName @return bool
[ "Check", "if", "exists", "in", "array" ]
5c12aba31cae092e9681f0ae3e3664ed3fcec956
https://github.com/honey-comb/core/blob/5c12aba31cae092e9681f0ae3e3664ed3fcec956/src/Services/HCMenuService.php#L170-L188
train
silverorange/swat
Swat/SwatDetailsViewVerticalField.php
SwatDetailsViewVerticalField.display
public function display($data, $odd) { if (!$this->visible) { return; } $this->odd = $odd; $tr_tag = new SwatHtmlTag('tr'); $tr_tag->id = $this->id; $tr_tag->class = $this->getCSSClassString(); $td_tag = new SwatHtmlTag('td'); $td_tag->colspan = 2; $tr_tag->open(); $td_tag->open(); $this->displayHeader(); $this->displayValue($data); $td_tag->close(); $tr_tag->close(); }
php
public function display($data, $odd) { if (!$this->visible) { return; } $this->odd = $odd; $tr_tag = new SwatHtmlTag('tr'); $tr_tag->id = $this->id; $tr_tag->class = $this->getCSSClassString(); $td_tag = new SwatHtmlTag('td'); $td_tag->colspan = 2; $tr_tag->open(); $td_tag->open(); $this->displayHeader(); $this->displayValue($data); $td_tag->close(); $tr_tag->close(); }
[ "public", "function", "display", "(", "$", "data", ",", "$", "odd", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "$", "this", "->", "odd", "=", "$", "odd", ";", "$", "tr_tag", "=", "new", "SwatHtmlTag", ...
Displays this details view field using a data object @param mixed $data a data object used to display the cell renderers in this field. @param boolean $odd whether this is an odd or even field so alternating style can be applied. @see SwatDetailsViewField::display()
[ "Displays", "this", "details", "view", "field", "using", "a", "data", "object" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsViewVerticalField.php#L25-L46
train