id
int32
0
241k
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
33,400
zeroem/ZeroemCurlBundle
HttpKernel/RemoteHttpKernel.php
RemoteHttpKernel.handleRaw
private function handleRaw(Request $request) { $curl = $this->lastCurlRequest = $this->getCurlRequest(); $curl->setOptionArray( array( CURLOPT_URL=>$request->getUri(), CURLOPT_HTTPHEADER=>$this->buildHeadersArray($request->headers), CURLINFO_HEADER_OUT=>true ) ); $curl->setMethod($request->getMethod()); if ("POST" === $request->getMethod()) { $this->setPostFields($curl, $request); } if("PUT" === $request->getMethod() && count($request->files->all()) > 0) { $file = current($request->files->all()); $curl->setOptionArray( array( CURLOPT_INFILE=>'@'.$file->getRealPath(), CURLOPT_INFILESIZE=>$file->getSize() ) ); } $content = new ContentCollector(); $headers = new HeaderCollector(); // These options must not be tampered with to ensure proper functionality $curl->setOptionArray( array( CURLOPT_HEADERFUNCTION=>array($headers, "collect"), CURLOPT_WRITEFUNCTION=>array($content, "collect"), ) ); $curl->execute(); $response = new Response( $content->retrieve(), $headers->getCode(), $headers->retrieve() ); $response->setProtocolVersion($headers->getVersion()); $response->setStatusCode($headers->getCode(), $headers->getMessage()); return $response; }
php
private function handleRaw(Request $request) { $curl = $this->lastCurlRequest = $this->getCurlRequest(); $curl->setOptionArray( array( CURLOPT_URL=>$request->getUri(), CURLOPT_HTTPHEADER=>$this->buildHeadersArray($request->headers), CURLINFO_HEADER_OUT=>true ) ); $curl->setMethod($request->getMethod()); if ("POST" === $request->getMethod()) { $this->setPostFields($curl, $request); } if("PUT" === $request->getMethod() && count($request->files->all()) > 0) { $file = current($request->files->all()); $curl->setOptionArray( array( CURLOPT_INFILE=>'@'.$file->getRealPath(), CURLOPT_INFILESIZE=>$file->getSize() ) ); } $content = new ContentCollector(); $headers = new HeaderCollector(); // These options must not be tampered with to ensure proper functionality $curl->setOptionArray( array( CURLOPT_HEADERFUNCTION=>array($headers, "collect"), CURLOPT_WRITEFUNCTION=>array($content, "collect"), ) ); $curl->execute(); $response = new Response( $content->retrieve(), $headers->getCode(), $headers->retrieve() ); $response->setProtocolVersion($headers->getVersion()); $response->setStatusCode($headers->getCode(), $headers->getMessage()); return $response; }
[ "private", "function", "handleRaw", "(", "Request", "$", "request", ")", "{", "$", "curl", "=", "$", "this", "->", "lastCurlRequest", "=", "$", "this", "->", "getCurlRequest", "(", ")", ";", "$", "curl", "->", "setOptionArray", "(", "array", "(", "CURLOPT_URL", "=>", "$", "request", "->", "getUri", "(", ")", ",", "CURLOPT_HTTPHEADER", "=>", "$", "this", "->", "buildHeadersArray", "(", "$", "request", "->", "headers", ")", ",", "CURLINFO_HEADER_OUT", "=>", "true", ")", ")", ";", "$", "curl", "->", "setMethod", "(", "$", "request", "->", "getMethod", "(", ")", ")", ";", "if", "(", "\"POST\"", "===", "$", "request", "->", "getMethod", "(", ")", ")", "{", "$", "this", "->", "setPostFields", "(", "$", "curl", ",", "$", "request", ")", ";", "}", "if", "(", "\"PUT\"", "===", "$", "request", "->", "getMethod", "(", ")", "&&", "count", "(", "$", "request", "->", "files", "->", "all", "(", ")", ")", ">", "0", ")", "{", "$", "file", "=", "current", "(", "$", "request", "->", "files", "->", "all", "(", ")", ")", ";", "$", "curl", "->", "setOptionArray", "(", "array", "(", "CURLOPT_INFILE", "=>", "'@'", ".", "$", "file", "->", "getRealPath", "(", ")", ",", "CURLOPT_INFILESIZE", "=>", "$", "file", "->", "getSize", "(", ")", ")", ")", ";", "}", "$", "content", "=", "new", "ContentCollector", "(", ")", ";", "$", "headers", "=", "new", "HeaderCollector", "(", ")", ";", "// These options must not be tampered with to ensure proper functionality", "$", "curl", "->", "setOptionArray", "(", "array", "(", "CURLOPT_HEADERFUNCTION", "=>", "array", "(", "$", "headers", ",", "\"collect\"", ")", ",", "CURLOPT_WRITEFUNCTION", "=>", "array", "(", "$", "content", ",", "\"collect\"", ")", ",", ")", ")", ";", "$", "curl", "->", "execute", "(", ")", ";", "$", "response", "=", "new", "Response", "(", "$", "content", "->", "retrieve", "(", ")", ",", "$", "headers", "->", "getCode", "(", ")", ",", "$", "headers", "->", "retrieve", "(", ")", ")", ";", "$", "response", "->", "setProtocolVersion", "(", "$", "headers", "->", "getVersion", "(", ")", ")", ";", "$", "response", "->", "setStatusCode", "(", "$", "headers", "->", "getCode", "(", ")", ",", "$", "headers", "->", "getMessage", "(", ")", ")", ";", "return", "$", "response", ";", "}" ]
Execute a Request object via cURL @param Request $request the request to execute @param array $options additional curl options to set/override @return Response @throws CurlErrorException
[ "Execute", "a", "Request", "object", "via", "cURL" ]
1045e2093bec5a013ff9458828721e581725f1a0
https://github.com/zeroem/ZeroemCurlBundle/blob/1045e2093bec5a013ff9458828721e581725f1a0/HttpKernel/RemoteHttpKernel.php#L100-L150
33,401
zeroem/ZeroemCurlBundle
HttpKernel/RemoteHttpKernel.php
RemoteHttpKernel.setPostFields
private function setPostFields(CurlRequest $curl, Request $request) { $postfields = null; $content = $request->getContent(); if (!empty($content)) { $postfields = $content; } else if (count($request->request->all()) > 0) { $postfields = $request->request->all(); } $curl->setOption(CURLOPT_POSTFIELDS, $postfields); }
php
private function setPostFields(CurlRequest $curl, Request $request) { $postfields = null; $content = $request->getContent(); if (!empty($content)) { $postfields = $content; } else if (count($request->request->all()) > 0) { $postfields = $request->request->all(); } $curl->setOption(CURLOPT_POSTFIELDS, $postfields); }
[ "private", "function", "setPostFields", "(", "CurlRequest", "$", "curl", ",", "Request", "$", "request", ")", "{", "$", "postfields", "=", "null", ";", "$", "content", "=", "$", "request", "->", "getContent", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "content", ")", ")", "{", "$", "postfields", "=", "$", "content", ";", "}", "else", "if", "(", "count", "(", "$", "request", "->", "request", "->", "all", "(", ")", ")", ">", "0", ")", "{", "$", "postfields", "=", "$", "request", "->", "request", "->", "all", "(", ")", ";", "}", "$", "curl", "->", "setOption", "(", "CURLOPT_POSTFIELDS", ",", "$", "postfields", ")", ";", "}" ]
Populate the POSTFIELDS option @param CurlRequest $curl cURL request object @param Request $request the Request object we're populating
[ "Populate", "the", "POSTFIELDS", "option" ]
1045e2093bec5a013ff9458828721e581725f1a0
https://github.com/zeroem/ZeroemCurlBundle/blob/1045e2093bec5a013ff9458828721e581725f1a0/HttpKernel/RemoteHttpKernel.php#L159-L170
33,402
silverorange/swat
Swat/SwatBooleanCellRenderer.php
SwatBooleanCellRenderer.setFromStock
public function setFromStock($stock_id, $overwrite_properties = true) { $content_type = 'text/plain'; switch ($stock_id) { case 'yes-no': $false_content = Swat::_('No'); $true_content = Swat::_('Yes'); break; case 'check-only': $content_type = 'text/xml'; $false_content = ' '; // non-breaking space ob_start(); $this->displayCheck(); $true_content = ob_get_clean(); break; default: throw new SwatUndefinedStockTypeException( "Stock type with id of '{$stock_id}' not found.", 0, $stock_id ); } if ($overwrite_properties || $this->false_content === null) { $this->false_content = $false_content; } if ($overwrite_properties || $this->true_content === null) { $this->true_content = $true_content; } if ($overwrite_properties || $this->content_type === null) { $this->content_type = $content_type; } }
php
public function setFromStock($stock_id, $overwrite_properties = true) { $content_type = 'text/plain'; switch ($stock_id) { case 'yes-no': $false_content = Swat::_('No'); $true_content = Swat::_('Yes'); break; case 'check-only': $content_type = 'text/xml'; $false_content = ' '; // non-breaking space ob_start(); $this->displayCheck(); $true_content = ob_get_clean(); break; default: throw new SwatUndefinedStockTypeException( "Stock type with id of '{$stock_id}' not found.", 0, $stock_id ); } if ($overwrite_properties || $this->false_content === null) { $this->false_content = $false_content; } if ($overwrite_properties || $this->true_content === null) { $this->true_content = $true_content; } if ($overwrite_properties || $this->content_type === null) { $this->content_type = $content_type; } }
[ "public", "function", "setFromStock", "(", "$", "stock_id", ",", "$", "overwrite_properties", "=", "true", ")", "{", "$", "content_type", "=", "'text/plain'", ";", "switch", "(", "$", "stock_id", ")", "{", "case", "'yes-no'", ":", "$", "false_content", "=", "Swat", "::", "_", "(", "'No'", ")", ";", "$", "true_content", "=", "Swat", "::", "_", "(", "'Yes'", ")", ";", "break", ";", "case", "'check-only'", ":", "$", "content_type", "=", "'text/xml'", ";", "$", "false_content", "=", "' ';", " ", "/ non-breaking space", "ob_start", "(", ")", ";", "$", "this", "->", "displayCheck", "(", ")", ";", "$", "true_content", "=", "ob_get_clean", "(", ")", ";", "break", ";", "default", ":", "throw", "new", "SwatUndefinedStockTypeException", "(", "\"Stock type with id of '{$stock_id}' not found.\"", ",", "0", ",", "$", "stock_id", ")", ";", "}", "if", "(", "$", "overwrite_properties", "||", "$", "this", "->", "false_content", "===", "null", ")", "{", "$", "this", "->", "false_content", "=", "$", "false_content", ";", "}", "if", "(", "$", "overwrite_properties", "||", "$", "this", "->", "true_content", "===", "null", ")", "{", "$", "this", "->", "true_content", "=", "$", "true_content", ";", "}", "if", "(", "$", "overwrite_properties", "||", "$", "this", "->", "content_type", "===", "null", ")", "{", "$", "this", "->", "content_type", "=", "$", "content_type", ";", "}", "}" ]
Sets the values of this boolean cell renderer to a stock type Valid stock type ids are: - check-only - yes-no @param string $stock_id the identifier of the stock type to use. @param boolean $overwrite_properties optional. Whether to overwrite properties if they are already set. By default, properties are overwritten. @throws SwatUndefinedStockTypeException if an undefined <i>$stock_id</i> is used.
[ "Sets", "the", "values", "of", "this", "boolean", "cell", "renderer", "to", "a", "stock", "type" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatBooleanCellRenderer.php#L78-L116
33,403
silverorange/swat
Swat/SwatBooleanCellRenderer.php
SwatBooleanCellRenderer.displayCheck
protected function displayCheck() { $image_tag = new SwatHtmlTag('img'); $image_tag->src = 'packages/swat/images/check.png'; $image_tag->alt = Swat::_('Yes'); $image_tag->height = '14'; $image_tag->width = '14'; $image_tag->display(); }
php
protected function displayCheck() { $image_tag = new SwatHtmlTag('img'); $image_tag->src = 'packages/swat/images/check.png'; $image_tag->alt = Swat::_('Yes'); $image_tag->height = '14'; $image_tag->width = '14'; $image_tag->display(); }
[ "protected", "function", "displayCheck", "(", ")", "{", "$", "image_tag", "=", "new", "SwatHtmlTag", "(", "'img'", ")", ";", "$", "image_tag", "->", "src", "=", "'packages/swat/images/check.png'", ";", "$", "image_tag", "->", "alt", "=", "Swat", "::", "_", "(", "'Yes'", ")", ";", "$", "image_tag", "->", "height", "=", "'14'", ";", "$", "image_tag", "->", "width", "=", "'14'", ";", "$", "image_tag", "->", "display", "(", ")", ";", "}" ]
Renders a checkmark image for this boolean cell renderer This is used when this cell renderer has a {@link SwatBooleanCellRenderer::$stock_id} of 'check-only'.
[ "Renders", "a", "checkmark", "image", "for", "this", "boolean", "cell", "renderer" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatBooleanCellRenderer.php#L211-L219
33,404
rollun-com/rollun-datastore
src/DataStore/src/DataStore/Cacheable.php
Cacheable.update
public function update($itemData, $createIfAbsent = false) { if ($createIfAbsent) { trigger_error("Option 'createIfAbsent' is no more use.", E_DEPRECATED); } if (method_exists($this->dataSource, "update")) { return $this->dataSource->update($itemData, $createIfAbsent); } else { throw new DataStoreException("Refreshable don't haw method update"); } }
php
public function update($itemData, $createIfAbsent = false) { if ($createIfAbsent) { trigger_error("Option 'createIfAbsent' is no more use.", E_DEPRECATED); } if (method_exists($this->dataSource, "update")) { return $this->dataSource->update($itemData, $createIfAbsent); } else { throw new DataStoreException("Refreshable don't haw method update"); } }
[ "public", "function", "update", "(", "$", "itemData", ",", "$", "createIfAbsent", "=", "false", ")", "{", "if", "(", "$", "createIfAbsent", ")", "{", "trigger_error", "(", "\"Option 'createIfAbsent' is no more use.\"", ",", "E_DEPRECATED", ")", ";", "}", "if", "(", "method_exists", "(", "$", "this", "->", "dataSource", ",", "\"update\"", ")", ")", "{", "return", "$", "this", "->", "dataSource", "->", "update", "(", "$", "itemData", ",", "$", "createIfAbsent", ")", ";", "}", "else", "{", "throw", "new", "DataStoreException", "(", "\"Refreshable don't haw method update\"", ")", ";", "}", "}" ]
By default, update existing Item. If item with PrimaryKey == $item["id"] is existing in store, item will update. Fields which don't present in $item will not change in item in store.<br> Method will return updated item<br> <br> If $item["id"] isn't set - method will throw exception.<br> <br> If item with PrimaryKey == $item["id"] is absent - method will throw exception,<br> but if $createIfAbsent = true item will be created and method return inserted item<br> <br> @param array $itemData associated array with PrimaryKey @param bool $createIfAbsent @return array updated item or inserted item @throws DataStoreException
[ "By", "default", "update", "existing", "Item", "." ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/Cacheable.php#L165-L176
33,405
rollun-com/rollun-datastore
src/DataStore/src/DataStore/Cacheable.php
Cacheable.publicdelete
public function publicdelete($id) { if (method_exists($this->dataSource, "delete")) { return $this->dataSource->delete($id); } else { throw new DataStoreException("Refreshable don't haw method delete"); } }
php
public function publicdelete($id) { if (method_exists($this->dataSource, "delete")) { return $this->dataSource->delete($id); } else { throw new DataStoreException("Refreshable don't haw method delete"); } }
[ "public", "function", "publicdelete", "(", "$", "id", ")", "{", "if", "(", "method_exists", "(", "$", "this", "->", "dataSource", ",", "\"delete\"", ")", ")", "{", "return", "$", "this", "->", "dataSource", "->", "delete", "(", "$", "id", ")", ";", "}", "else", "{", "throw", "new", "DataStoreException", "(", "\"Refreshable don't haw method delete\"", ")", ";", "}", "}" ]
Delete Item by id. Method do nothing if item with that id is absent. @param int|string $id PrimaryKey @return int number of deleted items: 0 , 1 or null if object doesn't support it @throws DataStoreException
[ "Delete", "Item", "by", "id", ".", "Method", "do", "nothing", "if", "item", "with", "that", "id", "is", "absent", "." ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/Cacheable.php#L185-L192
33,406
brainworxx/kreXX
src/View/Output/File.php
File.finalize
public function finalize() { // Output our chunks. // Every output is split into 4 chunk strings (header, messages, // data, footer). foreach ($this->chunkStrings as $chunkString) { // Save everything to the file after we are done. $this->pool->chunks->saveDechunkedToFile($chunkString); } }
php
public function finalize() { // Output our chunks. // Every output is split into 4 chunk strings (header, messages, // data, footer). foreach ($this->chunkStrings as $chunkString) { // Save everything to the file after we are done. $this->pool->chunks->saveDechunkedToFile($chunkString); } }
[ "public", "function", "finalize", "(", ")", "{", "// Output our chunks.", "// Every output is split into 4 chunk strings (header, messages,", "// data, footer).", "foreach", "(", "$", "this", "->", "chunkStrings", "as", "$", "chunkString", ")", "{", "// Save everything to the file after we are done.", "$", "this", "->", "pool", "->", "chunks", "->", "saveDechunkedToFile", "(", "$", "chunkString", ")", ";", "}", "}" ]
Creating the logfile after the analysis.
[ "Creating", "the", "logfile", "after", "the", "analysis", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/Output/File.php#L79-L88
33,407
TeknooSoftware/states
demo/Acme/Extendable/GrandDaughter/GrandDaughter.php
GrandDaughter.listMethodsByStates
public function listMethodsByStates() { $methodsList = array(); foreach ($this->getStatesList() as $stateName => $stateContainer) { $methodsList[$stateName] = $stateContainer->listMethods(); } ksort($methodsList); return $methodsList; }
php
public function listMethodsByStates() { $methodsList = array(); foreach ($this->getStatesList() as $stateName => $stateContainer) { $methodsList[$stateName] = $stateContainer->listMethods(); } ksort($methodsList); return $methodsList; }
[ "public", "function", "listMethodsByStates", "(", ")", "{", "$", "methodsList", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "getStatesList", "(", ")", "as", "$", "stateName", "=>", "$", "stateContainer", ")", "{", "$", "methodsList", "[", "$", "stateName", "]", "=", "$", "stateContainer", "->", "listMethods", "(", ")", ";", "}", "ksort", "(", "$", "methodsList", ")", ";", "return", "$", "methodsList", ";", "}" ]
Return the list of available state in this class. @return array
[ "Return", "the", "list", "of", "available", "state", "in", "this", "class", "." ]
0c675b768781ee3a3a15c2663cffec5d50c1d5fd
https://github.com/TeknooSoftware/states/blob/0c675b768781ee3a3a15c2663cffec5d50c1d5fd/demo/Acme/Extendable/GrandDaughter/GrandDaughter.php#L53-L63
33,408
silverorange/swat
Swat/SwatProgressBar.php
SwatProgressBar.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(); $this->displayBar(); $this->displayText(); $div_tag->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
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(); $this->displayBar(); $this->displayText(); $div_tag->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
[ "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", "(", ")", ";", "$", "this", "->", "displayBar", "(", ")", ";", "$", "this", "->", "displayText", "(", ")", ";", "$", "div_tag", "->", "close", "(", ")", ";", "Swat", "::", "displayInlineJavaScript", "(", "$", "this", "->", "getInlineJavaScript", "(", ")", ")", ";", "}" ]
Displays this progress bar @throws SwatException if this progress bar's <i>$length</i> property is not a valid cascading style-sheet dimension.
[ "Displays", "this", "progress", "bar" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatProgressBar.php#L153-L173
33,409
silverorange/swat
Swat/SwatProgressBar.php
SwatProgressBar.displayBar
protected function displayBar() { // ensure length is in cascading style-sheet units $dimension_pattern = '/([0-9]+(%|p[xtc]|e[mx]|in|[cm]m|)|auto)/'; if (preg_match($dimension_pattern, $this->length) === 0) { throw new SwatException( sprintf( '$length must be specified in ' . 'cascading style-sheet units. Value was: %s', $this->length ) ); } $bar_div_tag = new SwatHtmlTag('div'); $bar_div_tag->id = "{$this->id}_bar"; $bar_div_tag->class = 'swat-progress-bar-bar'; $full_div_tag = new SwatHtmlTag('div'); $full_div_tag->id = "{$this->id}_full"; $full_div_tag->class = 'swat-progress-bar-full'; $full_div_tag->setContent(''); $empty_div_tag = new SwatHtmlTag('div'); $empty_div_tag->id = "{$this->id}_empty"; $empty_div_tag->class = 'swat-progress-bar-empty'; $empty_div_tag->setContent(''); $full_length = min(100, round($this->value * 100, 4)); $full_length = sprintf('%s%%', $full_length); $empty_length = max(0, round(100 - $this->value * 100, 4)); $empty_length = sprintf('%s%%', $empty_length); switch ($this->orientation) { case self::ORIENTATION_LEFT_TO_RIGHT: default: $bar_div_tag->class .= ' swat-progress-bar-left-to-right'; $bar_div_tag->style = sprintf('width: %s;', $this->length); $full_div_tag->style = sprintf('width: %s;', $full_length); $empty_div_tag->style = sprintf('width: %s;', $empty_length); break; case self::ORIENTATION_RIGHT_TO_LEFT: $bar_div_tag->class .= ' swat-progress-bar-right-to-left'; $bar_div_tag->style = sprintf('width: %s;', $this->length); $full_div_tag->style = sprintf('width: %s;', $full_length); $empty_div_tag->style = sprintf('width: %s;', $empty_length); break; case self::ORIENTATION_BOTTOM_TO_TOP: $bar_div_tag->class .= ' swat-progress-bar-bottom-to-top'; $bar_div_tag->style = sprintf('height: %s;', $this->length); $full_div_tag->style = sprintf( 'height: %s; top: %s;', $full_length, $empty_length ); $empty_div_tag->style = sprintf( 'height: %s; top: -%s;', $empty_length, $full_length ); break; case self::ORIENTATION_TOP_TO_BOTTOM: $bar_div_tag->class .= ' swat-progress-bar-top-to-bottom'; $bar_div_tag->style = sprintf('height: %s;', $this->length); $full_div_tag->style = sprintf('height: %s;', $full_length); $empty_div_tag->style = sprintf('height: %s;', $empty_length); break; } $bar_div_tag->open(); $full_div_tag->display(); $empty_div_tag->display(); $bar_div_tag->close(); }
php
protected function displayBar() { // ensure length is in cascading style-sheet units $dimension_pattern = '/([0-9]+(%|p[xtc]|e[mx]|in|[cm]m|)|auto)/'; if (preg_match($dimension_pattern, $this->length) === 0) { throw new SwatException( sprintf( '$length must be specified in ' . 'cascading style-sheet units. Value was: %s', $this->length ) ); } $bar_div_tag = new SwatHtmlTag('div'); $bar_div_tag->id = "{$this->id}_bar"; $bar_div_tag->class = 'swat-progress-bar-bar'; $full_div_tag = new SwatHtmlTag('div'); $full_div_tag->id = "{$this->id}_full"; $full_div_tag->class = 'swat-progress-bar-full'; $full_div_tag->setContent(''); $empty_div_tag = new SwatHtmlTag('div'); $empty_div_tag->id = "{$this->id}_empty"; $empty_div_tag->class = 'swat-progress-bar-empty'; $empty_div_tag->setContent(''); $full_length = min(100, round($this->value * 100, 4)); $full_length = sprintf('%s%%', $full_length); $empty_length = max(0, round(100 - $this->value * 100, 4)); $empty_length = sprintf('%s%%', $empty_length); switch ($this->orientation) { case self::ORIENTATION_LEFT_TO_RIGHT: default: $bar_div_tag->class .= ' swat-progress-bar-left-to-right'; $bar_div_tag->style = sprintf('width: %s;', $this->length); $full_div_tag->style = sprintf('width: %s;', $full_length); $empty_div_tag->style = sprintf('width: %s;', $empty_length); break; case self::ORIENTATION_RIGHT_TO_LEFT: $bar_div_tag->class .= ' swat-progress-bar-right-to-left'; $bar_div_tag->style = sprintf('width: %s;', $this->length); $full_div_tag->style = sprintf('width: %s;', $full_length); $empty_div_tag->style = sprintf('width: %s;', $empty_length); break; case self::ORIENTATION_BOTTOM_TO_TOP: $bar_div_tag->class .= ' swat-progress-bar-bottom-to-top'; $bar_div_tag->style = sprintf('height: %s;', $this->length); $full_div_tag->style = sprintf( 'height: %s; top: %s;', $full_length, $empty_length ); $empty_div_tag->style = sprintf( 'height: %s; top: -%s;', $empty_length, $full_length ); break; case self::ORIENTATION_TOP_TO_BOTTOM: $bar_div_tag->class .= ' swat-progress-bar-top-to-bottom'; $bar_div_tag->style = sprintf('height: %s;', $this->length); $full_div_tag->style = sprintf('height: %s;', $full_length); $empty_div_tag->style = sprintf('height: %s;', $empty_length); break; } $bar_div_tag->open(); $full_div_tag->display(); $empty_div_tag->display(); $bar_div_tag->close(); }
[ "protected", "function", "displayBar", "(", ")", "{", "// ensure length is in cascading style-sheet units", "$", "dimension_pattern", "=", "'/([0-9]+(%|p[xtc]|e[mx]|in|[cm]m|)|auto)/'", ";", "if", "(", "preg_match", "(", "$", "dimension_pattern", ",", "$", "this", "->", "length", ")", "===", "0", ")", "{", "throw", "new", "SwatException", "(", "sprintf", "(", "'$length must be specified in '", ".", "'cascading style-sheet units. Value was: %s'", ",", "$", "this", "->", "length", ")", ")", ";", "}", "$", "bar_div_tag", "=", "new", "SwatHtmlTag", "(", "'div'", ")", ";", "$", "bar_div_tag", "->", "id", "=", "\"{$this->id}_bar\"", ";", "$", "bar_div_tag", "->", "class", "=", "'swat-progress-bar-bar'", ";", "$", "full_div_tag", "=", "new", "SwatHtmlTag", "(", "'div'", ")", ";", "$", "full_div_tag", "->", "id", "=", "\"{$this->id}_full\"", ";", "$", "full_div_tag", "->", "class", "=", "'swat-progress-bar-full'", ";", "$", "full_div_tag", "->", "setContent", "(", "''", ")", ";", "$", "empty_div_tag", "=", "new", "SwatHtmlTag", "(", "'div'", ")", ";", "$", "empty_div_tag", "->", "id", "=", "\"{$this->id}_empty\"", ";", "$", "empty_div_tag", "->", "class", "=", "'swat-progress-bar-empty'", ";", "$", "empty_div_tag", "->", "setContent", "(", "''", ")", ";", "$", "full_length", "=", "min", "(", "100", ",", "round", "(", "$", "this", "->", "value", "*", "100", ",", "4", ")", ")", ";", "$", "full_length", "=", "sprintf", "(", "'%s%%'", ",", "$", "full_length", ")", ";", "$", "empty_length", "=", "max", "(", "0", ",", "round", "(", "100", "-", "$", "this", "->", "value", "*", "100", ",", "4", ")", ")", ";", "$", "empty_length", "=", "sprintf", "(", "'%s%%'", ",", "$", "empty_length", ")", ";", "switch", "(", "$", "this", "->", "orientation", ")", "{", "case", "self", "::", "ORIENTATION_LEFT_TO_RIGHT", ":", "default", ":", "$", "bar_div_tag", "->", "class", ".=", "' swat-progress-bar-left-to-right'", ";", "$", "bar_div_tag", "->", "style", "=", "sprintf", "(", "'width: %s;'", ",", "$", "this", "->", "length", ")", ";", "$", "full_div_tag", "->", "style", "=", "sprintf", "(", "'width: %s;'", ",", "$", "full_length", ")", ";", "$", "empty_div_tag", "->", "style", "=", "sprintf", "(", "'width: %s;'", ",", "$", "empty_length", ")", ";", "break", ";", "case", "self", "::", "ORIENTATION_RIGHT_TO_LEFT", ":", "$", "bar_div_tag", "->", "class", ".=", "' swat-progress-bar-right-to-left'", ";", "$", "bar_div_tag", "->", "style", "=", "sprintf", "(", "'width: %s;'", ",", "$", "this", "->", "length", ")", ";", "$", "full_div_tag", "->", "style", "=", "sprintf", "(", "'width: %s;'", ",", "$", "full_length", ")", ";", "$", "empty_div_tag", "->", "style", "=", "sprintf", "(", "'width: %s;'", ",", "$", "empty_length", ")", ";", "break", ";", "case", "self", "::", "ORIENTATION_BOTTOM_TO_TOP", ":", "$", "bar_div_tag", "->", "class", ".=", "' swat-progress-bar-bottom-to-top'", ";", "$", "bar_div_tag", "->", "style", "=", "sprintf", "(", "'height: %s;'", ",", "$", "this", "->", "length", ")", ";", "$", "full_div_tag", "->", "style", "=", "sprintf", "(", "'height: %s; top: %s;'", ",", "$", "full_length", ",", "$", "empty_length", ")", ";", "$", "empty_div_tag", "->", "style", "=", "sprintf", "(", "'height: %s; top: -%s;'", ",", "$", "empty_length", ",", "$", "full_length", ")", ";", "break", ";", "case", "self", "::", "ORIENTATION_TOP_TO_BOTTOM", ":", "$", "bar_div_tag", "->", "class", ".=", "' swat-progress-bar-top-to-bottom'", ";", "$", "bar_div_tag", "->", "style", "=", "sprintf", "(", "'height: %s;'", ",", "$", "this", "->", "length", ")", ";", "$", "full_div_tag", "->", "style", "=", "sprintf", "(", "'height: %s;'", ",", "$", "full_length", ")", ";", "$", "empty_div_tag", "->", "style", "=", "sprintf", "(", "'height: %s;'", ",", "$", "empty_length", ")", ";", "break", ";", "}", "$", "bar_div_tag", "->", "open", "(", ")", ";", "$", "full_div_tag", "->", "display", "(", ")", ";", "$", "empty_div_tag", "->", "display", "(", ")", ";", "$", "bar_div_tag", "->", "close", "(", ")", ";", "}" ]
Displays the bar part of this progress bar @throws SwatException if this progress bar's <i>$length</i> property is not a valid cascading style-sheet dimension.
[ "Displays", "the", "bar", "part", "of", "this", "progress", "bar" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatProgressBar.php#L184-L263
33,410
silverorange/swat
Swat/SwatProgressBar.php
SwatProgressBar.displayText
protected function displayText() { if ($this->text === null) { // still show an empty span if there is no text for this // progress bar $text = ''; } else { if ($this->text_value === null) { $text = $this->text; } elseif (is_array($this->text_value)) { $text = vsprintf($this->text, $this->text_value); } else { $text = sprintf($this->text, $this->text_value); } } $span_tag = new SwatHtmlTag('span'); $span_tag->id = $this->id . '_text'; $span_tag->class = 'swat-progress-bar-text'; $span_tag->setContent($text, $this->content_type); $span_tag->display(); }
php
protected function displayText() { if ($this->text === null) { // still show an empty span if there is no text for this // progress bar $text = ''; } else { if ($this->text_value === null) { $text = $this->text; } elseif (is_array($this->text_value)) { $text = vsprintf($this->text, $this->text_value); } else { $text = sprintf($this->text, $this->text_value); } } $span_tag = new SwatHtmlTag('span'); $span_tag->id = $this->id . '_text'; $span_tag->class = 'swat-progress-bar-text'; $span_tag->setContent($text, $this->content_type); $span_tag->display(); }
[ "protected", "function", "displayText", "(", ")", "{", "if", "(", "$", "this", "->", "text", "===", "null", ")", "{", "// still show an empty span if there is no text for this", "// progress bar", "$", "text", "=", "''", ";", "}", "else", "{", "if", "(", "$", "this", "->", "text_value", "===", "null", ")", "{", "$", "text", "=", "$", "this", "->", "text", ";", "}", "elseif", "(", "is_array", "(", "$", "this", "->", "text_value", ")", ")", "{", "$", "text", "=", "vsprintf", "(", "$", "this", "->", "text", ",", "$", "this", "->", "text_value", ")", ";", "}", "else", "{", "$", "text", "=", "sprintf", "(", "$", "this", "->", "text", ",", "$", "this", "->", "text_value", ")", ";", "}", "}", "$", "span_tag", "=", "new", "SwatHtmlTag", "(", "'span'", ")", ";", "$", "span_tag", "->", "id", "=", "$", "this", "->", "id", ".", "'_text'", ";", "$", "span_tag", "->", "class", "=", "'swat-progress-bar-text'", ";", "$", "span_tag", "->", "setContent", "(", "$", "text", ",", "$", "this", "->", "content_type", ")", ";", "$", "span_tag", "->", "display", "(", ")", ";", "}" ]
Displays the text part of this progress bar
[ "Displays", "the", "text", "part", "of", "this", "progress", "bar" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatProgressBar.php#L271-L292
33,411
silverorange/swat
Swat/SwatProgressBar.php
SwatProgressBar.getInlineJavaScript
protected function getInlineJavaScript() { return sprintf( "var %s_obj = new SwatProgressBar('%s', %s, %s);", $this->id, $this->id, $this->orientation, $this->value ); }
php
protected function getInlineJavaScript() { return sprintf( "var %s_obj = new SwatProgressBar('%s', %s, %s);", $this->id, $this->id, $this->orientation, $this->value ); }
[ "protected", "function", "getInlineJavaScript", "(", ")", "{", "return", "sprintf", "(", "\"var %s_obj = new SwatProgressBar('%s', %s, %s);\"", ",", "$", "this", "->", "id", ",", "$", "this", "->", "id", ",", "$", "this", "->", "orientation", ",", "$", "this", "->", "value", ")", ";", "}" ]
Gets inline JavaScript for this progress bar @return string inline JavaScript for this progress bar.
[ "Gets", "inline", "JavaScript", "for", "this", "progress", "bar" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatProgressBar.php#L302-L311
33,412
neos/composer-plugin
Classes/Installer.php
Installer.camelCaseFlowPackageType
protected function camelCaseFlowPackageType($flowPackageType) { $packageTypeParts = explode('-', $flowPackageType); $packageTypeParts = array_map('ucfirst', $packageTypeParts); return implode('', $packageTypeParts); }
php
protected function camelCaseFlowPackageType($flowPackageType) { $packageTypeParts = explode('-', $flowPackageType); $packageTypeParts = array_map('ucfirst', $packageTypeParts); return implode('', $packageTypeParts); }
[ "protected", "function", "camelCaseFlowPackageType", "(", "$", "flowPackageType", ")", "{", "$", "packageTypeParts", "=", "explode", "(", "'-'", ",", "$", "flowPackageType", ")", ";", "$", "packageTypeParts", "=", "array_map", "(", "'ucfirst'", ",", "$", "packageTypeParts", ")", ";", "return", "implode", "(", "''", ",", "$", "packageTypeParts", ")", ";", "}" ]
Camel case the flow package type. "framework" => "Framework" "some-project" => "SomeProject" @param string $flowPackageType @return string
[ "Camel", "case", "the", "flow", "package", "type", ".", "framework", "=", ">", "Framework", "some", "-", "project", "=", ">", "SomeProject" ]
fe4a2b526cc784032d53f6229ef34d7304a5d13d
https://github.com/neos/composer-plugin/blob/fe4a2b526cc784032d53f6229ef34d7304a5d13d/Classes/Installer.php#L83-L88
33,413
neos/composer-plugin
Classes/Installer.php
Installer.replacePlaceholdersInPath
protected function replacePlaceholdersInPath($path, $arguments) { foreach ($arguments as $argumentName => $argumentValue) { $path = str_replace('{' . $argumentName . '}', $argumentValue, $path); } return $path; }
php
protected function replacePlaceholdersInPath($path, $arguments) { foreach ($arguments as $argumentName => $argumentValue) { $path = str_replace('{' . $argumentName . '}', $argumentValue, $path); } return $path; }
[ "protected", "function", "replacePlaceholdersInPath", "(", "$", "path", ",", "$", "arguments", ")", "{", "foreach", "(", "$", "arguments", "as", "$", "argumentName", "=>", "$", "argumentValue", ")", "{", "$", "path", "=", "str_replace", "(", "'{'", ".", "$", "argumentName", ".", "'}'", ",", "$", "argumentValue", ",", "$", "path", ")", ";", "}", "return", "$", "path", ";", "}" ]
Replace placeholders in the install path. @param string $path @param array $arguments @return string
[ "Replace", "placeholders", "in", "the", "install", "path", "." ]
fe4a2b526cc784032d53f6229ef34d7304a5d13d
https://github.com/neos/composer-plugin/blob/fe4a2b526cc784032d53f6229ef34d7304a5d13d/Classes/Installer.php#L97-L104
33,414
neos/composer-plugin
Classes/Installer.php
Installer.getFlowPackageType
protected function getFlowPackageType($composerPackageType) { foreach ($this->allowedPackageTypePrefixes as $allowedPackagePrefix) { $packagePrefixPosition = strpos($composerPackageType, $allowedPackagePrefix); if ($packagePrefixPosition === 0) { return substr($composerPackageType, strlen($allowedPackagePrefix)); } } return false; }
php
protected function getFlowPackageType($composerPackageType) { foreach ($this->allowedPackageTypePrefixes as $allowedPackagePrefix) { $packagePrefixPosition = strpos($composerPackageType, $allowedPackagePrefix); if ($packagePrefixPosition === 0) { return substr($composerPackageType, strlen($allowedPackagePrefix)); } } return false; }
[ "protected", "function", "getFlowPackageType", "(", "$", "composerPackageType", ")", "{", "foreach", "(", "$", "this", "->", "allowedPackageTypePrefixes", "as", "$", "allowedPackagePrefix", ")", "{", "$", "packagePrefixPosition", "=", "strpos", "(", "$", "composerPackageType", ",", "$", "allowedPackagePrefix", ")", ";", "if", "(", "$", "packagePrefixPosition", "===", "0", ")", "{", "return", "substr", "(", "$", "composerPackageType", ",", "strlen", "(", "$", "allowedPackagePrefix", ")", ")", ";", "}", "}", "return", "false", ";", "}" ]
Gets the Flow package type based on the given composer package type. "typo3-flow-framework" would return "framework". Returns FALSE if the given composerPackageType is not a Flow package type. @param string $composerPackageType @return bool|string
[ "Gets", "the", "Flow", "package", "type", "based", "on", "the", "given", "composer", "package", "type", ".", "typo3", "-", "flow", "-", "framework", "would", "return", "framework", ".", "Returns", "FALSE", "if", "the", "given", "composerPackageType", "is", "not", "a", "Flow", "package", "type", "." ]
fe4a2b526cc784032d53f6229ef34d7304a5d13d
https://github.com/neos/composer-plugin/blob/fe4a2b526cc784032d53f6229ef34d7304a5d13d/Classes/Installer.php#L113-L123
33,415
brainworxx/kreXX
src/Analyse/Callback/Analyse/Objects.php
Objects.callMe
public function callMe() { $output = $this->pool->render->renderSingeChildHr() . $this->dispatchStartEvent(); $ref = $this->parameters[static::PARAM_REF] = new ReflectionClass($this->parameters[static::PARAM_DATA]); // Dumping public properties. $output .= $this->dumpStuff('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects\\PublicProperties'); // Dumping getter methods. // We will not dump the getters for internal classes, though. if ($this->pool->config->getSetting(Fallback::SETTING_ANALYSE_GETTER) === true && $ref->isUserDefined() === true ) { $output .= $this->dumpStuff('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects\\Getter'); } // When analysing an error object, get the backtrace and then analyse it. $output .= $this->dumpStuff('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects\\ErrorObject'); // Dumping protected properties. if ($this->pool->config->getSetting(Fallback::SETTING_ANALYSE_PROTECTED) === true || $this->pool->scope->isInScope() === true ) { $output .= $this->dumpStuff('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects\\ProtectedProperties'); } // Dumping private properties. if ($this->pool->config->getSetting(Fallback::SETTING_ANALYSE_PRIVATE) === true || $this->pool->scope->isInScope() === true ) { $output .= $this->dumpStuff('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects\\PrivateProperties'); } // Dumping class constants. $output .= $this->dumpStuff('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects\\Constants'); // Dumping all methods. $output .= $this->dumpStuff('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects\\Methods'); // Dumping traversable data. if ($this->pool->config->getSetting(Fallback::SETTING_ANALYSE_TRAVERSABLE) === true && $this->parameters[static::PARAM_DATA] instanceof \Traversable ) { $output .= $this->dumpStuff('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects\\Traversable'); } // Dumping all configured debug functions. // Adding a HR for a better readability. return $output . $this->dumpStuff('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects\\DebugMethods') . $this->pool->render->renderSingeChildHr(); }
php
public function callMe() { $output = $this->pool->render->renderSingeChildHr() . $this->dispatchStartEvent(); $ref = $this->parameters[static::PARAM_REF] = new ReflectionClass($this->parameters[static::PARAM_DATA]); // Dumping public properties. $output .= $this->dumpStuff('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects\\PublicProperties'); // Dumping getter methods. // We will not dump the getters for internal classes, though. if ($this->pool->config->getSetting(Fallback::SETTING_ANALYSE_GETTER) === true && $ref->isUserDefined() === true ) { $output .= $this->dumpStuff('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects\\Getter'); } // When analysing an error object, get the backtrace and then analyse it. $output .= $this->dumpStuff('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects\\ErrorObject'); // Dumping protected properties. if ($this->pool->config->getSetting(Fallback::SETTING_ANALYSE_PROTECTED) === true || $this->pool->scope->isInScope() === true ) { $output .= $this->dumpStuff('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects\\ProtectedProperties'); } // Dumping private properties. if ($this->pool->config->getSetting(Fallback::SETTING_ANALYSE_PRIVATE) === true || $this->pool->scope->isInScope() === true ) { $output .= $this->dumpStuff('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects\\PrivateProperties'); } // Dumping class constants. $output .= $this->dumpStuff('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects\\Constants'); // Dumping all methods. $output .= $this->dumpStuff('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects\\Methods'); // Dumping traversable data. if ($this->pool->config->getSetting(Fallback::SETTING_ANALYSE_TRAVERSABLE) === true && $this->parameters[static::PARAM_DATA] instanceof \Traversable ) { $output .= $this->dumpStuff('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects\\Traversable'); } // Dumping all configured debug functions. // Adding a HR for a better readability. return $output . $this->dumpStuff('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects\\DebugMethods') . $this->pool->render->renderSingeChildHr(); }
[ "public", "function", "callMe", "(", ")", "{", "$", "output", "=", "$", "this", "->", "pool", "->", "render", "->", "renderSingeChildHr", "(", ")", ".", "$", "this", "->", "dispatchStartEvent", "(", ")", ";", "$", "ref", "=", "$", "this", "->", "parameters", "[", "static", "::", "PARAM_REF", "]", "=", "new", "ReflectionClass", "(", "$", "this", "->", "parameters", "[", "static", "::", "PARAM_DATA", "]", ")", ";", "// Dumping public properties.", "$", "output", ".=", "$", "this", "->", "dumpStuff", "(", "'Brainworxx\\\\Krexx\\\\Analyse\\\\Callback\\\\Analyse\\\\Objects\\\\PublicProperties'", ")", ";", "// Dumping getter methods.", "// We will not dump the getters for internal classes, though.", "if", "(", "$", "this", "->", "pool", "->", "config", "->", "getSetting", "(", "Fallback", "::", "SETTING_ANALYSE_GETTER", ")", "===", "true", "&&", "$", "ref", "->", "isUserDefined", "(", ")", "===", "true", ")", "{", "$", "output", ".=", "$", "this", "->", "dumpStuff", "(", "'Brainworxx\\\\Krexx\\\\Analyse\\\\Callback\\\\Analyse\\\\Objects\\\\Getter'", ")", ";", "}", "// When analysing an error object, get the backtrace and then analyse it.", "$", "output", ".=", "$", "this", "->", "dumpStuff", "(", "'Brainworxx\\\\Krexx\\\\Analyse\\\\Callback\\\\Analyse\\\\Objects\\\\ErrorObject'", ")", ";", "// Dumping protected properties.", "if", "(", "$", "this", "->", "pool", "->", "config", "->", "getSetting", "(", "Fallback", "::", "SETTING_ANALYSE_PROTECTED", ")", "===", "true", "||", "$", "this", "->", "pool", "->", "scope", "->", "isInScope", "(", ")", "===", "true", ")", "{", "$", "output", ".=", "$", "this", "->", "dumpStuff", "(", "'Brainworxx\\\\Krexx\\\\Analyse\\\\Callback\\\\Analyse\\\\Objects\\\\ProtectedProperties'", ")", ";", "}", "// Dumping private properties.", "if", "(", "$", "this", "->", "pool", "->", "config", "->", "getSetting", "(", "Fallback", "::", "SETTING_ANALYSE_PRIVATE", ")", "===", "true", "||", "$", "this", "->", "pool", "->", "scope", "->", "isInScope", "(", ")", "===", "true", ")", "{", "$", "output", ".=", "$", "this", "->", "dumpStuff", "(", "'Brainworxx\\\\Krexx\\\\Analyse\\\\Callback\\\\Analyse\\\\Objects\\\\PrivateProperties'", ")", ";", "}", "// Dumping class constants.", "$", "output", ".=", "$", "this", "->", "dumpStuff", "(", "'Brainworxx\\\\Krexx\\\\Analyse\\\\Callback\\\\Analyse\\\\Objects\\\\Constants'", ")", ";", "// Dumping all methods.", "$", "output", ".=", "$", "this", "->", "dumpStuff", "(", "'Brainworxx\\\\Krexx\\\\Analyse\\\\Callback\\\\Analyse\\\\Objects\\\\Methods'", ")", ";", "// Dumping traversable data.", "if", "(", "$", "this", "->", "pool", "->", "config", "->", "getSetting", "(", "Fallback", "::", "SETTING_ANALYSE_TRAVERSABLE", ")", "===", "true", "&&", "$", "this", "->", "parameters", "[", "static", "::", "PARAM_DATA", "]", "instanceof", "\\", "Traversable", ")", "{", "$", "output", ".=", "$", "this", "->", "dumpStuff", "(", "'Brainworxx\\\\Krexx\\\\Analyse\\\\Callback\\\\Analyse\\\\Objects\\\\Traversable'", ")", ";", "}", "// Dumping all configured debug functions.", "// Adding a HR for a better readability.", "return", "$", "output", ".", "$", "this", "->", "dumpStuff", "(", "'Brainworxx\\\\Krexx\\\\Analyse\\\\Callback\\\\Analyse\\\\Objects\\\\DebugMethods'", ")", ".", "$", "this", "->", "pool", "->", "render", "->", "renderSingeChildHr", "(", ")", ";", "}" ]
Starts the dump of an object. @throws \ReflectionException @return string The generated markup.
[ "Starts", "the", "dump", "of", "an", "object", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects.php#L66-L118
33,416
brainworxx/kreXX
src/Analyse/Callback/Analyse/Objects.php
Objects.dumpStuff
protected function dumpStuff($classname) { return $this->pool ->createClass($classname) ->setParams($this->parameters) ->callMe(); }
php
protected function dumpStuff($classname) { return $this->pool ->createClass($classname) ->setParams($this->parameters) ->callMe(); }
[ "protected", "function", "dumpStuff", "(", "$", "classname", ")", "{", "return", "$", "this", "->", "pool", "->", "createClass", "(", "$", "classname", ")", "->", "setParams", "(", "$", "this", "->", "parameters", ")", "->", "callMe", "(", ")", ";", "}" ]
Dumping stuff is everywhere the same, only the callback class is changing. @var string $classname The name of the callback class we are using. @return string The generated html markup.
[ "Dumping", "stuff", "is", "everywhere", "the", "same", "only", "the", "callback", "class", "is", "changing", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects.php#L129-L135
33,417
silverorange/swat
Swat/SwatContainer.php
SwatContainer.replace
public function replace(SwatWidget $widget, SwatWidget $new_widget) { foreach ($this->children as $key => $child_widget) { if ($child_widget === $widget) { $this->children[$key] = $new_widget; $new_widget->parent = $this; $widget->parent = null; if ($widget->id !== null) { unset($this->children_by_id[$widget->id]); } if ($new_widget->id !== null) { $this->children_by_id[$new_widget->id] = $new_widget; } return $widget; } } return null; }
php
public function replace(SwatWidget $widget, SwatWidget $new_widget) { foreach ($this->children as $key => $child_widget) { if ($child_widget === $widget) { $this->children[$key] = $new_widget; $new_widget->parent = $this; $widget->parent = null; if ($widget->id !== null) { unset($this->children_by_id[$widget->id]); } if ($new_widget->id !== null) { $this->children_by_id[$new_widget->id] = $new_widget; } return $widget; } } return null; }
[ "public", "function", "replace", "(", "SwatWidget", "$", "widget", ",", "SwatWidget", "$", "new_widget", ")", "{", "foreach", "(", "$", "this", "->", "children", "as", "$", "key", "=>", "$", "child_widget", ")", "{", "if", "(", "$", "child_widget", "===", "$", "widget", ")", "{", "$", "this", "->", "children", "[", "$", "key", "]", "=", "$", "new_widget", ";", "$", "new_widget", "->", "parent", "=", "$", "this", ";", "$", "widget", "->", "parent", "=", "null", ";", "if", "(", "$", "widget", "->", "id", "!==", "null", ")", "{", "unset", "(", "$", "this", "->", "children_by_id", "[", "$", "widget", "->", "id", "]", ")", ";", "}", "if", "(", "$", "new_widget", "->", "id", "!==", "null", ")", "{", "$", "this", "->", "children_by_id", "[", "$", "new_widget", "->", "id", "]", "=", "$", "new_widget", ";", "}", "return", "$", "widget", ";", "}", "}", "return", "null", ";", "}" ]
Replace a widget Replaces a child widget in this container. The parent of the removed widget is set to null. @param SwatWidget $widget a reference to the widget to be replaced. @param SwatWidget $widget a reference to the new widget. @return SwatWidget a reference to the removed widget, or null if the widget is not found.
[ "Replace", "a", "widget" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatContainer.php#L86-L106
33,418
silverorange/swat
Swat/SwatContainer.php
SwatContainer.remove
public function remove(SwatWidget $widget) { foreach ($this->children as $key => $child_widget) { if ($child_widget === $widget) { // use array_splice here instead of unset in order to re-index // the array keys array_splice($this->children, $key, 1); $widget->parent = null; if ($widget->id !== null) { unset($this->children_by_id[$widget->id]); } return $widget; } } return null; }
php
public function remove(SwatWidget $widget) { foreach ($this->children as $key => $child_widget) { if ($child_widget === $widget) { // use array_splice here instead of unset in order to re-index // the array keys array_splice($this->children, $key, 1); $widget->parent = null; if ($widget->id !== null) { unset($this->children_by_id[$widget->id]); } return $widget; } } return null; }
[ "public", "function", "remove", "(", "SwatWidget", "$", "widget", ")", "{", "foreach", "(", "$", "this", "->", "children", "as", "$", "key", "=>", "$", "child_widget", ")", "{", "if", "(", "$", "child_widget", "===", "$", "widget", ")", "{", "// use array_splice here instead of unset in order to re-index", "// the array keys", "array_splice", "(", "$", "this", "->", "children", ",", "$", "key", ",", "1", ")", ";", "$", "widget", "->", "parent", "=", "null", ";", "if", "(", "$", "widget", "->", "id", "!==", "null", ")", "{", "unset", "(", "$", "this", "->", "children_by_id", "[", "$", "widget", "->", "id", "]", ")", ";", "}", "return", "$", "widget", ";", "}", "}", "return", "null", ";", "}" ]
Removes a widget Removes a child widget from this container. The parent of the widget is set to null. @param SwatWidget $widget a reference to the widget to remove. @return SwatWidget a reference to the removed widget, or null if the widget is not found.
[ "Removes", "a", "widget" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatContainer.php#L122-L139
33,419
silverorange/swat
Swat/SwatContainer.php
SwatContainer.packStart
public function packStart(SwatWidget $widget) { if ($widget->parent !== null) { throw new SwatException( 'Attempting to add a widget that already has a parent.' ); } array_unshift($this->children, $widget); $widget->parent = $this; if ($widget->id !== null) { $this->children_by_id[$widget->id] = $widget; } $this->sendAddNotifySignal($widget); }
php
public function packStart(SwatWidget $widget) { if ($widget->parent !== null) { throw new SwatException( 'Attempting to add a widget that already has a parent.' ); } array_unshift($this->children, $widget); $widget->parent = $this; if ($widget->id !== null) { $this->children_by_id[$widget->id] = $widget; } $this->sendAddNotifySignal($widget); }
[ "public", "function", "packStart", "(", "SwatWidget", "$", "widget", ")", "{", "if", "(", "$", "widget", "->", "parent", "!==", "null", ")", "{", "throw", "new", "SwatException", "(", "'Attempting to add a widget that already has a parent.'", ")", ";", "}", "array_unshift", "(", "$", "this", "->", "children", ",", "$", "widget", ")", ";", "$", "widget", "->", "parent", "=", "$", "this", ";", "if", "(", "$", "widget", "->", "id", "!==", "null", ")", "{", "$", "this", "->", "children_by_id", "[", "$", "widget", "->", "id", "]", "=", "$", "widget", ";", "}", "$", "this", "->", "sendAddNotifySignal", "(", "$", "widget", ")", ";", "}" ]
Adds a widget to start Adds a widget to the start of the list of widgets in this container. @param SwatWidget $widget a reference to the widget to add.
[ "Adds", "a", "widget", "to", "start" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatContainer.php#L151-L167
33,420
silverorange/swat
Swat/SwatContainer.php
SwatContainer.insertBefore
public function insertBefore(SwatWidget $widget, SwatWidget $child) { if ($widget->parent !== null) { throw new SwatException( 'Attempting to add a widget that already has a parent.' ); } if ($child->parent !== $this) { throw new SwatException( 'Attempting to insert before a child ' . 'that is not in this container.' ); } $index = 0; for ($i = 0; $i < count($this->children); $i++) { if ($this->children[$i] === $child) { $index = $i; break; } } array_splice($this->children, $index, 0, array($widget)); $widget->parent = $this; if ($widget->id !== null) { $this->children_by_id[$widget->id] = $widget; } $this->sendAddNotifySignal($widget); }
php
public function insertBefore(SwatWidget $widget, SwatWidget $child) { if ($widget->parent !== null) { throw new SwatException( 'Attempting to add a widget that already has a parent.' ); } if ($child->parent !== $this) { throw new SwatException( 'Attempting to insert before a child ' . 'that is not in this container.' ); } $index = 0; for ($i = 0; $i < count($this->children); $i++) { if ($this->children[$i] === $child) { $index = $i; break; } } array_splice($this->children, $index, 0, array($widget)); $widget->parent = $this; if ($widget->id !== null) { $this->children_by_id[$widget->id] = $widget; } $this->sendAddNotifySignal($widget); }
[ "public", "function", "insertBefore", "(", "SwatWidget", "$", "widget", ",", "SwatWidget", "$", "child", ")", "{", "if", "(", "$", "widget", "->", "parent", "!==", "null", ")", "{", "throw", "new", "SwatException", "(", "'Attempting to add a widget that already has a parent.'", ")", ";", "}", "if", "(", "$", "child", "->", "parent", "!==", "$", "this", ")", "{", "throw", "new", "SwatException", "(", "'Attempting to insert before a child '", ".", "'that is not in this container.'", ")", ";", "}", "$", "index", "=", "0", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "count", "(", "$", "this", "->", "children", ")", ";", "$", "i", "++", ")", "{", "if", "(", "$", "this", "->", "children", "[", "$", "i", "]", "===", "$", "child", ")", "{", "$", "index", "=", "$", "i", ";", "break", ";", "}", "}", "array_splice", "(", "$", "this", "->", "children", ",", "$", "index", ",", "0", ",", "array", "(", "$", "widget", ")", ")", ";", "$", "widget", "->", "parent", "=", "$", "this", ";", "if", "(", "$", "widget", "->", "id", "!==", "null", ")", "{", "$", "this", "->", "children_by_id", "[", "$", "widget", "->", "id", "]", "=", "$", "widget", ";", "}", "$", "this", "->", "sendAddNotifySignal", "(", "$", "widget", ")", ";", "}" ]
Adds a widget to this container before another widget @param SwatWidget $widget a reference to the widget to add. @param SwatWidget $child a reference to the widget to add before.
[ "Adds", "a", "widget", "to", "this", "container", "before", "another", "widget" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatContainer.php#L178-L209
33,421
silverorange/swat
Swat/SwatContainer.php
SwatContainer.packEnd
public function packEnd(SwatWidget $widget) { if ($widget->parent !== null) { throw new SwatException( 'Attempting to add a widget that already has a parent.' ); } $this->children[] = $widget; $widget->parent = $this; if ($widget->id !== null) { $this->children_by_id[$widget->id] = $widget; } $this->sendAddNotifySignal($widget); }
php
public function packEnd(SwatWidget $widget) { if ($widget->parent !== null) { throw new SwatException( 'Attempting to add a widget that already has a parent.' ); } $this->children[] = $widget; $widget->parent = $this; if ($widget->id !== null) { $this->children_by_id[$widget->id] = $widget; } $this->sendAddNotifySignal($widget); }
[ "public", "function", "packEnd", "(", "SwatWidget", "$", "widget", ")", "{", "if", "(", "$", "widget", "->", "parent", "!==", "null", ")", "{", "throw", "new", "SwatException", "(", "'Attempting to add a widget that already has a parent.'", ")", ";", "}", "$", "this", "->", "children", "[", "]", "=", "$", "widget", ";", "$", "widget", "->", "parent", "=", "$", "this", ";", "if", "(", "$", "widget", "->", "id", "!==", "null", ")", "{", "$", "this", "->", "children_by_id", "[", "$", "widget", "->", "id", "]", "=", "$", "widget", ";", "}", "$", "this", "->", "sendAddNotifySignal", "(", "$", "widget", ")", ";", "}" ]
Adds a widget to end Adds a widget to the end of the list of widgets in this container. @param SwatWidget $widget a reference to the widget to add.
[ "Adds", "a", "widget", "to", "end" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatContainer.php#L221-L237
33,422
silverorange/swat
Swat/SwatContainer.php
SwatContainer.getChild
public function getChild($id) { if (array_key_exists($id, $this->children_by_id)) { return $this->children_by_id[$id]; } else { return null; } }
php
public function getChild($id) { if (array_key_exists($id, $this->children_by_id)) { return $this->children_by_id[$id]; } else { return null; } }
[ "public", "function", "getChild", "(", "$", "id", ")", "{", "if", "(", "array_key_exists", "(", "$", "id", ",", "$", "this", "->", "children_by_id", ")", ")", "{", "return", "$", "this", "->", "children_by_id", "[", "$", "id", "]", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Gets a child widget Retrieves a widget from the list of widgets in the container based on the unique identifier of the widget. @param string $id the unique id of the widget to look for. @return SwatWidget the found widget or null if not found.
[ "Gets", "a", "child", "widget" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatContainer.php#L252-L259
33,423
silverorange/swat
Swat/SwatContainer.php
SwatContainer.getFirst
public function getFirst() { if (count($this->children)) { reset($this->children); return current($this->children); } else { return null; } }
php
public function getFirst() { if (count($this->children)) { reset($this->children); return current($this->children); } else { return null; } }
[ "public", "function", "getFirst", "(", ")", "{", "if", "(", "count", "(", "$", "this", "->", "children", ")", ")", "{", "reset", "(", "$", "this", "->", "children", ")", ";", "return", "current", "(", "$", "this", "->", "children", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Gets the first child widget Retrieves the first child widget from the list of widgets in the container. @return SwatWidget the first widget in this container or null if there are no widgets in this container.
[ "Gets", "the", "first", "child", "widget" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatContainer.php#L273-L281
33,424
silverorange/swat
Swat/SwatContainer.php
SwatContainer.getChildren
public function getChildren($class_name = null) { if ($class_name === null) { return $this->children; } $out = array(); foreach ($this->children as $child_widget) { if ($child_widget instanceof $class_name) { $out[] = $child_widget; } } return $out; }
php
public function getChildren($class_name = null) { if ($class_name === null) { return $this->children; } $out = array(); foreach ($this->children as $child_widget) { if ($child_widget instanceof $class_name) { $out[] = $child_widget; } } return $out; }
[ "public", "function", "getChildren", "(", "$", "class_name", "=", "null", ")", "{", "if", "(", "$", "class_name", "===", "null", ")", "{", "return", "$", "this", "->", "children", ";", "}", "$", "out", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "children", "as", "$", "child_widget", ")", "{", "if", "(", "$", "child_widget", "instanceof", "$", "class_name", ")", "{", "$", "out", "[", "]", "=", "$", "child_widget", ";", "}", "}", "return", "$", "out", ";", "}" ]
Gets all child widgets Retrieves an array of all widgets directly contained by this container. @param string $class_name optional class name. If set, only widgets that are instances of <code>$class_name</code> are returned. @return array the child widgets of this container.
[ "Gets", "all", "child", "widgets" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatContainer.php#L297-L312
33,425
silverorange/swat
Swat/SwatContainer.php
SwatContainer.getDescendantStates
public function getDescendantStates() { $states = array(); foreach ($this->getDescendants('SwatState') as $id => $object) { $states[$id] = $object->getState(); } return $states; }
php
public function getDescendantStates() { $states = array(); foreach ($this->getDescendants('SwatState') as $id => $object) { $states[$id] = $object->getState(); } return $states; }
[ "public", "function", "getDescendantStates", "(", ")", "{", "$", "states", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "getDescendants", "(", "'SwatState'", ")", "as", "$", "id", "=>", "$", "object", ")", "{", "$", "states", "[", "$", "id", "]", "=", "$", "object", "->", "getState", "(", ")", ";", "}", "return", "$", "states", ";", "}" ]
Gets descendant states Retrieves an array of states of all stateful UI-objects in the widget subtree below this container. @return array an array of UI-object states with UI-object identifiers as array keys.
[ "Gets", "descendant", "states" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatContainer.php#L414-L423
33,426
silverorange/swat
Swat/SwatContainer.php
SwatContainer.setDescendantStates
public function setDescendantStates(array $states) { foreach ($this->getDescendants('SwatState') as $id => $object) { if (isset($states[$id])) { $object->setState($states[$id]); } } }
php
public function setDescendantStates(array $states) { foreach ($this->getDescendants('SwatState') as $id => $object) { if (isset($states[$id])) { $object->setState($states[$id]); } } }
[ "public", "function", "setDescendantStates", "(", "array", "$", "states", ")", "{", "foreach", "(", "$", "this", "->", "getDescendants", "(", "'SwatState'", ")", "as", "$", "id", "=>", "$", "object", ")", "{", "if", "(", "isset", "(", "$", "states", "[", "$", "id", "]", ")", ")", "{", "$", "object", "->", "setState", "(", "$", "states", "[", "$", "id", "]", ")", ";", "}", "}", "}" ]
Sets descendant states Sets states on all stateful UI-objects in the widget subtree below this container. @param array $states an array of UI-object states with UI-object identifiers as array keys.
[ "Sets", "descendant", "states" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatContainer.php#L437-L444
33,427
silverorange/swat
Swat/SwatContainer.php
SwatContainer.getHtmlHeadEntrySet
public function getHtmlHeadEntrySet() { $set = parent::getHtmlHeadEntrySet(); foreach ($this->children as $child_widget) { $set->addEntrySet($child_widget->getHtmlHeadEntrySet()); } return $set; }
php
public function getHtmlHeadEntrySet() { $set = parent::getHtmlHeadEntrySet(); foreach ($this->children as $child_widget) { $set->addEntrySet($child_widget->getHtmlHeadEntrySet()); } return $set; }
[ "public", "function", "getHtmlHeadEntrySet", "(", ")", "{", "$", "set", "=", "parent", "::", "getHtmlHeadEntrySet", "(", ")", ";", "foreach", "(", "$", "this", "->", "children", "as", "$", "child_widget", ")", "{", "$", "set", "->", "addEntrySet", "(", "$", "child_widget", "->", "getHtmlHeadEntrySet", "(", ")", ")", ";", "}", "return", "$", "set", ";", "}" ]
Gets the SwatHtmlHeadEntry objects needed by this container @return SwatHtmlHeadEntrySet the {@link SwatHtmlHeadEntry} objects needed by this container. @see SwatUIObject::getHtmlHeadEntrySet()
[ "Gets", "the", "SwatHtmlHeadEntry", "objects", "needed", "by", "this", "container" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatContainer.php#L571-L580
33,428
silverorange/swat
Swat/SwatContainer.php
SwatContainer.getAvailableHtmlHeadEntrySet
public function getAvailableHtmlHeadEntrySet() { $set = parent::getAvailableHtmlHeadEntrySet(); foreach ($this->children as $child_widget) { $set->addEntrySet($child_widget->getAvailableHtmlHeadEntrySet()); } return $set; }
php
public function getAvailableHtmlHeadEntrySet() { $set = parent::getAvailableHtmlHeadEntrySet(); foreach ($this->children as $child_widget) { $set->addEntrySet($child_widget->getAvailableHtmlHeadEntrySet()); } return $set; }
[ "public", "function", "getAvailableHtmlHeadEntrySet", "(", ")", "{", "$", "set", "=", "parent", "::", "getAvailableHtmlHeadEntrySet", "(", ")", ";", "foreach", "(", "$", "this", "->", "children", "as", "$", "child_widget", ")", "{", "$", "set", "->", "addEntrySet", "(", "$", "child_widget", "->", "getAvailableHtmlHeadEntrySet", "(", ")", ")", ";", "}", "return", "$", "set", ";", "}" ]
Gets the SwatHtmlHeadEntry objects that may be needed by this container @return SwatHtmlHeadEntrySet the {@link SwatHtmlHeadEntry} objects that may be needed by this container. @see SwatUIObject::getAvailableHtmlHeadEntrySet()
[ "Gets", "the", "SwatHtmlHeadEntry", "objects", "that", "may", "be", "needed", "by", "this", "container" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatContainer.php#L593-L602
33,429
silverorange/swat
Swat/SwatContainer.php
SwatContainer.sendAddNotifySignal
protected function sendAddNotifySignal($widget) { $this->notifyOfAdd($widget); if ($this->parent !== null && $this->parent instanceof SwatContainer) { $this->parent->sendAddNotifySignal($widget); } }
php
protected function sendAddNotifySignal($widget) { $this->notifyOfAdd($widget); if ($this->parent !== null && $this->parent instanceof SwatContainer) { $this->parent->sendAddNotifySignal($widget); } }
[ "protected", "function", "sendAddNotifySignal", "(", "$", "widget", ")", "{", "$", "this", "->", "notifyOfAdd", "(", "$", "widget", ")", ";", "if", "(", "$", "this", "->", "parent", "!==", "null", "&&", "$", "this", "->", "parent", "instanceof", "SwatContainer", ")", "{", "$", "this", "->", "parent", "->", "sendAddNotifySignal", "(", "$", "widget", ")", ";", "}", "}" ]
Sends the notification signal up the widget tree This container is notified of the added widget and then this method is called on the container parent. @param SwatWidget $widget the widget that has been added.
[ "Sends", "the", "notification", "signal", "up", "the", "widget", "tree" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatContainer.php#L725-L732
33,430
silverorange/swat
Swat/SwatSimpleColorEntry.php
SwatSimpleColorEntry.getInlineJavaScript
protected function getInlineJavaScript() { $javascript = parent::getInlineJavaScript(); $colors = "'" . implode("', '", $this->colors) . "'"; if ($this->none_option) { $none_option = $this->none_option_title === null ? 'null' : SwatString::quoteJavaScriptString( $this->none_option_title ); } else { $none_option = 'null'; } $js_class_name = $this->getJavaScriptClassName(); $javascript .= "\nvar {$this->id}_obj = new {$js_class_name}(" . "'{$this->id}', [{$colors}], {$none_option});\n"; return $javascript; }
php
protected function getInlineJavaScript() { $javascript = parent::getInlineJavaScript(); $colors = "'" . implode("', '", $this->colors) . "'"; if ($this->none_option) { $none_option = $this->none_option_title === null ? 'null' : SwatString::quoteJavaScriptString( $this->none_option_title ); } else { $none_option = 'null'; } $js_class_name = $this->getJavaScriptClassName(); $javascript .= "\nvar {$this->id}_obj = new {$js_class_name}(" . "'{$this->id}', [{$colors}], {$none_option});\n"; return $javascript; }
[ "protected", "function", "getInlineJavaScript", "(", ")", "{", "$", "javascript", "=", "parent", "::", "getInlineJavaScript", "(", ")", ";", "$", "colors", "=", "\"'\"", ".", "implode", "(", "\"', '\"", ",", "$", "this", "->", "colors", ")", ".", "\"'\"", ";", "if", "(", "$", "this", "->", "none_option", ")", "{", "$", "none_option", "=", "$", "this", "->", "none_option_title", "===", "null", "?", "'null'", ":", "SwatString", "::", "quoteJavaScriptString", "(", "$", "this", "->", "none_option_title", ")", ";", "}", "else", "{", "$", "none_option", "=", "'null'", ";", "}", "$", "js_class_name", "=", "$", "this", "->", "getJavaScriptClassName", "(", ")", ";", "$", "javascript", ".=", "\"\\nvar {$this->id}_obj = new {$js_class_name}(\"", ".", "\"'{$this->id}', [{$colors}], {$none_option});\\n\"", ";", "return", "$", "javascript", ";", "}" ]
Gets simple color selector inline JavaScript The JavaScript is the majority of the simple color selector code @return string simple color selector inline JavaScript.
[ "Gets", "simple", "color", "selector", "inline", "JavaScript" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatSimpleColorEntry.php#L176-L200
33,431
silverorange/swat
Swat/SwatOptionControl.php
SwatOptionControl.addOptionMetadata
public function addOptionMetadata( SwatOption $option, $metadata, $value = null ) { $key = $this->getOptionMetadataKey($option); if (is_array($metadata)) { $this->option_metadata[$key] = array_merge( $this->option_metadata[$key], $metadata ); } else { $this->option_metadata[$key][$metadata] = $value; } }
php
public function addOptionMetadata( SwatOption $option, $metadata, $value = null ) { $key = $this->getOptionMetadataKey($option); if (is_array($metadata)) { $this->option_metadata[$key] = array_merge( $this->option_metadata[$key], $metadata ); } else { $this->option_metadata[$key][$metadata] = $value; } }
[ "public", "function", "addOptionMetadata", "(", "SwatOption", "$", "option", ",", "$", "metadata", ",", "$", "value", "=", "null", ")", "{", "$", "key", "=", "$", "this", "->", "getOptionMetadataKey", "(", "$", "option", ")", ";", "if", "(", "is_array", "(", "$", "metadata", ")", ")", "{", "$", "this", "->", "option_metadata", "[", "$", "key", "]", "=", "array_merge", "(", "$", "this", "->", "option_metadata", "[", "$", "key", "]", ",", "$", "metadata", ")", ";", "}", "else", "{", "$", "this", "->", "option_metadata", "[", "$", "key", "]", "[", "$", "metadata", "]", "=", "$", "value", ";", "}", "}" ]
Sets the metadata for an option Any metadata may be added to options. It is up to the control to make use of particular metadata fields. Common metadata fields are: - classes - an array of CSS classes @param SwatOption $option the option for which to set the metadata. @param array|string $metadata either an array of metadata to add to the option, or a string specifying the name of the metadata field to add. @param mixed $value optional. If the <i>$metadata</i> parameter is a string, this is the metadata value to set for the option. Otherwise, this parameter is ignored. @see SwatOptionControl::addOption() @see SwatOptionControl::getOptionMetadata()
[ "Sets", "the", "metadata", "for", "an", "option" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatOptionControl.php#L161-L176
33,432
silverorange/swat
Swat/SwatOptionControl.php
SwatOptionControl.getOptionMetadata
public function getOptionMetadata(SwatOption $option, $metadata = null) { $key = $this->getOptionMetadataKey($option); if ($metadata === null) { if (isset($this->option_metadata[$key])) { $metadata = $this->option_metadata[$key]; } else { $metadata = array(); } } else { if ( isset($this->option_metadata[$key]) && isset($this->option_metadata[$key][$metadata]) ) { $metadata = $this->option_metadata[$key][$metadata]; } else { $metadata = null; } } return $metadata; }
php
public function getOptionMetadata(SwatOption $option, $metadata = null) { $key = $this->getOptionMetadataKey($option); if ($metadata === null) { if (isset($this->option_metadata[$key])) { $metadata = $this->option_metadata[$key]; } else { $metadata = array(); } } else { if ( isset($this->option_metadata[$key]) && isset($this->option_metadata[$key][$metadata]) ) { $metadata = $this->option_metadata[$key][$metadata]; } else { $metadata = null; } } return $metadata; }
[ "public", "function", "getOptionMetadata", "(", "SwatOption", "$", "option", ",", "$", "metadata", "=", "null", ")", "{", "$", "key", "=", "$", "this", "->", "getOptionMetadataKey", "(", "$", "option", ")", ";", "if", "(", "$", "metadata", "===", "null", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "option_metadata", "[", "$", "key", "]", ")", ")", "{", "$", "metadata", "=", "$", "this", "->", "option_metadata", "[", "$", "key", "]", ";", "}", "else", "{", "$", "metadata", "=", "array", "(", ")", ";", "}", "}", "else", "{", "if", "(", "isset", "(", "$", "this", "->", "option_metadata", "[", "$", "key", "]", ")", "&&", "isset", "(", "$", "this", "->", "option_metadata", "[", "$", "key", "]", "[", "$", "metadata", "]", ")", ")", "{", "$", "metadata", "=", "$", "this", "->", "option_metadata", "[", "$", "key", "]", "[", "$", "metadata", "]", ";", "}", "else", "{", "$", "metadata", "=", "null", ";", "}", "}", "return", "$", "metadata", ";", "}" ]
Gets the metadata for an option Any metadata may be added to options. It is up to the control to make use of particular metadata fields. Common metadata fields are: - classes - an array of CSS classes @param SwatOption $option the option for which to get the metadata. @param string $metadata optional. An optional metadata property to get. If not specified, all available metadata for the option is returned. @returns array|mixed an array of the metadata for this option, or a specific metadata value if the <i>$metadata</i> parameter is specified. If <i>$metadata</i> is specified and no such metadata field exists for the specified option, null is returned. @see SwatOptionControl::addOptionMetadata()
[ "Gets", "the", "metadata", "for", "an", "option" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatOptionControl.php#L202-L224
33,433
silverorange/swat
Swat/SwatOptionControl.php
SwatOptionControl.removeOption
public function removeOption(SwatOption $option) { $removed_option = null; foreach ($this->options as $key => $control_option) { if ($control_option === $option) { $removed_option = $control_option; // remove from options list unset($this->options[$key]); // remove metadata $key = $this->getOptionMetadataKey($control_option); unset($this->option_metadata[$key]); } } return $removed_option; }
php
public function removeOption(SwatOption $option) { $removed_option = null; foreach ($this->options as $key => $control_option) { if ($control_option === $option) { $removed_option = $control_option; // remove from options list unset($this->options[$key]); // remove metadata $key = $this->getOptionMetadataKey($control_option); unset($this->option_metadata[$key]); } } return $removed_option; }
[ "public", "function", "removeOption", "(", "SwatOption", "$", "option", ")", "{", "$", "removed_option", "=", "null", ";", "foreach", "(", "$", "this", "->", "options", "as", "$", "key", "=>", "$", "control_option", ")", "{", "if", "(", "$", "control_option", "===", "$", "option", ")", "{", "$", "removed_option", "=", "$", "control_option", ";", "// remove from options list", "unset", "(", "$", "this", "->", "options", "[", "$", "key", "]", ")", ";", "// remove metadata", "$", "key", "=", "$", "this", "->", "getOptionMetadataKey", "(", "$", "control_option", ")", ";", "unset", "(", "$", "this", "->", "option_metadata", "[", "$", "key", "]", ")", ";", "}", "}", "return", "$", "removed_option", ";", "}" ]
Removes an option from this option control @param SwatOption $option the option to remove. @return SwatOption the removed option or null if no option was removed.
[ "Removes", "an", "option", "from", "this", "option", "control" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatOptionControl.php#L236-L254
33,434
silverorange/swat
Swat/SwatOptionControl.php
SwatOptionControl.removeOptionsByValue
public function removeOptionsByValue($value) { $removed_options = array(); foreach ($this->options as $key => $control_option) { if ($control_option->value === $value) { $removed_options[] = $control_option; // remove from options list unset($this->options[$key]); // remove metadata $metadata_key = $this->getOptionMetadataKey($control_option); unset($this->option_metadata[$metadata_key]); } } return $removed_options; }
php
public function removeOptionsByValue($value) { $removed_options = array(); foreach ($this->options as $key => $control_option) { if ($control_option->value === $value) { $removed_options[] = $control_option; // remove from options list unset($this->options[$key]); // remove metadata $metadata_key = $this->getOptionMetadataKey($control_option); unset($this->option_metadata[$metadata_key]); } } return $removed_options; }
[ "public", "function", "removeOptionsByValue", "(", "$", "value", ")", "{", "$", "removed_options", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "options", "as", "$", "key", "=>", "$", "control_option", ")", "{", "if", "(", "$", "control_option", "->", "value", "===", "$", "value", ")", "{", "$", "removed_options", "[", "]", "=", "$", "control_option", ";", "// remove from options list", "unset", "(", "$", "this", "->", "options", "[", "$", "key", "]", ")", ";", "// remove metadata", "$", "metadata_key", "=", "$", "this", "->", "getOptionMetadataKey", "(", "$", "control_option", ")", ";", "unset", "(", "$", "this", "->", "option_metadata", "[", "$", "metadata_key", "]", ")", ";", "}", "}", "return", "$", "removed_options", ";", "}" ]
Removes options from this option control by their value @param mixed $value the value of the option or options to remove. @return array an array of removed SwatOption objects or an empty array if no options are removed.
[ "Removes", "options", "from", "this", "option", "control", "by", "their", "value" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatOptionControl.php#L267-L285
33,435
silverorange/swat
Swat/SwatOptionControl.php
SwatOptionControl.getOptionsByValue
public function getOptionsByValue($value) { $options = array(); foreach ($this->options as $option) { if ($option->value === $value) { $options[] = $option; } } return $options; }
php
public function getOptionsByValue($value) { $options = array(); foreach ($this->options as $option) { if ($option->value === $value) { $options[] = $option; } } return $options; }
[ "public", "function", "getOptionsByValue", "(", "$", "value", ")", "{", "$", "options", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "options", "as", "$", "option", ")", "{", "if", "(", "$", "option", "->", "value", "===", "$", "value", ")", "{", "$", "options", "[", "]", "=", "$", "option", ";", "}", "}", "return", "$", "options", ";", "}" ]
Gets options from this option control by their value @param mixed $value the value of the option or options to get. @return array an array of SwatOption objects or an empty array if no options with the given value exist within this option control.
[ "Gets", "options", "from", "this", "option", "control", "by", "their", "value" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatOptionControl.php#L320-L331
33,436
brainworxx/kreXX
src/Analyse/Callback/Analyse/Objects/Traversable.php
Traversable.callMe
public function callMe() { $output = $this->dispatchStartEvent(); // Check nesting level, memory and runtime. $this->pool->emergencyHandler->upOneNestingLevel(); if ($this->pool->emergencyHandler->checkNesting() === true || $this->pool->emergencyHandler->checkEmergencyBreak() === true ) { // We will not be doing this one, but we need to get down with our // nesting level again. $this->pool->emergencyHandler->downOneNestingLevel(); return $output; } // Do the actual analysis return $output . $this->getTaversableData(); }
php
public function callMe() { $output = $this->dispatchStartEvent(); // Check nesting level, memory and runtime. $this->pool->emergencyHandler->upOneNestingLevel(); if ($this->pool->emergencyHandler->checkNesting() === true || $this->pool->emergencyHandler->checkEmergencyBreak() === true ) { // We will not be doing this one, but we need to get down with our // nesting level again. $this->pool->emergencyHandler->downOneNestingLevel(); return $output; } // Do the actual analysis return $output . $this->getTaversableData(); }
[ "public", "function", "callMe", "(", ")", "{", "$", "output", "=", "$", "this", "->", "dispatchStartEvent", "(", ")", ";", "// Check nesting level, memory and runtime.", "$", "this", "->", "pool", "->", "emergencyHandler", "->", "upOneNestingLevel", "(", ")", ";", "if", "(", "$", "this", "->", "pool", "->", "emergencyHandler", "->", "checkNesting", "(", ")", "===", "true", "||", "$", "this", "->", "pool", "->", "emergencyHandler", "->", "checkEmergencyBreak", "(", ")", "===", "true", ")", "{", "// We will not be doing this one, but we need to get down with our", "// nesting level again.", "$", "this", "->", "pool", "->", "emergencyHandler", "->", "downOneNestingLevel", "(", ")", ";", "return", "$", "output", ";", "}", "// Do the actual analysis", "return", "$", "output", ".", "$", "this", "->", "getTaversableData", "(", ")", ";", "}" ]
Checks runtime, memory and nesting level. Then trigger the actual analysis. @return string The generated markup.
[ "Checks", "runtime", "memory", "and", "nesting", "level", ".", "Then", "trigger", "the", "actual", "analysis", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects/Traversable.php#L64-L81
33,437
brainworxx/kreXX
src/Analyse/Callback/Analyse/Objects/Traversable.php
Traversable.getTaversableData
protected function getTaversableData() { $data = $this->parameters[static::PARAM_DATA]; $name = $this->parameters[static::PARAM_NAME]; // 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. } ); $parameter = iterator_to_array($data); } catch (\Throwable $e) { //Restore the previous error handler, and return an empty string. restore_error_handler(); $this->pool->emergencyHandler->downOneNestingLevel(); return ''; } catch (\Exception $e) { //Restore the previous error handler, and return an empty string. restore_error_handler(); $this->pool->emergencyHandler->downOneNestingLevel(); return ''; } // Reactivate whatever error handling we had previously. restore_error_handler(); if (is_array($parameter) === true) { // Special Array Access here, resulting in more complicated source // generation. So we tell the callback to to that. $multiline = true; // Normal ArrayAccess, direct access to the array. Nothing special if ($data instanceof \ArrayAccess) { $multiline = false; } // SplObject pool use the object as keys, so we need some // multiline stuff! if ($data instanceof \SplObjectStorage) { $multiline = true; } $count = count($parameter); /** @var Model $model */ $model = $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setName($name) ->setType(static::TYPE_FOREACH) ->addParameter(static::PARAM_DATA, $parameter) ->addParameter(static::PARAM_MULTILINE, $multiline) ->addToJson(static::META_LENGTH, count($parameter)); // Check, if we are handling a huge array. Huge arrays tend to result in a huge // output, maybe even triggering a emergency break. to avoid this, we give them // a special callback. if ($count > (int) $this->pool->config->getSetting(Fallback::SETTING_ARRAY_COUNT_LIMIT)) { $model->injectCallback( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughLargeArray') )->setNormal('Simplified Traversable Info') ->setHelpid('simpleArray'); } else { $model->injectCallback( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughArray') )->setNormal('Traversable Info'); } $result = $this->pool->render->renderExpandableChild( $this->dispatchEventWithModel(static::EVENT_MARKER_ANALYSES_END, $model) ); $this->pool->emergencyHandler->downOneNestingLevel(); return $result; } // Still here?!? Return an empty string. $this->pool->emergencyHandler->downOneNestingLevel(); return ''; }
php
protected function getTaversableData() { $data = $this->parameters[static::PARAM_DATA]; $name = $this->parameters[static::PARAM_NAME]; // 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. } ); $parameter = iterator_to_array($data); } catch (\Throwable $e) { //Restore the previous error handler, and return an empty string. restore_error_handler(); $this->pool->emergencyHandler->downOneNestingLevel(); return ''; } catch (\Exception $e) { //Restore the previous error handler, and return an empty string. restore_error_handler(); $this->pool->emergencyHandler->downOneNestingLevel(); return ''; } // Reactivate whatever error handling we had previously. restore_error_handler(); if (is_array($parameter) === true) { // Special Array Access here, resulting in more complicated source // generation. So we tell the callback to to that. $multiline = true; // Normal ArrayAccess, direct access to the array. Nothing special if ($data instanceof \ArrayAccess) { $multiline = false; } // SplObject pool use the object as keys, so we need some // multiline stuff! if ($data instanceof \SplObjectStorage) { $multiline = true; } $count = count($parameter); /** @var Model $model */ $model = $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setName($name) ->setType(static::TYPE_FOREACH) ->addParameter(static::PARAM_DATA, $parameter) ->addParameter(static::PARAM_MULTILINE, $multiline) ->addToJson(static::META_LENGTH, count($parameter)); // Check, if we are handling a huge array. Huge arrays tend to result in a huge // output, maybe even triggering a emergency break. to avoid this, we give them // a special callback. if ($count > (int) $this->pool->config->getSetting(Fallback::SETTING_ARRAY_COUNT_LIMIT)) { $model->injectCallback( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughLargeArray') )->setNormal('Simplified Traversable Info') ->setHelpid('simpleArray'); } else { $model->injectCallback( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughArray') )->setNormal('Traversable Info'); } $result = $this->pool->render->renderExpandableChild( $this->dispatchEventWithModel(static::EVENT_MARKER_ANALYSES_END, $model) ); $this->pool->emergencyHandler->downOneNestingLevel(); return $result; } // Still here?!? Return an empty string. $this->pool->emergencyHandler->downOneNestingLevel(); return ''; }
[ "protected", "function", "getTaversableData", "(", ")", "{", "$", "data", "=", "$", "this", "->", "parameters", "[", "static", "::", "PARAM_DATA", "]", ";", "$", "name", "=", "$", "this", "->", "parameters", "[", "static", "::", "PARAM_NAME", "]", ";", "// 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.", "}", ")", ";", "$", "parameter", "=", "iterator_to_array", "(", "$", "data", ")", ";", "}", "catch", "(", "\\", "Throwable", "$", "e", ")", "{", "//Restore the previous error handler, and return an empty string.", "restore_error_handler", "(", ")", ";", "$", "this", "->", "pool", "->", "emergencyHandler", "->", "downOneNestingLevel", "(", ")", ";", "return", "''", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "//Restore the previous error handler, and return an empty string.", "restore_error_handler", "(", ")", ";", "$", "this", "->", "pool", "->", "emergencyHandler", "->", "downOneNestingLevel", "(", ")", ";", "return", "''", ";", "}", "// Reactivate whatever error handling we had previously.", "restore_error_handler", "(", ")", ";", "if", "(", "is_array", "(", "$", "parameter", ")", "===", "true", ")", "{", "// Special Array Access here, resulting in more complicated source", "// generation. So we tell the callback to to that.", "$", "multiline", "=", "true", ";", "// Normal ArrayAccess, direct access to the array. Nothing special", "if", "(", "$", "data", "instanceof", "\\", "ArrayAccess", ")", "{", "$", "multiline", "=", "false", ";", "}", "// SplObject pool use the object as keys, so we need some", "// multiline stuff!", "if", "(", "$", "data", "instanceof", "\\", "SplObjectStorage", ")", "{", "$", "multiline", "=", "true", ";", "}", "$", "count", "=", "count", "(", "$", "parameter", ")", ";", "/** @var Model $model */", "$", "model", "=", "$", "this", "->", "pool", "->", "createClass", "(", "'Brainworxx\\\\Krexx\\\\Analyse\\\\Model'", ")", "->", "setName", "(", "$", "name", ")", "->", "setType", "(", "static", "::", "TYPE_FOREACH", ")", "->", "addParameter", "(", "static", "::", "PARAM_DATA", ",", "$", "parameter", ")", "->", "addParameter", "(", "static", "::", "PARAM_MULTILINE", ",", "$", "multiline", ")", "->", "addToJson", "(", "static", "::", "META_LENGTH", ",", "count", "(", "$", "parameter", ")", ")", ";", "// Check, if we are handling a huge array. Huge arrays tend to result in a huge", "// output, maybe even triggering a emergency break. to avoid this, we give them", "// a special callback.", "if", "(", "$", "count", ">", "(", "int", ")", "$", "this", "->", "pool", "->", "config", "->", "getSetting", "(", "Fallback", "::", "SETTING_ARRAY_COUNT_LIMIT", ")", ")", "{", "$", "model", "->", "injectCallback", "(", "$", "this", "->", "pool", "->", "createClass", "(", "'Brainworxx\\\\Krexx\\\\Analyse\\\\Callback\\\\Iterate\\\\ThroughLargeArray'", ")", ")", "->", "setNormal", "(", "'Simplified Traversable Info'", ")", "->", "setHelpid", "(", "'simpleArray'", ")", ";", "}", "else", "{", "$", "model", "->", "injectCallback", "(", "$", "this", "->", "pool", "->", "createClass", "(", "'Brainworxx\\\\Krexx\\\\Analyse\\\\Callback\\\\Iterate\\\\ThroughArray'", ")", ")", "->", "setNormal", "(", "'Traversable Info'", ")", ";", "}", "$", "result", "=", "$", "this", "->", "pool", "->", "render", "->", "renderExpandableChild", "(", "$", "this", "->", "dispatchEventWithModel", "(", "static", "::", "EVENT_MARKER_ANALYSES_END", ",", "$", "model", ")", ")", ";", "$", "this", "->", "pool", "->", "emergencyHandler", "->", "downOneNestingLevel", "(", ")", ";", "return", "$", "result", ";", "}", "// Still here?!? Return an empty string.", "$", "this", "->", "pool", "->", "emergencyHandler", "->", "downOneNestingLevel", "(", ")", ";", "return", "''", ";", "}" ]
Analyses the traversable data. @return string The generated markup.
[ "Analyses", "the", "traversable", "data", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects/Traversable.php#L89-L169
33,438
silverorange/swat
Swat/SwatCellRenderer.php
SwatCellRenderer.getHtmlHeadEntrySet
public function getHtmlHeadEntrySet() { if ($this->render_count > 0) { $set = new SwatHtmlHeadEntrySet($this->html_head_entry_set); } else { $set = new SwatHtmlHeadEntrySet(); } return $set; }
php
public function getHtmlHeadEntrySet() { if ($this->render_count > 0) { $set = new SwatHtmlHeadEntrySet($this->html_head_entry_set); } else { $set = new SwatHtmlHeadEntrySet(); } return $set; }
[ "public", "function", "getHtmlHeadEntrySet", "(", ")", "{", "if", "(", "$", "this", "->", "render_count", ">", "0", ")", "{", "$", "set", "=", "new", "SwatHtmlHeadEntrySet", "(", "$", "this", "->", "html_head_entry_set", ")", ";", "}", "else", "{", "$", "set", "=", "new", "SwatHtmlHeadEntrySet", "(", ")", ";", "}", "return", "$", "set", ";", "}" ]
Gets the SwatHtmlHeadEntry objects needed by this cell renderer If this renderer has never been rendered, an empty set is returned to reduce the number of required HTTP requests. @return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects needed by this cell renderer.
[ "Gets", "the", "SwatHtmlHeadEntry", "objects", "needed", "by", "this", "cell", "renderer" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCellRenderer.php#L235-L244
33,439
silverorange/swat
Swat/SwatCellRenderer.php
SwatCellRenderer.getInheritanceCSSClassNames
final public function getInheritanceCSSClassNames() { $php_class_name = get_class($this); $css_class_names = array(); // get the ancestors that are swat classes while ($php_class_name !== 'SwatCellRenderer') { if (strncmp($php_class_name, 'Swat', 4) === 0) { $css_class_name = mb_strtolower( preg_replace('/([A-Z])/u', '-\1', $php_class_name) ); if (mb_substr($css_class_name, 0, 1) === '-') { $css_class_name = mb_substr($css_class_name, 1); } array_unshift($css_class_names, $css_class_name); } $php_class_name = get_parent_class($php_class_name); } return $css_class_names; }
php
final public function getInheritanceCSSClassNames() { $php_class_name = get_class($this); $css_class_names = array(); // get the ancestors that are swat classes while ($php_class_name !== 'SwatCellRenderer') { if (strncmp($php_class_name, 'Swat', 4) === 0) { $css_class_name = mb_strtolower( preg_replace('/([A-Z])/u', '-\1', $php_class_name) ); if (mb_substr($css_class_name, 0, 1) === '-') { $css_class_name = mb_substr($css_class_name, 1); } array_unshift($css_class_names, $css_class_name); } $php_class_name = get_parent_class($php_class_name); } return $css_class_names; }
[ "final", "public", "function", "getInheritanceCSSClassNames", "(", ")", "{", "$", "php_class_name", "=", "get_class", "(", "$", "this", ")", ";", "$", "css_class_names", "=", "array", "(", ")", ";", "// get the ancestors that are swat classes", "while", "(", "$", "php_class_name", "!==", "'SwatCellRenderer'", ")", "{", "if", "(", "strncmp", "(", "$", "php_class_name", ",", "'Swat'", ",", "4", ")", "===", "0", ")", "{", "$", "css_class_name", "=", "mb_strtolower", "(", "preg_replace", "(", "'/([A-Z])/u'", ",", "'-\\1'", ",", "$", "php_class_name", ")", ")", ";", "if", "(", "mb_substr", "(", "$", "css_class_name", ",", "0", ",", "1", ")", "===", "'-'", ")", "{", "$", "css_class_name", "=", "mb_substr", "(", "$", "css_class_name", ",", "1", ")", ";", "}", "array_unshift", "(", "$", "css_class_names", ",", "$", "css_class_name", ")", ";", "}", "$", "php_class_name", "=", "get_parent_class", "(", "$", "php_class_name", ")", ";", "}", "return", "$", "css_class_names", ";", "}" ]
Gets the CSS class names of this cell renderer based on the inheritance tree for this cell renderer For example, a class with the following ancestry: SwatCellRenderer -> SwatTextCellRenderer -> SwatNullTextCellRenderer will return the following array of class names: <code> array( 'swat-cell-renderer', 'swat-text-cell-renderer', 'swat-null-text-cell-renderer', ); </code> @return array the array of CSS class names based on an inheritance tree for this cell renderer.
[ "Gets", "the", "CSS", "class", "names", "of", "this", "cell", "renderer", "based", "on", "the", "inheritance", "tree", "for", "this", "cell", "renderer" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCellRenderer.php#L306-L328
33,440
silverorange/swat
Swat/SwatCellRenderer.php
SwatCellRenderer.addCompositeRenderer
final protected function addCompositeRenderer( SwatCellRenderer $renderer, $key ) { if (array_key_exists($key, $this->composite_renderers)) { throw new SwatDuplicateIdException( sprintf( "A composite renderer with the key '%s' already exists in " . "this renderer.", $key ), 0, $key ); } if ($renderer->parent !== null) { throw new SwatException( 'Cannot add a composite renderer that ' . 'already has a parent.' ); } $this->composite_renderers[$key] = $renderer; $renderer->parent = $this; }
php
final protected function addCompositeRenderer( SwatCellRenderer $renderer, $key ) { if (array_key_exists($key, $this->composite_renderers)) { throw new SwatDuplicateIdException( sprintf( "A composite renderer with the key '%s' already exists in " . "this renderer.", $key ), 0, $key ); } if ($renderer->parent !== null) { throw new SwatException( 'Cannot add a composite renderer that ' . 'already has a parent.' ); } $this->composite_renderers[$key] = $renderer; $renderer->parent = $this; }
[ "final", "protected", "function", "addCompositeRenderer", "(", "SwatCellRenderer", "$", "renderer", ",", "$", "key", ")", "{", "if", "(", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "composite_renderers", ")", ")", "{", "throw", "new", "SwatDuplicateIdException", "(", "sprintf", "(", "\"A composite renderer with the key '%s' already exists in \"", ".", "\"this renderer.\"", ",", "$", "key", ")", ",", "0", ",", "$", "key", ")", ";", "}", "if", "(", "$", "renderer", "->", "parent", "!==", "null", ")", "{", "throw", "new", "SwatException", "(", "'Cannot add a composite renderer that '", ".", "'already has a parent.'", ")", ";", "}", "$", "this", "->", "composite_renderers", "[", "$", "key", "]", "=", "$", "renderer", ";", "$", "renderer", "->", "parent", "=", "$", "this", ";", "}" ]
Adds a composite a renderer to this renderer @param SwatCellRenderer $renderer the composite renderer to add. @param string $key a key identifying the renderer so it may be retrieved later. The key has to be unique within this renderer relative to the keys of other composite renderers. @throws SwatDuplicateIdException if a composite renderer with the specified key is already added to this renderer. @throws SwatException if the specified renderer is already the child of another object.
[ "Adds", "a", "composite", "a", "renderer", "to", "this", "renderer" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCellRenderer.php#L360-L385
33,441
silverorange/swat
Swat/SwatCellRenderer.php
SwatCellRenderer.getCompositeRenderer
final protected function getCompositeRenderer($key) { $this->confirmCompositeRenderers(); if (!array_key_exists($key, $this->composite_renderers)) { throw new SwatWidgetNotFoundException( sprintf( "Composite renderer with key of '%s' not found in %s. Make " . "sure the composite renderer was created and added to this " . "renderer.", $key, get_class($this) ), 0, $key ); } return $this->composite_renderers[$key]; }
php
final protected function getCompositeRenderer($key) { $this->confirmCompositeRenderers(); if (!array_key_exists($key, $this->composite_renderers)) { throw new SwatWidgetNotFoundException( sprintf( "Composite renderer with key of '%s' not found in %s. Make " . "sure the composite renderer was created and added to this " . "renderer.", $key, get_class($this) ), 0, $key ); } return $this->composite_renderers[$key]; }
[ "final", "protected", "function", "getCompositeRenderer", "(", "$", "key", ")", "{", "$", "this", "->", "confirmCompositeRenderers", "(", ")", ";", "if", "(", "!", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "composite_renderers", ")", ")", "{", "throw", "new", "SwatWidgetNotFoundException", "(", "sprintf", "(", "\"Composite renderer with key of '%s' not found in %s. Make \"", ".", "\"sure the composite renderer was created and added to this \"", ".", "\"renderer.\"", ",", "$", "key", ",", "get_class", "(", "$", "this", ")", ")", ",", "0", ",", "$", "key", ")", ";", "}", "return", "$", "this", "->", "composite_renderers", "[", "$", "key", "]", ";", "}" ]
Gets a composite renderer of this renderer by the composite renderer's key This is used by other methods to retrieve a specific composite renderer. This method ensures composite renderers are created before trying to retrieve the specified renderer. @param string $key the key of the composite renderer to get. @return SwatCellRenderer the specified composite renderer. @throws SwatWidgetNotFoundException if no composite renderer with the specified key exists in this renderer.
[ "Gets", "a", "composite", "renderer", "of", "this", "renderer", "by", "the", "composite", "renderer", "s", "key" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCellRenderer.php#L406-L425
33,442
silverorange/swat
Swat/SwatCellRenderer.php
SwatCellRenderer.getCompositeRenderers
final protected function getCompositeRenderers($class_name = null) { $this->confirmCompositeRenderers(); if ( !( $class_name === null || class_exists($class_name) || interface_exists($class_name) ) ) { return array(); } $out = array(); foreach ($this->composite_renderers as $key => $renderer) { if ($class_name === null || $renderer instanceof $class_name) { $out[$key] = $renderer; } } return $out; }
php
final protected function getCompositeRenderers($class_name = null) { $this->confirmCompositeRenderers(); if ( !( $class_name === null || class_exists($class_name) || interface_exists($class_name) ) ) { return array(); } $out = array(); foreach ($this->composite_renderers as $key => $renderer) { if ($class_name === null || $renderer instanceof $class_name) { $out[$key] = $renderer; } } return $out; }
[ "final", "protected", "function", "getCompositeRenderers", "(", "$", "class_name", "=", "null", ")", "{", "$", "this", "->", "confirmCompositeRenderers", "(", ")", ";", "if", "(", "!", "(", "$", "class_name", "===", "null", "||", "class_exists", "(", "$", "class_name", ")", "||", "interface_exists", "(", "$", "class_name", ")", ")", ")", "{", "return", "array", "(", ")", ";", "}", "$", "out", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "composite_renderers", "as", "$", "key", "=>", "$", "renderer", ")", "{", "if", "(", "$", "class_name", "===", "null", "||", "$", "renderer", "instanceof", "$", "class_name", ")", "{", "$", "out", "[", "$", "key", "]", "=", "$", "renderer", ";", "}", "}", "return", "$", "out", ";", "}" ]
Gets all composite renderers added to this renderer This method ensures composite renderers are created before retrieving the renderers. @param string $class_name optional class name. If set, only renderers that are instances of <code>$class_name</code> are returned. @return array all composite wigets added to this renderer. The array is indexed by the composite renderer keys. @see SwatCellRenderer::addCompositeRenderer()
[ "Gets", "all", "composite", "renderers", "added", "to", "this", "renderer" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCellRenderer.php#L445-L468
33,443
silverorange/swat
Swat/SwatCellRenderer.php
SwatCellRenderer.makePropertyStatic
final protected function makePropertyStatic($property_name) { $reflector = new ReflectionObject($this); if ($reflector->hasProperty($property_name)) { $property = $reflector->getProperty($property_name); if ($property->isPublic() && !$property->isStatic()) { $this->static_properties[] = $property_name; } else { throw new SwatInvalidPropertyException( "Property {$property_name} is not a non-static public " . "property and cannot be made static.", 0, $this, $property_name ); } } else { throw new SwatInvalidPropertyException( "Can not make non-existant property {$property_name} static.", 0, $this, $property_name ); } }
php
final protected function makePropertyStatic($property_name) { $reflector = new ReflectionObject($this); if ($reflector->hasProperty($property_name)) { $property = $reflector->getProperty($property_name); if ($property->isPublic() && !$property->isStatic()) { $this->static_properties[] = $property_name; } else { throw new SwatInvalidPropertyException( "Property {$property_name} is not a non-static public " . "property and cannot be made static.", 0, $this, $property_name ); } } else { throw new SwatInvalidPropertyException( "Can not make non-existant property {$property_name} static.", 0, $this, $property_name ); } }
[ "final", "protected", "function", "makePropertyStatic", "(", "$", "property_name", ")", "{", "$", "reflector", "=", "new", "ReflectionObject", "(", "$", "this", ")", ";", "if", "(", "$", "reflector", "->", "hasProperty", "(", "$", "property_name", ")", ")", "{", "$", "property", "=", "$", "reflector", "->", "getProperty", "(", "$", "property_name", ")", ";", "if", "(", "$", "property", "->", "isPublic", "(", ")", "&&", "!", "$", "property", "->", "isStatic", "(", ")", ")", "{", "$", "this", "->", "static_properties", "[", "]", "=", "$", "property_name", ";", "}", "else", "{", "throw", "new", "SwatInvalidPropertyException", "(", "\"Property {$property_name} is not a non-static public \"", ".", "\"property and cannot be made static.\"", ",", "0", ",", "$", "this", ",", "$", "property_name", ")", ";", "}", "}", "else", "{", "throw", "new", "SwatInvalidPropertyException", "(", "\"Can not make non-existant property {$property_name} static.\"", ",", "0", ",", "$", "this", ",", "$", "property_name", ")", ";", "}", "}" ]
Make a public property static This method takes a property name and marks it as static, meaning that a user can not data-map this property. @param $property_name string the property name @see SwatCellRenderer::isPropertyStatic() @throws SwatInvalidPropertyException if the specified <i>$property_name</i> is not a non-static public property of this class.
[ "Make", "a", "public", "property", "static" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCellRenderer.php#L512-L536
33,444
brainworxx/kreXX
src/Analyse/Code/Codegen.php
Codegen.generateSource
public function generateSource(Model $model) { if ($this->allowCodegen === true) { // We handle the first one special, because we need to add the original // variable name to the source generation. if ($this->firstRun === true) { $this->firstRun = false; return $this->concatenation($model); } // Test for constants. // They have no connectors, but are marked as such. // although this is meta stuff, we need to add the stop info here. if ($model->getIsMetaConstants() === true) { // We must only take the stuff from the constant itself return ';stop;'; } $connectors = $model->getConnectorLeft() . $model->getConnectorRight(); if (empty($connectors) === true) { // No connectors, no nothing. We must be dealing with meta stuff. // We will ignore this one. return ''; } // Debug methods are always public. if ($model->getType() === static::TYPE_DEBUG_METHOD) { return $this->concatenation($model); } // Multi line code generation starts here. if ($model->getMultiLineCodeGen() === static::ITERATOR_TO_ARRAY) { return 'iterator_to_array(;firstMarker;)' . $this->concatenation($model); } // Test for private or protected access. if ($model->getIsPublic() === true) { return $this->concatenation($model); } // Test if we are inside the scope. Everything within our scope is reachable. if ($this->pool->scope->testModelForCodegen($model) === true) { // We are inside the scope, this value, function or class is reachable. return $this->concatenation($model); } // We are still here? Must be a protected method or property. // The '. . .' will tell the code generation to stop in it's tracks // and do nothing. } // No code generation in this path. // We must prevent code generation when copying stuff here by recursion // resolving by adding these dots. return static::UNKNOWN_VALUE; }
php
public function generateSource(Model $model) { if ($this->allowCodegen === true) { // We handle the first one special, because we need to add the original // variable name to the source generation. if ($this->firstRun === true) { $this->firstRun = false; return $this->concatenation($model); } // Test for constants. // They have no connectors, but are marked as such. // although this is meta stuff, we need to add the stop info here. if ($model->getIsMetaConstants() === true) { // We must only take the stuff from the constant itself return ';stop;'; } $connectors = $model->getConnectorLeft() . $model->getConnectorRight(); if (empty($connectors) === true) { // No connectors, no nothing. We must be dealing with meta stuff. // We will ignore this one. return ''; } // Debug methods are always public. if ($model->getType() === static::TYPE_DEBUG_METHOD) { return $this->concatenation($model); } // Multi line code generation starts here. if ($model->getMultiLineCodeGen() === static::ITERATOR_TO_ARRAY) { return 'iterator_to_array(;firstMarker;)' . $this->concatenation($model); } // Test for private or protected access. if ($model->getIsPublic() === true) { return $this->concatenation($model); } // Test if we are inside the scope. Everything within our scope is reachable. if ($this->pool->scope->testModelForCodegen($model) === true) { // We are inside the scope, this value, function or class is reachable. return $this->concatenation($model); } // We are still here? Must be a protected method or property. // The '. . .' will tell the code generation to stop in it's tracks // and do nothing. } // No code generation in this path. // We must prevent code generation when copying stuff here by recursion // resolving by adding these dots. return static::UNKNOWN_VALUE; }
[ "public", "function", "generateSource", "(", "Model", "$", "model", ")", "{", "if", "(", "$", "this", "->", "allowCodegen", "===", "true", ")", "{", "// We handle the first one special, because we need to add the original", "// variable name to the source generation.", "if", "(", "$", "this", "->", "firstRun", "===", "true", ")", "{", "$", "this", "->", "firstRun", "=", "false", ";", "return", "$", "this", "->", "concatenation", "(", "$", "model", ")", ";", "}", "// Test for constants.", "// They have no connectors, but are marked as such.", "// although this is meta stuff, we need to add the stop info here.", "if", "(", "$", "model", "->", "getIsMetaConstants", "(", ")", "===", "true", ")", "{", "// We must only take the stuff from the constant itself", "return", "';stop;'", ";", "}", "$", "connectors", "=", "$", "model", "->", "getConnectorLeft", "(", ")", ".", "$", "model", "->", "getConnectorRight", "(", ")", ";", "if", "(", "empty", "(", "$", "connectors", ")", "===", "true", ")", "{", "// No connectors, no nothing. We must be dealing with meta stuff.", "// We will ignore this one.", "return", "''", ";", "}", "// Debug methods are always public.", "if", "(", "$", "model", "->", "getType", "(", ")", "===", "static", "::", "TYPE_DEBUG_METHOD", ")", "{", "return", "$", "this", "->", "concatenation", "(", "$", "model", ")", ";", "}", "// Multi line code generation starts here.", "if", "(", "$", "model", "->", "getMultiLineCodeGen", "(", ")", "===", "static", "::", "ITERATOR_TO_ARRAY", ")", "{", "return", "'iterator_to_array(;firstMarker;)'", ".", "$", "this", "->", "concatenation", "(", "$", "model", ")", ";", "}", "// Test for private or protected access.", "if", "(", "$", "model", "->", "getIsPublic", "(", ")", "===", "true", ")", "{", "return", "$", "this", "->", "concatenation", "(", "$", "model", ")", ";", "}", "// Test if we are inside the scope. Everything within our scope is reachable.", "if", "(", "$", "this", "->", "pool", "->", "scope", "->", "testModelForCodegen", "(", "$", "model", ")", "===", "true", ")", "{", "// We are inside the scope, this value, function or class is reachable.", "return", "$", "this", "->", "concatenation", "(", "$", "model", ")", ";", "}", "// We are still here? Must be a protected method or property.", "// The '. . .' will tell the code generation to stop in it's tracks", "// and do nothing.", "}", "// No code generation in this path.", "// We must prevent code generation when copying stuff here by recursion", "// resolving by adding these dots.", "return", "static", "::", "UNKNOWN_VALUE", ";", "}" ]
Generates PHP sourcecode. From the 2 connectors and from the name of name/key of the attribute we can generate PHP code to actually reach the corresponding value. This function generates this code. @param \Brainworxx\Krexx\Analyse\Model $model The model, which hosts all the data we need. @return string The generated PHP source.
[ "Generates", "PHP", "sourcecode", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Code/Codegen.php#L102-L157
33,445
brainworxx/kreXX
src/Analyse/Code/Codegen.php
Codegen.concatenation
protected function concatenation(Model $model) { // We simply add the connectors for public access. return $model->getConnectorLeft() . $this->pool->encodingService->encodeStringForCodeGeneration($model->getName()) . $model->getConnectorRight(); }
php
protected function concatenation(Model $model) { // We simply add the connectors for public access. return $model->getConnectorLeft() . $this->pool->encodingService->encodeStringForCodeGeneration($model->getName()) . $model->getConnectorRight(); }
[ "protected", "function", "concatenation", "(", "Model", "$", "model", ")", "{", "// We simply add the connectors for public access.", "return", "$", "model", "->", "getConnectorLeft", "(", ")", ".", "$", "this", "->", "pool", "->", "encodingService", "->", "encodeStringForCodeGeneration", "(", "$", "model", "->", "getName", "(", ")", ")", ".", "$", "model", "->", "getConnectorRight", "(", ")", ";", "}" ]
Simple concatenation of all parameters. @param \Brainworxx\Krexx\Analyse\Model $model @return string The generated code.
[ "Simple", "concatenation", "of", "all", "parameters", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Code/Codegen.php#L191-L197
33,446
silverorange/swat
Swat/SwatRadioTable.php
SwatRadioTable.displayRadioTableOption
protected function displayRadioTableOption(SwatOption $option, $index) { $tr_tag = $this->getTrTag($option, $index); // add option-specific CSS classes from option metadata $classes = $this->getOptionMetadata($option, 'classes'); if (is_array($classes)) { $tr_tag->class = implode(' ', $classes); } elseif ($classes) { $tr_tag->class = strval($classes); } $tr_tag->open(); if ($option instanceof SwatFlydownDivider) { echo '<td class="swat-radio-table-input">'; echo '&nbsp;'; echo '</td><td class="swat-radio-table-label">'; $this->displayDivider($option, $index); echo '</td>'; } else { echo '<td class="swat-radio-table-input">'; $this->displayOption($option, $index); printf( '</td><td id="%s" class="swat-radio-table-label">', $this->id . '_' . (string) $option->value . '_label' ); $this->displayOptionLabel($option, $index); echo '</td>'; } $tr_tag->close(); }
php
protected function displayRadioTableOption(SwatOption $option, $index) { $tr_tag = $this->getTrTag($option, $index); // add option-specific CSS classes from option metadata $classes = $this->getOptionMetadata($option, 'classes'); if (is_array($classes)) { $tr_tag->class = implode(' ', $classes); } elseif ($classes) { $tr_tag->class = strval($classes); } $tr_tag->open(); if ($option instanceof SwatFlydownDivider) { echo '<td class="swat-radio-table-input">'; echo '&nbsp;'; echo '</td><td class="swat-radio-table-label">'; $this->displayDivider($option, $index); echo '</td>'; } else { echo '<td class="swat-radio-table-input">'; $this->displayOption($option, $index); printf( '</td><td id="%s" class="swat-radio-table-label">', $this->id . '_' . (string) $option->value . '_label' ); $this->displayOptionLabel($option, $index); echo '</td>'; } $tr_tag->close(); }
[ "protected", "function", "displayRadioTableOption", "(", "SwatOption", "$", "option", ",", "$", "index", ")", "{", "$", "tr_tag", "=", "$", "this", "->", "getTrTag", "(", "$", "option", ",", "$", "index", ")", ";", "// add option-specific CSS classes from option metadata", "$", "classes", "=", "$", "this", "->", "getOptionMetadata", "(", "$", "option", ",", "'classes'", ")", ";", "if", "(", "is_array", "(", "$", "classes", ")", ")", "{", "$", "tr_tag", "->", "class", "=", "implode", "(", "' '", ",", "$", "classes", ")", ";", "}", "elseif", "(", "$", "classes", ")", "{", "$", "tr_tag", "->", "class", "=", "strval", "(", "$", "classes", ")", ";", "}", "$", "tr_tag", "->", "open", "(", ")", ";", "if", "(", "$", "option", "instanceof", "SwatFlydownDivider", ")", "{", "echo", "'<td class=\"swat-radio-table-input\">'", ";", "echo", "'&nbsp;'", ";", "echo", "'</td><td class=\"swat-radio-table-label\">'", ";", "$", "this", "->", "displayDivider", "(", "$", "option", ",", "$", "index", ")", ";", "echo", "'</td>'", ";", "}", "else", "{", "echo", "'<td class=\"swat-radio-table-input\">'", ";", "$", "this", "->", "displayOption", "(", "$", "option", ",", "$", "index", ")", ";", "printf", "(", "'</td><td id=\"%s\" class=\"swat-radio-table-label\">'", ",", "$", "this", "->", "id", ".", "'_'", ".", "(", "string", ")", "$", "option", "->", "value", ".", "'_label'", ")", ";", "$", "this", "->", "displayOptionLabel", "(", "$", "option", ",", "$", "index", ")", ";", "echo", "'</td>'", ";", "}", "$", "tr_tag", "->", "close", "(", ")", ";", "}" ]
Displays a single option in this radio table @param SwatOption $option the option to display. @param integer $index the numeric index of the option in this list. Starts at 0.
[ "Displays", "a", "single", "option", "in", "this", "radio", "table" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatRadioTable.php#L74-L107
33,447
vaniocz/vanio-domain-bundle
Request/GetPostParamConverter.php
GetPostParamConverter.resolveRouteParameters
private function resolveRouteParameters(array $attributes): array { if (!isset($attributes['_route'])) { return []; } $routeParameters = array_keys($attributes['_route_params']); $routeParameters = array_combine($routeParameters, $routeParameters); if (!$this->annotatedRouteControllerLoader) { return $routeParameters; } // AnnotatedRouteControllerLoader from BeSimpleI18nRoutingBundle loads routes differently than the default one from Symfony. // It populates _route_params with all default parameter values from controller action even with ones which placeholders are not present in route definition. // The following workaround relies on the fact that URL generator generates URL with parameters which placeholders are not present in route definition as query string. // @see https://github.com/BeSimple/BeSimpleI18nRoutingBundle/blob/83d2cf7c9ba6e6e3caed5d063b185ae54645eeee/src/Routing/Loader/AnnotatedRouteControllerLoader.php#L43 // @see https://github.com/symfony/symfony/blob/8ab7077225eadee444ba76c83c667688763c56fb/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php#L202 if ($this->configurableUrlGenerator) { $isStrictRequirements = $this->configurableUrlGenerator->isStrictRequirements(); $this->configurableUrlGenerator->setStrictRequirements(null); } $url = $this->urlGenerator->generate($attributes['_route'], $routeParameters); if (isset($isStrictRequirements)) { $this->configurableUrlGenerator->setStrictRequirements($isStrictRequirements); } parse_str(parse_url($url, PHP_URL_QUERY), $additionalAttributes); return array_diff_key($routeParameters, $additionalAttributes); }
php
private function resolveRouteParameters(array $attributes): array { if (!isset($attributes['_route'])) { return []; } $routeParameters = array_keys($attributes['_route_params']); $routeParameters = array_combine($routeParameters, $routeParameters); if (!$this->annotatedRouteControllerLoader) { return $routeParameters; } // AnnotatedRouteControllerLoader from BeSimpleI18nRoutingBundle loads routes differently than the default one from Symfony. // It populates _route_params with all default parameter values from controller action even with ones which placeholders are not present in route definition. // The following workaround relies on the fact that URL generator generates URL with parameters which placeholders are not present in route definition as query string. // @see https://github.com/BeSimple/BeSimpleI18nRoutingBundle/blob/83d2cf7c9ba6e6e3caed5d063b185ae54645eeee/src/Routing/Loader/AnnotatedRouteControllerLoader.php#L43 // @see https://github.com/symfony/symfony/blob/8ab7077225eadee444ba76c83c667688763c56fb/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php#L202 if ($this->configurableUrlGenerator) { $isStrictRequirements = $this->configurableUrlGenerator->isStrictRequirements(); $this->configurableUrlGenerator->setStrictRequirements(null); } $url = $this->urlGenerator->generate($attributes['_route'], $routeParameters); if (isset($isStrictRequirements)) { $this->configurableUrlGenerator->setStrictRequirements($isStrictRequirements); } parse_str(parse_url($url, PHP_URL_QUERY), $additionalAttributes); return array_diff_key($routeParameters, $additionalAttributes); }
[ "private", "function", "resolveRouteParameters", "(", "array", "$", "attributes", ")", ":", "array", "{", "if", "(", "!", "isset", "(", "$", "attributes", "[", "'_route'", "]", ")", ")", "{", "return", "[", "]", ";", "}", "$", "routeParameters", "=", "array_keys", "(", "$", "attributes", "[", "'_route_params'", "]", ")", ";", "$", "routeParameters", "=", "array_combine", "(", "$", "routeParameters", ",", "$", "routeParameters", ")", ";", "if", "(", "!", "$", "this", "->", "annotatedRouteControllerLoader", ")", "{", "return", "$", "routeParameters", ";", "}", "// AnnotatedRouteControllerLoader from BeSimpleI18nRoutingBundle loads routes differently than the default one from Symfony.", "// It populates _route_params with all default parameter values from controller action even with ones which placeholders are not present in route definition.", "// The following workaround relies on the fact that URL generator generates URL with parameters which placeholders are not present in route definition as query string.", "// @see https://github.com/BeSimple/BeSimpleI18nRoutingBundle/blob/83d2cf7c9ba6e6e3caed5d063b185ae54645eeee/src/Routing/Loader/AnnotatedRouteControllerLoader.php#L43", "// @see https://github.com/symfony/symfony/blob/8ab7077225eadee444ba76c83c667688763c56fb/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php#L202", "if", "(", "$", "this", "->", "configurableUrlGenerator", ")", "{", "$", "isStrictRequirements", "=", "$", "this", "->", "configurableUrlGenerator", "->", "isStrictRequirements", "(", ")", ";", "$", "this", "->", "configurableUrlGenerator", "->", "setStrictRequirements", "(", "null", ")", ";", "}", "$", "url", "=", "$", "this", "->", "urlGenerator", "->", "generate", "(", "$", "attributes", "[", "'_route'", "]", ",", "$", "routeParameters", ")", ";", "if", "(", "isset", "(", "$", "isStrictRequirements", ")", ")", "{", "$", "this", "->", "configurableUrlGenerator", "->", "setStrictRequirements", "(", "$", "isStrictRequirements", ")", ";", "}", "parse_str", "(", "parse_url", "(", "$", "url", ",", "PHP_URL_QUERY", ")", ",", "$", "additionalAttributes", ")", ";", "return", "array_diff_key", "(", "$", "routeParameters", ",", "$", "additionalAttributes", ")", ";", "}" ]
Returns an array of route parameters which placeholders arepresent in route definition. @param mixed[] $attributes @return string[]
[ "Returns", "an", "array", "of", "route", "parameters", "which", "placeholders", "arepresent", "in", "route", "definition", "." ]
3eee57327c0a2f41f249868799b40505b5ef4717
https://github.com/vaniocz/vanio-domain-bundle/blob/3eee57327c0a2f41f249868799b40505b5ef4717/Request/GetPostParamConverter.php#L103-L136
33,448
silverorange/swat
Swat/SwatControl.php
SwatControl.addMessage
public function addMessage(SwatMessage $message) { if ($this->parent instanceof SwatTitleable) { $title = $this->parent->getTitle(); if ($title === null) { $field_title = ''; } else { if ($this->parent->getTitleContentType() === 'text/xml') { $field_title = '<strong>' . $this->parent->getTitle() . '</strong>'; } else { $field_title = '<strong>' . SwatString::minimizeEntities( $this->parent->getTitle() ) . '</strong>'; } } } else { $field_title = ''; } if ($message->content_type === 'text/plain') { $content = SwatString::minimizeEntities($message->primary_content); } else { $content = $message->primary_content; } $message->primary_content = sprintf($content, $field_title); $message->content_type = 'text/xml'; parent::addMessage($message); }
php
public function addMessage(SwatMessage $message) { if ($this->parent instanceof SwatTitleable) { $title = $this->parent->getTitle(); if ($title === null) { $field_title = ''; } else { if ($this->parent->getTitleContentType() === 'text/xml') { $field_title = '<strong>' . $this->parent->getTitle() . '</strong>'; } else { $field_title = '<strong>' . SwatString::minimizeEntities( $this->parent->getTitle() ) . '</strong>'; } } } else { $field_title = ''; } if ($message->content_type === 'text/plain') { $content = SwatString::minimizeEntities($message->primary_content); } else { $content = $message->primary_content; } $message->primary_content = sprintf($content, $field_title); $message->content_type = 'text/xml'; parent::addMessage($message); }
[ "public", "function", "addMessage", "(", "SwatMessage", "$", "message", ")", "{", "if", "(", "$", "this", "->", "parent", "instanceof", "SwatTitleable", ")", "{", "$", "title", "=", "$", "this", "->", "parent", "->", "getTitle", "(", ")", ";", "if", "(", "$", "title", "===", "null", ")", "{", "$", "field_title", "=", "''", ";", "}", "else", "{", "if", "(", "$", "this", "->", "parent", "->", "getTitleContentType", "(", ")", "===", "'text/xml'", ")", "{", "$", "field_title", "=", "'<strong>'", ".", "$", "this", "->", "parent", "->", "getTitle", "(", ")", ".", "'</strong>'", ";", "}", "else", "{", "$", "field_title", "=", "'<strong>'", ".", "SwatString", "::", "minimizeEntities", "(", "$", "this", "->", "parent", "->", "getTitle", "(", ")", ")", ".", "'</strong>'", ";", "}", "}", "}", "else", "{", "$", "field_title", "=", "''", ";", "}", "if", "(", "$", "message", "->", "content_type", "===", "'text/plain'", ")", "{", "$", "content", "=", "SwatString", "::", "minimizeEntities", "(", "$", "message", "->", "primary_content", ")", ";", "}", "else", "{", "$", "content", "=", "$", "message", "->", "primary_content", ";", "}", "$", "message", "->", "primary_content", "=", "sprintf", "(", "$", "content", ",", "$", "field_title", ")", ";", "$", "message", "->", "content_type", "=", "'text/xml'", ";", "parent", "::", "addMessage", "(", "$", "message", ")", ";", "}" ]
Adds a message to this control Before the message is added, the content is updated with the name of this controls's parent title field if the parent implements the {@link SwatTitleable} interface. @param SwatMessage $message the message to add. @see SwatWidget::addMessage()
[ "Adds", "a", "message", "to", "this", "control" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatControl.php#L25-L58
33,449
brainworxx/kreXX
src/Analyse/Callback/Iterate/ThroughMethods.php
ThroughMethods.callMe
public function callMe() { $result = $this->dispatchStartEvent(); /** @var \Brainworxx\Krexx\Service\Reflection\ReflectionClass $reflectionClass */ $reflectionClass = $this->parameters[static::PARAM_REF]; $commentAnalysis = $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Comment\\Methods'); // Deep analysis of the methods. /** @var \ReflectionMethod $reflectionMethod */ foreach ($this->parameters[static::PARAM_DATA] as $reflectionMethod) { $methodData = array(); // Get the comment from the class, it's parents, interfaces or traits. $methodComment = $commentAnalysis->getComment($reflectionMethod, $reflectionClass); if (empty($methodComment) === false) { $methodData[static::META_COMMENT] = $methodComment; } // Get declaration place. $declaringClass = $reflectionMethod->getDeclaringClass(); $methodData[static::META_DECLARED_IN] = $this->getDeclarationPlace($reflectionMethod, $declaringClass); // Get parameters. $paramList = ''; foreach ($reflectionMethod->getParameters() as $key => $reflectionParameter) { ++$key; $paramList .= $methodData[static::META_PARAM_NO . $key] = $this->pool ->codegenHandler ->parameterToString($reflectionParameter); // We add a comma to the parameter list, to separate them for a // better readability. $paramList .= ', '; } // Get declaring keywords. $methodData['declaration keywords'] = $this->getDeclarationKeywords( $reflectionMethod, $declaringClass, $reflectionClass ); // Get the connector. if ($reflectionMethod->isStatic() === true) { $connectorType = Connectors::STATIC_METHOD; } else { $connectorType = Connectors::METHOD; } // Update the reflection method, so an event subscriber can do // something with it. $this->parameters[static::PARAM_REF_METHOD] = $reflectionMethod; // Render it! $result .= $this->pool->render->renderExpandableChild( $this->dispatchEventWithModel( __FUNCTION__ . static::EVENT_MARKER_END, $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setName($reflectionMethod->name) ->setType($methodData['declaration keywords'] . static::TYPE_METHOD) ->setConnectorType($connectorType) // Remove the ',' after the last char. ->setConnectorParameters(trim($paramList, ', ')) ->addParameter(static::PARAM_DATA, $methodData) ->setIsPublic($reflectionMethod->isPublic()) ->injectCallback( $this->pool->createClass( 'Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughMethodAnalysis' ) ) ) ); } return $result; }
php
public function callMe() { $result = $this->dispatchStartEvent(); /** @var \Brainworxx\Krexx\Service\Reflection\ReflectionClass $reflectionClass */ $reflectionClass = $this->parameters[static::PARAM_REF]; $commentAnalysis = $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Comment\\Methods'); // Deep analysis of the methods. /** @var \ReflectionMethod $reflectionMethod */ foreach ($this->parameters[static::PARAM_DATA] as $reflectionMethod) { $methodData = array(); // Get the comment from the class, it's parents, interfaces or traits. $methodComment = $commentAnalysis->getComment($reflectionMethod, $reflectionClass); if (empty($methodComment) === false) { $methodData[static::META_COMMENT] = $methodComment; } // Get declaration place. $declaringClass = $reflectionMethod->getDeclaringClass(); $methodData[static::META_DECLARED_IN] = $this->getDeclarationPlace($reflectionMethod, $declaringClass); // Get parameters. $paramList = ''; foreach ($reflectionMethod->getParameters() as $key => $reflectionParameter) { ++$key; $paramList .= $methodData[static::META_PARAM_NO . $key] = $this->pool ->codegenHandler ->parameterToString($reflectionParameter); // We add a comma to the parameter list, to separate them for a // better readability. $paramList .= ', '; } // Get declaring keywords. $methodData['declaration keywords'] = $this->getDeclarationKeywords( $reflectionMethod, $declaringClass, $reflectionClass ); // Get the connector. if ($reflectionMethod->isStatic() === true) { $connectorType = Connectors::STATIC_METHOD; } else { $connectorType = Connectors::METHOD; } // Update the reflection method, so an event subscriber can do // something with it. $this->parameters[static::PARAM_REF_METHOD] = $reflectionMethod; // Render it! $result .= $this->pool->render->renderExpandableChild( $this->dispatchEventWithModel( __FUNCTION__ . static::EVENT_MARKER_END, $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setName($reflectionMethod->name) ->setType($methodData['declaration keywords'] . static::TYPE_METHOD) ->setConnectorType($connectorType) // Remove the ',' after the last char. ->setConnectorParameters(trim($paramList, ', ')) ->addParameter(static::PARAM_DATA, $methodData) ->setIsPublic($reflectionMethod->isPublic()) ->injectCallback( $this->pool->createClass( 'Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughMethodAnalysis' ) ) ) ); } return $result; }
[ "public", "function", "callMe", "(", ")", "{", "$", "result", "=", "$", "this", "->", "dispatchStartEvent", "(", ")", ";", "/** @var \\Brainworxx\\Krexx\\Service\\Reflection\\ReflectionClass $reflectionClass */", "$", "reflectionClass", "=", "$", "this", "->", "parameters", "[", "static", "::", "PARAM_REF", "]", ";", "$", "commentAnalysis", "=", "$", "this", "->", "pool", "->", "createClass", "(", "'Brainworxx\\\\Krexx\\\\Analyse\\\\Comment\\\\Methods'", ")", ";", "// Deep analysis of the methods.", "/** @var \\ReflectionMethod $reflectionMethod */", "foreach", "(", "$", "this", "->", "parameters", "[", "static", "::", "PARAM_DATA", "]", "as", "$", "reflectionMethod", ")", "{", "$", "methodData", "=", "array", "(", ")", ";", "// Get the comment from the class, it's parents, interfaces or traits.", "$", "methodComment", "=", "$", "commentAnalysis", "->", "getComment", "(", "$", "reflectionMethod", ",", "$", "reflectionClass", ")", ";", "if", "(", "empty", "(", "$", "methodComment", ")", "===", "false", ")", "{", "$", "methodData", "[", "static", "::", "META_COMMENT", "]", "=", "$", "methodComment", ";", "}", "// Get declaration place.", "$", "declaringClass", "=", "$", "reflectionMethod", "->", "getDeclaringClass", "(", ")", ";", "$", "methodData", "[", "static", "::", "META_DECLARED_IN", "]", "=", "$", "this", "->", "getDeclarationPlace", "(", "$", "reflectionMethod", ",", "$", "declaringClass", ")", ";", "// Get parameters.", "$", "paramList", "=", "''", ";", "foreach", "(", "$", "reflectionMethod", "->", "getParameters", "(", ")", "as", "$", "key", "=>", "$", "reflectionParameter", ")", "{", "++", "$", "key", ";", "$", "paramList", ".=", "$", "methodData", "[", "static", "::", "META_PARAM_NO", ".", "$", "key", "]", "=", "$", "this", "->", "pool", "->", "codegenHandler", "->", "parameterToString", "(", "$", "reflectionParameter", ")", ";", "// We add a comma to the parameter list, to separate them for a", "// better readability.", "$", "paramList", ".=", "', '", ";", "}", "// Get declaring keywords.", "$", "methodData", "[", "'declaration keywords'", "]", "=", "$", "this", "->", "getDeclarationKeywords", "(", "$", "reflectionMethod", ",", "$", "declaringClass", ",", "$", "reflectionClass", ")", ";", "// Get the connector.", "if", "(", "$", "reflectionMethod", "->", "isStatic", "(", ")", "===", "true", ")", "{", "$", "connectorType", "=", "Connectors", "::", "STATIC_METHOD", ";", "}", "else", "{", "$", "connectorType", "=", "Connectors", "::", "METHOD", ";", "}", "// Update the reflection method, so an event subscriber can do", "// something with it.", "$", "this", "->", "parameters", "[", "static", "::", "PARAM_REF_METHOD", "]", "=", "$", "reflectionMethod", ";", "// Render it!", "$", "result", ".=", "$", "this", "->", "pool", "->", "render", "->", "renderExpandableChild", "(", "$", "this", "->", "dispatchEventWithModel", "(", "__FUNCTION__", ".", "static", "::", "EVENT_MARKER_END", ",", "$", "this", "->", "pool", "->", "createClass", "(", "'Brainworxx\\\\Krexx\\\\Analyse\\\\Model'", ")", "->", "setName", "(", "$", "reflectionMethod", "->", "name", ")", "->", "setType", "(", "$", "methodData", "[", "'declaration keywords'", "]", ".", "static", "::", "TYPE_METHOD", ")", "->", "setConnectorType", "(", "$", "connectorType", ")", "// Remove the ',' after the last char.", "->", "setConnectorParameters", "(", "trim", "(", "$", "paramList", ",", "', '", ")", ")", "->", "addParameter", "(", "static", "::", "PARAM_DATA", ",", "$", "methodData", ")", "->", "setIsPublic", "(", "$", "reflectionMethod", "->", "isPublic", "(", ")", ")", "->", "injectCallback", "(", "$", "this", "->", "pool", "->", "createClass", "(", "'Brainworxx\\\\Krexx\\\\Analyse\\\\Callback\\\\Iterate\\\\ThroughMethodAnalysis'", ")", ")", ")", ")", ";", "}", "return", "$", "result", ";", "}" ]
Simply start to iterate through the methods. @return string The rendered markup.
[ "Simply", "start", "to", "iterate", "through", "the", "methods", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Iterate/ThroughMethods.php#L63-L137
33,450
brainworxx/kreXX
src/Analyse/Callback/Iterate/ThroughMethods.php
ThroughMethods.getDeclarationPlace
protected function getDeclarationPlace(\ReflectionMethod $reflectionMethod, \ReflectionClass $declaringClass) { $filename = $this->pool->fileService->filterFilePath($reflectionMethod->getFileName()); if (empty($filename) === true) { return static::UNKNOWN_DECLARATION; } // If the filename of the $declaringClass and the $reflectionMethod differ, // we are facing a trait here. if ($reflectionMethod->getFileName() !== $declaringClass->getFileName() && method_exists($declaringClass, 'getTraits') ) { // There is no real clean way to get the name of the trait that we // are looking at. $traitName = ':: unable to get the trait name ::'; $trait = $this->retrieveDeclaringReflection($reflectionMethod, $declaringClass); if ($trait !== false) { $traitName = $trait->getName(); } return $filename . "\n" . 'in trait: ' . $traitName . "\n" . 'in line: ' . $reflectionMethod->getStartLine(); } else { return $filename . "\n" . 'in class: ' . $reflectionMethod->class . "\n" . 'in line: ' . $reflectionMethod->getStartLine(); } }
php
protected function getDeclarationPlace(\ReflectionMethod $reflectionMethod, \ReflectionClass $declaringClass) { $filename = $this->pool->fileService->filterFilePath($reflectionMethod->getFileName()); if (empty($filename) === true) { return static::UNKNOWN_DECLARATION; } // If the filename of the $declaringClass and the $reflectionMethod differ, // we are facing a trait here. if ($reflectionMethod->getFileName() !== $declaringClass->getFileName() && method_exists($declaringClass, 'getTraits') ) { // There is no real clean way to get the name of the trait that we // are looking at. $traitName = ':: unable to get the trait name ::'; $trait = $this->retrieveDeclaringReflection($reflectionMethod, $declaringClass); if ($trait !== false) { $traitName = $trait->getName(); } return $filename . "\n" . 'in trait: ' . $traitName . "\n" . 'in line: ' . $reflectionMethod->getStartLine(); } else { return $filename . "\n" . 'in class: ' . $reflectionMethod->class . "\n" . 'in line: ' . $reflectionMethod->getStartLine(); } }
[ "protected", "function", "getDeclarationPlace", "(", "\\", "ReflectionMethod", "$", "reflectionMethod", ",", "\\", "ReflectionClass", "$", "declaringClass", ")", "{", "$", "filename", "=", "$", "this", "->", "pool", "->", "fileService", "->", "filterFilePath", "(", "$", "reflectionMethod", "->", "getFileName", "(", ")", ")", ";", "if", "(", "empty", "(", "$", "filename", ")", "===", "true", ")", "{", "return", "static", "::", "UNKNOWN_DECLARATION", ";", "}", "// If the filename of the $declaringClass and the $reflectionMethod differ,", "// we are facing a trait here.", "if", "(", "$", "reflectionMethod", "->", "getFileName", "(", ")", "!==", "$", "declaringClass", "->", "getFileName", "(", ")", "&&", "method_exists", "(", "$", "declaringClass", ",", "'getTraits'", ")", ")", "{", "// There is no real clean way to get the name of the trait that we", "// are looking at.", "$", "traitName", "=", "':: unable to get the trait name ::'", ";", "$", "trait", "=", "$", "this", "->", "retrieveDeclaringReflection", "(", "$", "reflectionMethod", ",", "$", "declaringClass", ")", ";", "if", "(", "$", "trait", "!==", "false", ")", "{", "$", "traitName", "=", "$", "trait", "->", "getName", "(", ")", ";", "}", "return", "$", "filename", ".", "\"\\n\"", ".", "'in trait: '", ".", "$", "traitName", ".", "\"\\n\"", ".", "'in line: '", ".", "$", "reflectionMethod", "->", "getStartLine", "(", ")", ";", "}", "else", "{", "return", "$", "filename", ".", "\"\\n\"", ".", "'in class: '", ".", "$", "reflectionMethod", "->", "class", ".", "\"\\n\"", ".", "'in line: '", ".", "$", "reflectionMethod", "->", "getStartLine", "(", ")", ";", "}", "}" ]
Get the declaration place of this method. @param \ReflectionMethod $reflectionMethod Reflection of the method we are analysing. @param \ReflectionClass $declaringClass Reflection of the class we are analysing @return string The analysis result.
[ "Get", "the", "declaration", "place", "of", "this", "method", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Iterate/ThroughMethods.php#L150-L178
33,451
brainworxx/kreXX
src/Analyse/Callback/Iterate/ThroughMethods.php
ThroughMethods.retrieveDeclaringReflection
protected function retrieveDeclaringReflection( \ReflectionMethod $reflectionMethod, \ReflectionClass $declaringClass ) { // Get a first impression. if ($reflectionMethod->getFileName() === $declaringClass->getFileName()) { return $declaringClass; } // Go through the first layer of traits. // No need to recheck the availability for traits. This is done above. foreach ($declaringClass->getTraits() as $trait) { $result = $this->retrieveDeclaringReflection($reflectionMethod, $trait); if ($result !== false) { return $result; } } return false; }
php
protected function retrieveDeclaringReflection( \ReflectionMethod $reflectionMethod, \ReflectionClass $declaringClass ) { // Get a first impression. if ($reflectionMethod->getFileName() === $declaringClass->getFileName()) { return $declaringClass; } // Go through the first layer of traits. // No need to recheck the availability for traits. This is done above. foreach ($declaringClass->getTraits() as $trait) { $result = $this->retrieveDeclaringReflection($reflectionMethod, $trait); if ($result !== false) { return $result; } } return false; }
[ "protected", "function", "retrieveDeclaringReflection", "(", "\\", "ReflectionMethod", "$", "reflectionMethod", ",", "\\", "ReflectionClass", "$", "declaringClass", ")", "{", "// Get a first impression.", "if", "(", "$", "reflectionMethod", "->", "getFileName", "(", ")", "===", "$", "declaringClass", "->", "getFileName", "(", ")", ")", "{", "return", "$", "declaringClass", ";", "}", "// Go through the first layer of traits.", "// No need to recheck the availability for traits. This is done above.", "foreach", "(", "$", "declaringClass", "->", "getTraits", "(", ")", "as", "$", "trait", ")", "{", "$", "result", "=", "$", "this", "->", "retrieveDeclaringReflection", "(", "$", "reflectionMethod", ",", "$", "trait", ")", ";", "if", "(", "$", "result", "!==", "false", ")", "{", "return", "$", "result", ";", "}", "}", "return", "false", ";", "}" ]
Retrieve the declaration class reflection from traits. @param \ReflectionMethod $reflectionMethod The reflection of the method we are analysing. @param \ReflectionClass $declaringClass The original declaring class, the one with the traits. @return bool|\ReflectionClass false = unable to retrieve someting. Otherwise return a reflection class.
[ "Retrieve", "the", "declaration", "class", "reflection", "from", "traits", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Iterate/ThroughMethods.php#L192-L211
33,452
silverorange/swat
Swat/SwatTableViewRow.php
SwatTableViewRow.getHtmlHeadEntrySet
public function getHtmlHeadEntrySet() { if ($this->isDisplayed()) { $set = new SwatHtmlHeadEntrySet($this->html_head_entry_set); } else { $set = new SwatHtmlHeadEntrySet(); } return $set; }
php
public function getHtmlHeadEntrySet() { if ($this->isDisplayed()) { $set = new SwatHtmlHeadEntrySet($this->html_head_entry_set); } else { $set = new SwatHtmlHeadEntrySet(); } return $set; }
[ "public", "function", "getHtmlHeadEntrySet", "(", ")", "{", "if", "(", "$", "this", "->", "isDisplayed", "(", ")", ")", "{", "$", "set", "=", "new", "SwatHtmlHeadEntrySet", "(", "$", "this", "->", "html_head_entry_set", ")", ";", "}", "else", "{", "$", "set", "=", "new", "SwatHtmlHeadEntrySet", "(", ")", ";", "}", "return", "$", "set", ";", "}" ]
Gets the SwatHtmlHeadEntry objects needed by this row If this row has not been displayed, an empty set is returned to reduce the number of required HTTP requests. @return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects needed by this row.
[ "Gets", "the", "SwatHtmlHeadEntry", "objects", "needed", "by", "this", "row" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewRow.php#L166-L175
33,453
TeknooSoftware/states
demo/Acme/Extendable/Mother/Mother.php
Mother.listAvailableStates
public function listAvailableStates(): array { if (!empty($this->states) && \is_array($this->states)) { return \array_keys($this->states); } else { return []; } }
php
public function listAvailableStates(): array { if (!empty($this->states) && \is_array($this->states)) { return \array_keys($this->states); } else { return []; } }
[ "public", "function", "listAvailableStates", "(", ")", ":", "array", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "states", ")", "&&", "\\", "is_array", "(", "$", "this", "->", "states", ")", ")", "{", "return", "\\", "array_keys", "(", "$", "this", "->", "states", ")", ";", "}", "else", "{", "return", "[", "]", ";", "}", "}" ]
Return the list of registered states. Present only for debug and tests
[ "Return", "the", "list", "of", "registered", "states", ".", "Present", "only", "for", "debug", "and", "tests" ]
0c675b768781ee3a3a15c2663cffec5d50c1d5fd
https://github.com/TeknooSoftware/states/blob/0c675b768781ee3a3a15c2663cffec5d50c1d5fd/demo/Acme/Extendable/Mother/Mother.php#L62-L69
33,454
silverorange/swat
demo/include/DemoApplication.php
DemoApplication.getDemo
private function getDemo() { $demo = isset($_GET['demo']) ? $_GET['demo'] : null; // simple security if (!array_key_exists($demo, $this->available_demos)) $demo = null; return $demo; }
php
private function getDemo() { $demo = isset($_GET['demo']) ? $_GET['demo'] : null; // simple security if (!array_key_exists($demo, $this->available_demos)) $demo = null; return $demo; }
[ "private", "function", "getDemo", "(", ")", "{", "$", "demo", "=", "isset", "(", "$", "_GET", "[", "'demo'", "]", ")", "?", "$", "_GET", "[", "'demo'", "]", ":", "null", ";", "// simple security", "if", "(", "!", "array_key_exists", "(", "$", "demo", ",", "$", "this", "->", "available_demos", ")", ")", "$", "demo", "=", "null", ";", "return", "$", "demo", ";", "}" ]
Gets the demo page
[ "Gets", "the", "demo", "page" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/demo/include/DemoApplication.php#L494-L503
33,455
silverorange/swat
Swat/SwatFrame.php
SwatFrame.getTitle
public function getTitle() { if ($this->subtitle === null) { return $this->title; } if ($this->title === null) { return $this->subtitle; } return $this->title . ': ' . $this->subtitle; }
php
public function getTitle() { if ($this->subtitle === null) { return $this->title; } if ($this->title === null) { return $this->subtitle; } return $this->title . ': ' . $this->subtitle; }
[ "public", "function", "getTitle", "(", ")", "{", "if", "(", "$", "this", "->", "subtitle", "===", "null", ")", "{", "return", "$", "this", "->", "title", ";", "}", "if", "(", "$", "this", "->", "title", "===", "null", ")", "{", "return", "$", "this", "->", "subtitle", ";", "}", "return", "$", "this", "->", "title", ".", "': '", ".", "$", "this", "->", "subtitle", ";", "}" ]
Gets the title of this frame Implements the {@link SwatTitleable::getTitle()} interface. @return string the title of this frame.
[ "Gets", "the", "title", "of", "this", "frame" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatFrame.php#L64-L75
33,456
silverorange/swat
Swat/SwatFrame.php
SwatFrame.display
public function display() { if (!$this->visible) { return; } SwatWidget::display(); $outer_div = new SwatHtmlTag('div'); $outer_div->id = $this->id; $outer_div->class = $this->getCSSClassString(); $outer_div->open(); $this->displayTitle(); $this->displayContent(); $outer_div->close(); }
php
public function display() { if (!$this->visible) { return; } SwatWidget::display(); $outer_div = new SwatHtmlTag('div'); $outer_div->id = $this->id; $outer_div->class = $this->getCSSClassString(); $outer_div->open(); $this->displayTitle(); $this->displayContent(); $outer_div->close(); }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "SwatWidget", "::", "display", "(", ")", ";", "$", "outer_div", "=", "new", "SwatHtmlTag", "(", "'div'", ")", ";", "$", "outer_div", "->", "id", "=", "$", "this", "->", "id", ";", "$", "outer_div", "->", "class", "=", "$", "this", "->", "getCSSClassString", "(", ")", ";", "$", "outer_div", "->", "open", "(", ")", ";", "$", "this", "->", "displayTitle", "(", ")", ";", "$", "this", "->", "displayContent", "(", ")", ";", "$", "outer_div", "->", "close", "(", ")", ";", "}" ]
Displays this frame
[ "Displays", "this", "frame" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatFrame.php#L98-L114
33,457
silverorange/swat
Swat/SwatFrame.php
SwatFrame.displayTitle
protected function displayTitle() { if ($this->title !== null) { $header_tag = new SwatHtmlTag('h' . $this->getHeaderLevel()); $header_tag->class = 'swat-frame-title'; $header_tag->setContent($this->title, $this->title_content_type); if ($this->subtitle === null) { $header_tag->display(); } else { $span_tag = new SwatHtmlTag('span'); $span_tag->class = 'swat-frame-subtitle'; $span_tag->setContent( $this->subtitle, $this->title_content_type ); $header_tag->open(); $header_tag->displayContent(); echo $this->title_separator; $span_tag->display(); $header_tag->close(); } } }
php
protected function displayTitle() { if ($this->title !== null) { $header_tag = new SwatHtmlTag('h' . $this->getHeaderLevel()); $header_tag->class = 'swat-frame-title'; $header_tag->setContent($this->title, $this->title_content_type); if ($this->subtitle === null) { $header_tag->display(); } else { $span_tag = new SwatHtmlTag('span'); $span_tag->class = 'swat-frame-subtitle'; $span_tag->setContent( $this->subtitle, $this->title_content_type ); $header_tag->open(); $header_tag->displayContent(); echo $this->title_separator; $span_tag->display(); $header_tag->close(); } } }
[ "protected", "function", "displayTitle", "(", ")", "{", "if", "(", "$", "this", "->", "title", "!==", "null", ")", "{", "$", "header_tag", "=", "new", "SwatHtmlTag", "(", "'h'", ".", "$", "this", "->", "getHeaderLevel", "(", ")", ")", ";", "$", "header_tag", "->", "class", "=", "'swat-frame-title'", ";", "$", "header_tag", "->", "setContent", "(", "$", "this", "->", "title", ",", "$", "this", "->", "title_content_type", ")", ";", "if", "(", "$", "this", "->", "subtitle", "===", "null", ")", "{", "$", "header_tag", "->", "display", "(", ")", ";", "}", "else", "{", "$", "span_tag", "=", "new", "SwatHtmlTag", "(", "'span'", ")", ";", "$", "span_tag", "->", "class", "=", "'swat-frame-subtitle'", ";", "$", "span_tag", "->", "setContent", "(", "$", "this", "->", "subtitle", ",", "$", "this", "->", "title_content_type", ")", ";", "$", "header_tag", "->", "open", "(", ")", ";", "$", "header_tag", "->", "displayContent", "(", ")", ";", "echo", "$", "this", "->", "title_separator", ";", "$", "span_tag", "->", "display", "(", ")", ";", "$", "header_tag", "->", "close", "(", ")", ";", "}", "}", "}" ]
Displays this frame's title
[ "Displays", "this", "frame", "s", "title" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatFrame.php#L122-L146
33,458
silverorange/swat
Swat/SwatFrame.php
SwatFrame.displayContent
protected function displayContent() { $inner_div = new SwatHtmlTag('div'); $inner_div->class = 'swat-frame-contents'; $inner_div->open(); $this->displayChildren(); $inner_div->close(); }
php
protected function displayContent() { $inner_div = new SwatHtmlTag('div'); $inner_div->class = 'swat-frame-contents'; $inner_div->open(); $this->displayChildren(); $inner_div->close(); }
[ "protected", "function", "displayContent", "(", ")", "{", "$", "inner_div", "=", "new", "SwatHtmlTag", "(", "'div'", ")", ";", "$", "inner_div", "->", "class", "=", "'swat-frame-contents'", ";", "$", "inner_div", "->", "open", "(", ")", ";", "$", "this", "->", "displayChildren", "(", ")", ";", "$", "inner_div", "->", "close", "(", ")", ";", "}" ]
Displays this frame's content
[ "Displays", "this", "frame", "s", "content" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatFrame.php#L154-L161
33,459
honey-comb/core
src/Http/Requests/HCUserRequest.php
HCUserRequest.getUserInput
public function getUserInput(): array { $data = [ 'email' => $this->input('email'), 'is_active' => $this->filled('is_active') ? 1 : 0, ]; if ($this->input('password')) { Arr::set($data, 'password', $this->input('password')); } return $data; }
php
public function getUserInput(): array { $data = [ 'email' => $this->input('email'), 'is_active' => $this->filled('is_active') ? 1 : 0, ]; if ($this->input('password')) { Arr::set($data, 'password', $this->input('password')); } return $data; }
[ "public", "function", "getUserInput", "(", ")", ":", "array", "{", "$", "data", "=", "[", "'email'", "=>", "$", "this", "->", "input", "(", "'email'", ")", ",", "'is_active'", "=>", "$", "this", "->", "filled", "(", "'is_active'", ")", "?", "1", ":", "0", ",", "]", ";", "if", "(", "$", "this", "->", "input", "(", "'password'", ")", ")", "{", "Arr", "::", "set", "(", "$", "data", ",", "'password'", ",", "$", "this", "->", "input", "(", "'password'", ")", ")", ";", "}", "return", "$", "data", ";", "}" ]
Get request inputs @return array
[ "Get", "request", "inputs" ]
5c12aba31cae092e9681f0ae3e3664ed3fcec956
https://github.com/honey-comb/core/blob/5c12aba31cae092e9681f0ae3e3664ed3fcec956/src/Http/Requests/HCUserRequest.php#L46-L58
33,460
honey-comb/core
src/Http/Requests/HCUserRequest.php
HCUserRequest.getPersonalData
public function getPersonalData(): array { $photo = $this->input('photo_id'); if (is_array($photo) && !$photo) { $photo = null; } return [ 'first_name' => $this->input('first_name'), 'last_name' => $this->input('last_name'), 'photo_id' => $photo, 'description' => $this->input('description'), 'phone' => $this->input('phone'), 'address' => $this->input('address'), 'notification_email' => $this->input('notification_email'), ]; }
php
public function getPersonalData(): array { $photo = $this->input('photo_id'); if (is_array($photo) && !$photo) { $photo = null; } return [ 'first_name' => $this->input('first_name'), 'last_name' => $this->input('last_name'), 'photo_id' => $photo, 'description' => $this->input('description'), 'phone' => $this->input('phone'), 'address' => $this->input('address'), 'notification_email' => $this->input('notification_email'), ]; }
[ "public", "function", "getPersonalData", "(", ")", ":", "array", "{", "$", "photo", "=", "$", "this", "->", "input", "(", "'photo_id'", ")", ";", "if", "(", "is_array", "(", "$", "photo", ")", "&&", "!", "$", "photo", ")", "{", "$", "photo", "=", "null", ";", "}", "return", "[", "'first_name'", "=>", "$", "this", "->", "input", "(", "'first_name'", ")", ",", "'last_name'", "=>", "$", "this", "->", "input", "(", "'last_name'", ")", ",", "'photo_id'", "=>", "$", "photo", ",", "'description'", "=>", "$", "this", "->", "input", "(", "'description'", ")", ",", "'phone'", "=>", "$", "this", "->", "input", "(", "'phone'", ")", ",", "'address'", "=>", "$", "this", "->", "input", "(", "'address'", ")", ",", "'notification_email'", "=>", "$", "this", "->", "input", "(", "'notification_email'", ")", ",", "]", ";", "}" ]
Get personal info @return array
[ "Get", "personal", "info" ]
5c12aba31cae092e9681f0ae3e3664ed3fcec956
https://github.com/honey-comb/core/blob/5c12aba31cae092e9681f0ae3e3664ed3fcec956/src/Http/Requests/HCUserRequest.php#L83-L100
33,461
silverorange/swat
Swat/SwatWidget.php
SwatWidget.process
public function process() { if (!$this->isInitialized()) { $this->init(); } foreach ($this->getCompositeWidgets() as $widget) { $widget->process(); } $this->processed = true; }
php
public function process() { if (!$this->isInitialized()) { $this->init(); } foreach ($this->getCompositeWidgets() as $widget) { $widget->process(); } $this->processed = true; }
[ "public", "function", "process", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isInitialized", "(", ")", ")", "{", "$", "this", "->", "init", "(", ")", ";", "}", "foreach", "(", "$", "this", "->", "getCompositeWidgets", "(", ")", "as", "$", "widget", ")", "{", "$", "widget", "->", "process", "(", ")", ";", "}", "$", "this", "->", "processed", "=", "true", ";", "}" ]
Processes this widget After a form submit, this widget processes itself and its dependencies and then recursively processes any of its child widgets. Composite widgets of this widget are automatically processed as well. If this widget has not been initialized, it is automatically initialized before processing.
[ "Processes", "this", "widget" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatWidget.php#L208-L219
33,462
silverorange/swat
Swat/SwatWidget.php
SwatWidget.getHtmlHeadEntrySet
public function getHtmlHeadEntrySet() { if ($this->isDisplayed()) { $set = new SwatHtmlHeadEntrySet($this->html_head_entry_set); } else { $set = new SwatHtmlHeadEntrySet(); } foreach ($this->getCompositeWidgets() as $widget) { $set->addEntrySet($widget->getHtmlHeadEntrySet()); } return $set; }
php
public function getHtmlHeadEntrySet() { if ($this->isDisplayed()) { $set = new SwatHtmlHeadEntrySet($this->html_head_entry_set); } else { $set = new SwatHtmlHeadEntrySet(); } foreach ($this->getCompositeWidgets() as $widget) { $set->addEntrySet($widget->getHtmlHeadEntrySet()); } return $set; }
[ "public", "function", "getHtmlHeadEntrySet", "(", ")", "{", "if", "(", "$", "this", "->", "isDisplayed", "(", ")", ")", "{", "$", "set", "=", "new", "SwatHtmlHeadEntrySet", "(", "$", "this", "->", "html_head_entry_set", ")", ";", "}", "else", "{", "$", "set", "=", "new", "SwatHtmlHeadEntrySet", "(", ")", ";", "}", "foreach", "(", "$", "this", "->", "getCompositeWidgets", "(", ")", "as", "$", "widget", ")", "{", "$", "set", "->", "addEntrySet", "(", "$", "widget", "->", "getHtmlHeadEntrySet", "(", ")", ")", ";", "}", "return", "$", "set", ";", "}" ]
Gets the SwatHtmlHeadEntry objects needed by this widget If this widget has not been displayed, an empty set is returned to reduce the number of required HTTP requests. @return SwatHtmlHeadEntrySet the {@link SwatHtmlHeadEntry} objects needed by this widget.
[ "Gets", "the", "SwatHtmlHeadEntry", "objects", "needed", "by", "this", "widget" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatWidget.php#L269-L282
33,463
silverorange/swat
Swat/SwatWidget.php
SwatWidget.getAvailableHtmlHeadEntrySet
public function getAvailableHtmlHeadEntrySet() { $set = new SwatHtmlHeadEntrySet($this->html_head_entry_set); foreach ($this->getCompositeWidgets() as $widget) { $set->addEntrySet($widget->getAvailableHtmlHeadEntrySet()); } return $set; }
php
public function getAvailableHtmlHeadEntrySet() { $set = new SwatHtmlHeadEntrySet($this->html_head_entry_set); foreach ($this->getCompositeWidgets() as $widget) { $set->addEntrySet($widget->getAvailableHtmlHeadEntrySet()); } return $set; }
[ "public", "function", "getAvailableHtmlHeadEntrySet", "(", ")", "{", "$", "set", "=", "new", "SwatHtmlHeadEntrySet", "(", "$", "this", "->", "html_head_entry_set", ")", ";", "foreach", "(", "$", "this", "->", "getCompositeWidgets", "(", ")", "as", "$", "widget", ")", "{", "$", "set", "->", "addEntrySet", "(", "$", "widget", "->", "getAvailableHtmlHeadEntrySet", "(", ")", ")", ";", "}", "return", "$", "set", ";", "}" ]
Gets the SwatHtmlHeadEntry objects that may be needed by this widget @return SwatHtmlHeadEntrySet the {@link SwatHtmlHeadEntry} objects that may be needed by this widget.
[ "Gets", "the", "SwatHtmlHeadEntry", "objects", "that", "may", "be", "needed", "by", "this", "widget" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatWidget.php#L293-L302
33,464
silverorange/swat
Swat/SwatWidget.php
SwatWidget.isSensitive
public function isSensitive() { if ($this->parent !== null && $this->parent instanceof SwatWidget) { return $this->parent->isSensitive() && $this->sensitive; } else { return $this->sensitive; } }
php
public function isSensitive() { if ($this->parent !== null && $this->parent instanceof SwatWidget) { return $this->parent->isSensitive() && $this->sensitive; } else { return $this->sensitive; } }
[ "public", "function", "isSensitive", "(", ")", "{", "if", "(", "$", "this", "->", "parent", "!==", "null", "&&", "$", "this", "->", "parent", "instanceof", "SwatWidget", ")", "{", "return", "$", "this", "->", "parent", "->", "isSensitive", "(", ")", "&&", "$", "this", "->", "sensitive", ";", "}", "else", "{", "return", "$", "this", "->", "sensitive", ";", "}", "}" ]
Determines the sensitivity of this widget. Looks at the sensitive property of the ancestors of this widget to determine if this widget is sensitive. @return boolean whether this widget is sensitive. @see SwatWidget::$sensitive
[ "Determines", "the", "sensitivity", "of", "this", "widget", "." ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatWidget.php#L381-L388
33,465
silverorange/swat
Swat/SwatWidget.php
SwatWidget.replaceWithContainer
public function replaceWithContainer(SwatContainer $container = null) { if ($this->parent === null) { throw new SwatException( 'Widget does not have a parent, unable ' . 'to replace this widget with a container.' ); } if ($container === null) { $container = new SwatContainer(); } $parent = $this->parent; $parent->replace($this, $container); $container->add($this); return $container; }
php
public function replaceWithContainer(SwatContainer $container = null) { if ($this->parent === null) { throw new SwatException( 'Widget does not have a parent, unable ' . 'to replace this widget with a container.' ); } if ($container === null) { $container = new SwatContainer(); } $parent = $this->parent; $parent->replace($this, $container); $container->add($this); return $container; }
[ "public", "function", "replaceWithContainer", "(", "SwatContainer", "$", "container", "=", "null", ")", "{", "if", "(", "$", "this", "->", "parent", "===", "null", ")", "{", "throw", "new", "SwatException", "(", "'Widget does not have a parent, unable '", ".", "'to replace this widget with a container.'", ")", ";", "}", "if", "(", "$", "container", "===", "null", ")", "{", "$", "container", "=", "new", "SwatContainer", "(", ")", ";", "}", "$", "parent", "=", "$", "this", "->", "parent", ";", "$", "parent", "->", "replace", "(", "$", "this", ",", "$", "container", ")", ";", "$", "container", "->", "add", "(", "$", "this", ")", ";", "return", "$", "container", ";", "}" ]
Replace this widget with a new container Replaces this widget in the widget tree with a new {@link SwatContainer}, then adds this widget to the new container. @param SwatContainer $container optional container to use @throws SwatException @return SwatContainer a reference to the new container.
[ "Replace", "this", "widget", "with", "a", "new", "container" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatWidget.php#L469-L487
33,466
silverorange/swat
Swat/SwatWidget.php
SwatWidget.getCSSClassNames
protected function getCSSClassNames() { $classes = array(); if (!$this->isSensitive()) { $classes[] = 'swat-insensitive'; } $classes = array_merge($classes, parent::getCSSClassNames()); return $classes; }
php
protected function getCSSClassNames() { $classes = array(); if (!$this->isSensitive()) { $classes[] = 'swat-insensitive'; } $classes = array_merge($classes, parent::getCSSClassNames()); return $classes; }
[ "protected", "function", "getCSSClassNames", "(", ")", "{", "$", "classes", "=", "array", "(", ")", ";", "if", "(", "!", "$", "this", "->", "isSensitive", "(", ")", ")", "{", "$", "classes", "[", "]", "=", "'swat-insensitive'", ";", "}", "$", "classes", "=", "array_merge", "(", "$", "classes", ",", "parent", "::", "getCSSClassNames", "(", ")", ")", ";", "return", "$", "classes", ";", "}" ]
Gets the array of CSS classes that are applied to this widget @return array the array of CSS classes that are applied to this widget.
[ "Gets", "the", "array", "of", "CSS", "classes", "that", "are", "applied", "to", "this", "widget" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatWidget.php#L539-L550
33,467
silverorange/swat
Swat/SwatWidget.php
SwatWidget.addCompositeWidget
final protected function addCompositeWidget(SwatWidget $widget, $key) { if (array_key_exists($key, $this->composite_widgets)) { throw new SwatDuplicateIdException( sprintf( "A composite widget with the key '%s' already exists in this " . "widget.", $key ), 0, $key ); } if ($widget->parent !== null) { throw new SwatException( 'Cannot add a composite widget that already has a parent.' ); } $this->composite_widgets[$key] = $widget; $widget->parent = $this; }
php
final protected function addCompositeWidget(SwatWidget $widget, $key) { if (array_key_exists($key, $this->composite_widgets)) { throw new SwatDuplicateIdException( sprintf( "A composite widget with the key '%s' already exists in this " . "widget.", $key ), 0, $key ); } if ($widget->parent !== null) { throw new SwatException( 'Cannot add a composite widget that already has a parent.' ); } $this->composite_widgets[$key] = $widget; $widget->parent = $this; }
[ "final", "protected", "function", "addCompositeWidget", "(", "SwatWidget", "$", "widget", ",", "$", "key", ")", "{", "if", "(", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "composite_widgets", ")", ")", "{", "throw", "new", "SwatDuplicateIdException", "(", "sprintf", "(", "\"A composite widget with the key '%s' already exists in this \"", ".", "\"widget.\"", ",", "$", "key", ")", ",", "0", ",", "$", "key", ")", ";", "}", "if", "(", "$", "widget", "->", "parent", "!==", "null", ")", "{", "throw", "new", "SwatException", "(", "'Cannot add a composite widget that already has a parent.'", ")", ";", "}", "$", "this", "->", "composite_widgets", "[", "$", "key", "]", "=", "$", "widget", ";", "$", "widget", "->", "parent", "=", "$", "this", ";", "}" ]
Adds a composite a widget to this widget @param SwatWidget $widget the composite widget to add. @param string $key a key identifying the widget so it may be retrieved later. The key does not have to be the widget's id but the key does have to be unique within this widget relative to the keys of other composite widgets. @throws SwatDuplicateIdException if a composite widget with the specified key is already added to this widget. @throws SwatException if the specified widget is already the child of another object.
[ "Adds", "a", "composite", "a", "widget", "to", "this", "widget" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatWidget.php#L584-L606
33,468
silverorange/swat
Swat/SwatWidget.php
SwatWidget.getCompositeWidget
final protected function getCompositeWidget($key) { $this->confirmCompositeWidgets(); if (!array_key_exists($key, $this->composite_widgets)) { throw new SwatWidgetNotFoundException( sprintf( "Composite widget with key of '%s' not found in %s. Make sure " . "the composite widget was created and added to this widget.", $key, get_class($this) ), 0, $key ); } return $this->composite_widgets[$key]; }
php
final protected function getCompositeWidget($key) { $this->confirmCompositeWidgets(); if (!array_key_exists($key, $this->composite_widgets)) { throw new SwatWidgetNotFoundException( sprintf( "Composite widget with key of '%s' not found in %s. Make sure " . "the composite widget was created and added to this widget.", $key, get_class($this) ), 0, $key ); } return $this->composite_widgets[$key]; }
[ "final", "protected", "function", "getCompositeWidget", "(", "$", "key", ")", "{", "$", "this", "->", "confirmCompositeWidgets", "(", ")", ";", "if", "(", "!", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "composite_widgets", ")", ")", "{", "throw", "new", "SwatWidgetNotFoundException", "(", "sprintf", "(", "\"Composite widget with key of '%s' not found in %s. Make sure \"", ".", "\"the composite widget was created and added to this widget.\"", ",", "$", "key", ",", "get_class", "(", "$", "this", ")", ")", ",", "0", ",", "$", "key", ")", ";", "}", "return", "$", "this", "->", "composite_widgets", "[", "$", "key", "]", ";", "}" ]
Gets a composite widget of this widget by the composite widget's key This is used by other methods to retrieve a specific composite widget. This method ensures composite widgets are created before trying to retrieve the specified widget. @param string $key the key of the composite widget to get. @return SwatWidget the specified composite widget. @throws SwatWidgetNotFoundException if no composite widget with the specified key exists in this widget.
[ "Gets", "a", "composite", "widget", "of", "this", "widget", "by", "the", "composite", "widget", "s", "key" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatWidget.php#L625-L643
33,469
silverorange/swat
Swat/SwatWidget.php
SwatWidget.getCompositeWidgets
final protected function getCompositeWidgets($class_name = null) { $this->confirmCompositeWidgets(); if ( !( $class_name === null || class_exists($class_name) || interface_exists($class_name) ) ) { return array(); } $out = array(); foreach ($this->composite_widgets as $key => $widget) { if ($class_name === null || $widget instanceof $class_name) { $out[$key] = $widget; } } return $out; }
php
final protected function getCompositeWidgets($class_name = null) { $this->confirmCompositeWidgets(); if ( !( $class_name === null || class_exists($class_name) || interface_exists($class_name) ) ) { return array(); } $out = array(); foreach ($this->composite_widgets as $key => $widget) { if ($class_name === null || $widget instanceof $class_name) { $out[$key] = $widget; } } return $out; }
[ "final", "protected", "function", "getCompositeWidgets", "(", "$", "class_name", "=", "null", ")", "{", "$", "this", "->", "confirmCompositeWidgets", "(", ")", ";", "if", "(", "!", "(", "$", "class_name", "===", "null", "||", "class_exists", "(", "$", "class_name", ")", "||", "interface_exists", "(", "$", "class_name", ")", ")", ")", "{", "return", "array", "(", ")", ";", "}", "$", "out", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "composite_widgets", "as", "$", "key", "=>", "$", "widget", ")", "{", "if", "(", "$", "class_name", "===", "null", "||", "$", "widget", "instanceof", "$", "class_name", ")", "{", "$", "out", "[", "$", "key", "]", "=", "$", "widget", ";", "}", "}", "return", "$", "out", ";", "}" ]
Gets all composite widgets added to this widget This method ensures composite widgets are created before retrieving the widgets. @param string $class_name optional class name. If set, only widgets that are instances of <code>$class_name</code> are returned. @return array all composite wigets added to this widget. The array is indexed by the composite widget keys. @see SwatWidget::addCompositeWidget()
[ "Gets", "all", "composite", "widgets", "added", "to", "this", "widget" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatWidget.php#L663-L686
33,470
brainworxx/kreXX
src/Service/Flow/Recursion.php
Recursion.isInHive
public function isInHive($bee) { // Check objects. if (is_object($bee) === true) { return $this->recursionHive->contains($bee); } // Check arrays (only the $GLOBAL array may apply). if (isset($bee[$this->recursionMarker]) === true) { // We render the $GLOBALS only once. if ($this->globalsWereRendered === true) { return true; } $this->globalsWereRendered = true; } // Should be a normal array. We do not track these, because we can not // resolve them via JS recursion handling. return false; }
php
public function isInHive($bee) { // Check objects. if (is_object($bee) === true) { return $this->recursionHive->contains($bee); } // Check arrays (only the $GLOBAL array may apply). if (isset($bee[$this->recursionMarker]) === true) { // We render the $GLOBALS only once. if ($this->globalsWereRendered === true) { return true; } $this->globalsWereRendered = true; } // Should be a normal array. We do not track these, because we can not // resolve them via JS recursion handling. return false; }
[ "public", "function", "isInHive", "(", "$", "bee", ")", "{", "// Check objects.", "if", "(", "is_object", "(", "$", "bee", ")", "===", "true", ")", "{", "return", "$", "this", "->", "recursionHive", "->", "contains", "(", "$", "bee", ")", ";", "}", "// Check arrays (only the $GLOBAL array may apply).", "if", "(", "isset", "(", "$", "bee", "[", "$", "this", "->", "recursionMarker", "]", ")", "===", "true", ")", "{", "// We render the $GLOBALS only once.", "if", "(", "$", "this", "->", "globalsWereRendered", "===", "true", ")", "{", "return", "true", ";", "}", "$", "this", "->", "globalsWereRendered", "=", "true", ";", "}", "// Should be a normal array. We do not track these, because we can not", "// resolve them via JS recursion handling.", "return", "false", ";", "}" ]
Find out if our bee is already in the hive. @param object|array $bee The object or array we want to check for recursion. @return bool Boolean which shows whether we are facing a recursion.
[ "Find", "out", "if", "our", "bee", "is", "already", "in", "the", "hive", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Flow/Recursion.php#L135-L155
33,471
silverorange/swat
Swat/SwatActions.php
SwatActions.display
public function display() { if (!$this->visible) { return; } parent::display(); $flydown = $this->getCompositeWidget('action_flydown'); foreach ($this->action_items as $item) { if ($item->visible) { if ($item instanceof SwatActionItemDivider) { $flydown->addDivider(); } else { $flydown->addOption($item->id, $item->title); } } } // set the flydown back to its initial state (no persistence). The // flydown is never reset if there is a selected item and the selected // items has a widget with one or more messages. if ( $this->auto_reset && ($this->selected === null || $this->selected->widget === null || !$this->selected->widget->hasMessage()) ) { $flydown->reset(); } // select the current action item based upon the flydown value if (isset($this->action_items_by_id[$flydown->value])) { $this->selected = $this->action_items_by_id[$flydown->value]; } else { $this->selected = null; } $div_tag = new SwatHtmlTag('div'); $div_tag->id = $this->id; $div_tag->class = $this->getCSSClassString(); $div_tag->open(); echo '<div class="swat-actions-controls">'; $label = new SwatHtmlTag('label'); $label->for = $flydown->getFocusableHtmlId(); $label->setContent(Swat::_('Action: ')); $label->display(); $flydown->display(); echo ' '; $this->displayButton(); echo '</div>'; foreach ($this->action_items as $item) { if ($item->widget !== null) { $div = new SwatHtmlTag('div'); $div->class = $item == $this->selected ? 'swat-visible' : 'swat-hidden'; $div->id = $this->id . '_' . $item->id; $div->open(); $item->display(); $div->close(); } } echo '<div class="swat-actions-note">'; echo Swat::_('Actions apply to checked items.'); echo '</div>'; $div_tag->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
php
public function display() { if (!$this->visible) { return; } parent::display(); $flydown = $this->getCompositeWidget('action_flydown'); foreach ($this->action_items as $item) { if ($item->visible) { if ($item instanceof SwatActionItemDivider) { $flydown->addDivider(); } else { $flydown->addOption($item->id, $item->title); } } } // set the flydown back to its initial state (no persistence). The // flydown is never reset if there is a selected item and the selected // items has a widget with one or more messages. if ( $this->auto_reset && ($this->selected === null || $this->selected->widget === null || !$this->selected->widget->hasMessage()) ) { $flydown->reset(); } // select the current action item based upon the flydown value if (isset($this->action_items_by_id[$flydown->value])) { $this->selected = $this->action_items_by_id[$flydown->value]; } else { $this->selected = null; } $div_tag = new SwatHtmlTag('div'); $div_tag->id = $this->id; $div_tag->class = $this->getCSSClassString(); $div_tag->open(); echo '<div class="swat-actions-controls">'; $label = new SwatHtmlTag('label'); $label->for = $flydown->getFocusableHtmlId(); $label->setContent(Swat::_('Action: ')); $label->display(); $flydown->display(); echo ' '; $this->displayButton(); echo '</div>'; foreach ($this->action_items as $item) { if ($item->widget !== null) { $div = new SwatHtmlTag('div'); $div->class = $item == $this->selected ? 'swat-visible' : 'swat-hidden'; $div->id = $this->id . '_' . $item->id; $div->open(); $item->display(); $div->close(); } } echo '<div class="swat-actions-note">'; echo Swat::_('Actions apply to checked items.'); echo '</div>'; $div_tag->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "parent", "::", "display", "(", ")", ";", "$", "flydown", "=", "$", "this", "->", "getCompositeWidget", "(", "'action_flydown'", ")", ";", "foreach", "(", "$", "this", "->", "action_items", "as", "$", "item", ")", "{", "if", "(", "$", "item", "->", "visible", ")", "{", "if", "(", "$", "item", "instanceof", "SwatActionItemDivider", ")", "{", "$", "flydown", "->", "addDivider", "(", ")", ";", "}", "else", "{", "$", "flydown", "->", "addOption", "(", "$", "item", "->", "id", ",", "$", "item", "->", "title", ")", ";", "}", "}", "}", "// set the flydown back to its initial state (no persistence). The", "// flydown is never reset if there is a selected item and the selected", "// items has a widget with one or more messages.", "if", "(", "$", "this", "->", "auto_reset", "&&", "(", "$", "this", "->", "selected", "===", "null", "||", "$", "this", "->", "selected", "->", "widget", "===", "null", "||", "!", "$", "this", "->", "selected", "->", "widget", "->", "hasMessage", "(", ")", ")", ")", "{", "$", "flydown", "->", "reset", "(", ")", ";", "}", "// select the current action item based upon the flydown value", "if", "(", "isset", "(", "$", "this", "->", "action_items_by_id", "[", "$", "flydown", "->", "value", "]", ")", ")", "{", "$", "this", "->", "selected", "=", "$", "this", "->", "action_items_by_id", "[", "$", "flydown", "->", "value", "]", ";", "}", "else", "{", "$", "this", "->", "selected", "=", "null", ";", "}", "$", "div_tag", "=", "new", "SwatHtmlTag", "(", "'div'", ")", ";", "$", "div_tag", "->", "id", "=", "$", "this", "->", "id", ";", "$", "div_tag", "->", "class", "=", "$", "this", "->", "getCSSClassString", "(", ")", ";", "$", "div_tag", "->", "open", "(", ")", ";", "echo", "'<div class=\"swat-actions-controls\">'", ";", "$", "label", "=", "new", "SwatHtmlTag", "(", "'label'", ")", ";", "$", "label", "->", "for", "=", "$", "flydown", "->", "getFocusableHtmlId", "(", ")", ";", "$", "label", "->", "setContent", "(", "Swat", "::", "_", "(", "'Action: '", ")", ")", ";", "$", "label", "->", "display", "(", ")", ";", "$", "flydown", "->", "display", "(", ")", ";", "echo", "' '", ";", "$", "this", "->", "displayButton", "(", ")", ";", "echo", "'</div>'", ";", "foreach", "(", "$", "this", "->", "action_items", "as", "$", "item", ")", "{", "if", "(", "$", "item", "->", "widget", "!==", "null", ")", "{", "$", "div", "=", "new", "SwatHtmlTag", "(", "'div'", ")", ";", "$", "div", "->", "class", "=", "$", "item", "==", "$", "this", "->", "selected", "?", "'swat-visible'", ":", "'swat-hidden'", ";", "$", "div", "->", "id", "=", "$", "this", "->", "id", ".", "'_'", ".", "$", "item", "->", "id", ";", "$", "div", "->", "open", "(", ")", ";", "$", "item", "->", "display", "(", ")", ";", "$", "div", "->", "close", "(", ")", ";", "}", "}", "echo", "'<div class=\"swat-actions-note\">'", ";", "echo", "Swat", "::", "_", "(", "'Actions apply to checked items.'", ")", ";", "echo", "'</div>'", ";", "$", "div_tag", "->", "close", "(", ")", ";", "Swat", "::", "displayInlineJavaScript", "(", "$", "this", "->", "getInlineJavaScript", "(", ")", ")", ";", "}" ]
Displays this list of actions Internal widgets are automatically created if they do not exist. Javascript is displayed, then the display methods of the internal widgets are called.
[ "Displays", "this", "list", "of", "actions" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatActions.php#L129-L207
33,472
silverorange/swat
Swat/SwatActions.php
SwatActions.process
public function process() { parent::process(); $flydown = $this->getCompositeWidget('action_flydown'); $selected_id = $flydown->value; if (isset($this->action_items_by_id[$selected_id])) { $this->selected = $this->action_items_by_id[$selected_id]; if ($this->selected->widget !== null) { $this->selected->widget->process(); } } else { $this->selected = null; } }
php
public function process() { parent::process(); $flydown = $this->getCompositeWidget('action_flydown'); $selected_id = $flydown->value; if (isset($this->action_items_by_id[$selected_id])) { $this->selected = $this->action_items_by_id[$selected_id]; if ($this->selected->widget !== null) { $this->selected->widget->process(); } } else { $this->selected = null; } }
[ "public", "function", "process", "(", ")", "{", "parent", "::", "process", "(", ")", ";", "$", "flydown", "=", "$", "this", "->", "getCompositeWidget", "(", "'action_flydown'", ")", ";", "$", "selected_id", "=", "$", "flydown", "->", "value", ";", "if", "(", "isset", "(", "$", "this", "->", "action_items_by_id", "[", "$", "selected_id", "]", ")", ")", "{", "$", "this", "->", "selected", "=", "$", "this", "->", "action_items_by_id", "[", "$", "selected_id", "]", ";", "if", "(", "$", "this", "->", "selected", "->", "widget", "!==", "null", ")", "{", "$", "this", "->", "selected", "->", "widget", "->", "process", "(", ")", ";", "}", "}", "else", "{", "$", "this", "->", "selected", "=", "null", ";", "}", "}" ]
Figures out what action item is selected This method creates internal widgets if they do not exist, and then determines what SwatActionItem was selected by the user by calling the process methods of the internal widgets.
[ "Figures", "out", "what", "action", "item", "is", "selected" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatActions.php#L219-L235
33,473
silverorange/swat
Swat/SwatActions.php
SwatActions.addActionItem
public function addActionItem(SwatActionItem $item) { $this->action_items[] = $item; $item->parent = $this; if ($item->id !== null) { $this->action_items_by_id[$item->id] = $item; } }
php
public function addActionItem(SwatActionItem $item) { $this->action_items[] = $item; $item->parent = $this; if ($item->id !== null) { $this->action_items_by_id[$item->id] = $item; } }
[ "public", "function", "addActionItem", "(", "SwatActionItem", "$", "item", ")", "{", "$", "this", "->", "action_items", "[", "]", "=", "$", "item", ";", "$", "item", "->", "parent", "=", "$", "this", ";", "if", "(", "$", "item", "->", "id", "!==", "null", ")", "{", "$", "this", "->", "action_items_by_id", "[", "$", "item", "->", "id", "]", "=", "$", "item", ";", "}", "}" ]
Adds an action item Adds a SwatActionItem to this SwatActions widget. @param SwatActionItem $item a reference to the item to add. @see SwatActionItem
[ "Adds", "an", "action", "item" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatActions.php#L249-L257
33,474
silverorange/swat
Swat/SwatActions.php
SwatActions.getHtmlHeadEntrySet
public function getHtmlHeadEntrySet() { $set = parent::getHtmlHeadEntrySet(); foreach ($this->action_items as $child_widget) { $set->addEntrySet($child_widget->getHtmlHeadEntrySet()); } return $set; }
php
public function getHtmlHeadEntrySet() { $set = parent::getHtmlHeadEntrySet(); foreach ($this->action_items as $child_widget) { $set->addEntrySet($child_widget->getHtmlHeadEntrySet()); } return $set; }
[ "public", "function", "getHtmlHeadEntrySet", "(", ")", "{", "$", "set", "=", "parent", "::", "getHtmlHeadEntrySet", "(", ")", ";", "foreach", "(", "$", "this", "->", "action_items", "as", "$", "child_widget", ")", "{", "$", "set", "->", "addEntrySet", "(", "$", "child_widget", "->", "getHtmlHeadEntrySet", "(", ")", ")", ";", "}", "return", "$", "set", ";", "}" ]
Gets the SwatHtmlHeadEntry objects needed by this actions list @return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects needed by this actions list. @see SwatWidget::getHtmlHeadEntrySet()
[ "Gets", "the", "SwatHtmlHeadEntry", "objects", "needed", "by", "this", "actions", "list" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatActions.php#L302-L311
33,475
silverorange/swat
Swat/SwatActions.php
SwatActions.getAvailableHtmlHeadEntrySet
public function getAvailableHtmlHeadEntrySet() { $set = parent::getAvailableHtmlHeadEntrySet(); foreach ($this->action_items as $child_widget) { $set->addEntrySet($child_widget->getAvailableHtmlHeadEntrySet()); } return $set; }
php
public function getAvailableHtmlHeadEntrySet() { $set = parent::getAvailableHtmlHeadEntrySet(); foreach ($this->action_items as $child_widget) { $set->addEntrySet($child_widget->getAvailableHtmlHeadEntrySet()); } return $set; }
[ "public", "function", "getAvailableHtmlHeadEntrySet", "(", ")", "{", "$", "set", "=", "parent", "::", "getAvailableHtmlHeadEntrySet", "(", ")", ";", "foreach", "(", "$", "this", "->", "action_items", "as", "$", "child_widget", ")", "{", "$", "set", "->", "addEntrySet", "(", "$", "child_widget", "->", "getAvailableHtmlHeadEntrySet", "(", ")", ")", ";", "}", "return", "$", "set", ";", "}" ]
Gets the SwatHtmlHeadEntry objects that may be needed by this actions list @return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects that may be needed by this actions list. @see SwatWidget::getAvailableHtmlHeadEntrySet()
[ "Gets", "the", "SwatHtmlHeadEntry", "objects", "that", "may", "be", "needed", "by", "this", "actions", "list" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatActions.php#L325-L334
33,476
silverorange/swat
Swat/SwatActions.php
SwatActions.setViewSelector
public function setViewSelector( SwatView $view, SwatViewSelector $selector = null ) { if ($view === null) { $selector = null; } else { if ($selector === null) { $selector = $view->getFirstDescendant('SwatViewSelector'); } if ($selector === null) { throw new SwatException( 'No selector was specified and view does not have a ' . 'selector' ); } } $this->view = $view; $this->selector = $selector; }
php
public function setViewSelector( SwatView $view, SwatViewSelector $selector = null ) { if ($view === null) { $selector = null; } else { if ($selector === null) { $selector = $view->getFirstDescendant('SwatViewSelector'); } if ($selector === null) { throw new SwatException( 'No selector was specified and view does not have a ' . 'selector' ); } } $this->view = $view; $this->selector = $selector; }
[ "public", "function", "setViewSelector", "(", "SwatView", "$", "view", ",", "SwatViewSelector", "$", "selector", "=", "null", ")", "{", "if", "(", "$", "view", "===", "null", ")", "{", "$", "selector", "=", "null", ";", "}", "else", "{", "if", "(", "$", "selector", "===", "null", ")", "{", "$", "selector", "=", "$", "view", "->", "getFirstDescendant", "(", "'SwatViewSelector'", ")", ";", "}", "if", "(", "$", "selector", "===", "null", ")", "{", "throw", "new", "SwatException", "(", "'No selector was specified and view does not have a '", ".", "'selector'", ")", ";", "}", "}", "$", "this", "->", "view", "=", "$", "view", ";", "$", "this", "->", "selector", "=", "$", "selector", ";", "}" ]
Sets the optional view and selector of this actions control If a view and selector are specified for this actions control, submitting the form is prevented until one or more items in the view are selected by the selector. @param SwatView $view the view items must be selected in. Specify null to remove any existing view selector. @param SwatViewSelector $selector optional. The selector in the view that must select the items. If not specified, the first selector in the view is used. @throws SwatException if no selector is specified and the the specified view does not have a selector.
[ "Sets", "the", "optional", "view", "and", "selector", "of", "this", "actions", "control" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatActions.php#L503-L524
33,477
silverorange/swat
Swat/SwatActions.php
SwatActions.createCompositeWidgets
protected function createCompositeWidgets() { $flydown = new SwatFlydown($this->id . '_action_flydown'); $flydown->show_blank = $this->show_blank; $this->addCompositeWidget($flydown, 'action_flydown'); $button = new SwatButton($this->id . '_apply_button'); $this->addCompositeWidget($button, 'apply_button'); }
php
protected function createCompositeWidgets() { $flydown = new SwatFlydown($this->id . '_action_flydown'); $flydown->show_blank = $this->show_blank; $this->addCompositeWidget($flydown, 'action_flydown'); $button = new SwatButton($this->id . '_apply_button'); $this->addCompositeWidget($button, 'apply_button'); }
[ "protected", "function", "createCompositeWidgets", "(", ")", "{", "$", "flydown", "=", "new", "SwatFlydown", "(", "$", "this", "->", "id", ".", "'_action_flydown'", ")", ";", "$", "flydown", "->", "show_blank", "=", "$", "this", "->", "show_blank", ";", "$", "this", "->", "addCompositeWidget", "(", "$", "flydown", ",", "'action_flydown'", ")", ";", "$", "button", "=", "new", "SwatButton", "(", "$", "this", "->", "id", ".", "'_apply_button'", ")", ";", "$", "this", "->", "addCompositeWidget", "(", "$", "button", ",", "'apply_button'", ")", ";", "}" ]
Creates and the composite flydown and button widgets of this actions control
[ "Creates", "and", "the", "composite", "flydown", "and", "button", "widgets", "of", "this", "actions", "control" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatActions.php#L607-L616
33,478
silverorange/swat
Swat/SwatActions.php
SwatActions.getInlineJavaScript
protected function getInlineJavaScript() { static $shown = false; if (!$shown) { $javascript = $this->getInlineJavaScriptTranslations(); $shown = true; } else { $javascript = ''; } $values = array(); if ($this->show_blank) { $values[] = "''"; } foreach ($this->action_items as $item) { if ($item->visible) { $values[] = SwatString::quoteJavaScriptString($item->id); } } $selected_value = $this->selected === null ? 'null' : SwatString::quoteJavaScriptString($this->selected->id); $javascript .= sprintf( "var %s_obj = new SwatActions(%s, [%s], %s);", $this->id, SwatString::quoteJavaScriptString($this->id), implode(', ', $values), $selected_value ); if ($this->view !== null && $this->selector !== null) { $javascript .= sprintf( "\n%s_obj.setViewSelector(%s, '%s');", $this->id, $this->view->id, $this->selector->getId() ); } return $javascript; }
php
protected function getInlineJavaScript() { static $shown = false; if (!$shown) { $javascript = $this->getInlineJavaScriptTranslations(); $shown = true; } else { $javascript = ''; } $values = array(); if ($this->show_blank) { $values[] = "''"; } foreach ($this->action_items as $item) { if ($item->visible) { $values[] = SwatString::quoteJavaScriptString($item->id); } } $selected_value = $this->selected === null ? 'null' : SwatString::quoteJavaScriptString($this->selected->id); $javascript .= sprintf( "var %s_obj = new SwatActions(%s, [%s], %s);", $this->id, SwatString::quoteJavaScriptString($this->id), implode(', ', $values), $selected_value ); if ($this->view !== null && $this->selector !== null) { $javascript .= sprintf( "\n%s_obj.setViewSelector(%s, '%s');", $this->id, $this->view->id, $this->selector->getId() ); } return $javascript; }
[ "protected", "function", "getInlineJavaScript", "(", ")", "{", "static", "$", "shown", "=", "false", ";", "if", "(", "!", "$", "shown", ")", "{", "$", "javascript", "=", "$", "this", "->", "getInlineJavaScriptTranslations", "(", ")", ";", "$", "shown", "=", "true", ";", "}", "else", "{", "$", "javascript", "=", "''", ";", "}", "$", "values", "=", "array", "(", ")", ";", "if", "(", "$", "this", "->", "show_blank", ")", "{", "$", "values", "[", "]", "=", "\"''\"", ";", "}", "foreach", "(", "$", "this", "->", "action_items", "as", "$", "item", ")", "{", "if", "(", "$", "item", "->", "visible", ")", "{", "$", "values", "[", "]", "=", "SwatString", "::", "quoteJavaScriptString", "(", "$", "item", "->", "id", ")", ";", "}", "}", "$", "selected_value", "=", "$", "this", "->", "selected", "===", "null", "?", "'null'", ":", "SwatString", "::", "quoteJavaScriptString", "(", "$", "this", "->", "selected", "->", "id", ")", ";", "$", "javascript", ".=", "sprintf", "(", "\"var %s_obj = new SwatActions(%s, [%s], %s);\"", ",", "$", "this", "->", "id", ",", "SwatString", "::", "quoteJavaScriptString", "(", "$", "this", "->", "id", ")", ",", "implode", "(", "', '", ",", "$", "values", ")", ",", "$", "selected_value", ")", ";", "if", "(", "$", "this", "->", "view", "!==", "null", "&&", "$", "this", "->", "selector", "!==", "null", ")", "{", "$", "javascript", ".=", "sprintf", "(", "\"\\n%s_obj.setViewSelector(%s, '%s');\"", ",", "$", "this", "->", "id", ",", "$", "this", "->", "view", "->", "id", ",", "$", "this", "->", "selector", "->", "getId", "(", ")", ")", ";", "}", "return", "$", "javascript", ";", "}" ]
Gets inline JavaScript required to show and hide selected action items @return string inline JavaScript required to show and hide selected action items.
[ "Gets", "inline", "JavaScript", "required", "to", "show", "and", "hide", "selected", "action", "items" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatActions.php#L627-L672
33,479
spiral/dumper
src/Dumper.php
Dumper.dump
public function dump($value, int $target = self::OUTPUT): ?string { $r = $this->getRenderer($target); $dump = $r->wrapContent($this->renderValue($r, $value)); switch ($target) { case self::OUTPUT: echo $dump; break; case self::RETURN: return $dump; case self::LOGGER: if ($this->logger == null) { throw new DumperException("Unable to dump value to log, no associated LoggerInterface"); } $this->logger->debug($dump); break; case self::ERROR_LOG: error_log($dump, 0); break; } return null; }
php
public function dump($value, int $target = self::OUTPUT): ?string { $r = $this->getRenderer($target); $dump = $r->wrapContent($this->renderValue($r, $value)); switch ($target) { case self::OUTPUT: echo $dump; break; case self::RETURN: return $dump; case self::LOGGER: if ($this->logger == null) { throw new DumperException("Unable to dump value to log, no associated LoggerInterface"); } $this->logger->debug($dump); break; case self::ERROR_LOG: error_log($dump, 0); break; } return null; }
[ "public", "function", "dump", "(", "$", "value", ",", "int", "$", "target", "=", "self", "::", "OUTPUT", ")", ":", "?", "string", "{", "$", "r", "=", "$", "this", "->", "getRenderer", "(", "$", "target", ")", ";", "$", "dump", "=", "$", "r", "->", "wrapContent", "(", "$", "this", "->", "renderValue", "(", "$", "r", ",", "$", "value", ")", ")", ";", "switch", "(", "$", "target", ")", "{", "case", "self", "::", "OUTPUT", ":", "echo", "$", "dump", ";", "break", ";", "case", "self", "::", "RETURN", ":", "return", "$", "dump", ";", "case", "self", "::", "LOGGER", ":", "if", "(", "$", "this", "->", "logger", "==", "null", ")", "{", "throw", "new", "DumperException", "(", "\"Unable to dump value to log, no associated LoggerInterface\"", ")", ";", "}", "$", "this", "->", "logger", "->", "debug", "(", "$", "dump", ")", ";", "break", ";", "case", "self", "::", "ERROR_LOG", ":", "error_log", "(", "$", "dump", ",", "0", ")", ";", "break", ";", "}", "return", "null", ";", "}" ]
Dump given value into target output. @param mixed $value @param int $target Possible options: OUTPUT, RETURN, ERROR_LOG, LOGGER. @return string @throws DumperException
[ "Dump", "given", "value", "into", "target", "output", "." ]
87bc579b0ecd69754197804b1fc5e0d5b3293bd3
https://github.com/spiral/dumper/blob/87bc579b0ecd69754197804b1fc5e0d5b3293bd3/src/Dumper.php#L82-L108
33,480
spiral/dumper
src/Dumper.php
Dumper.setRenderer
public function setRenderer(int $target, RendererInterface $renderer): Dumper { if (!isset($this->targets[$target])) { throw new DumperException(sprintf("Undefined dump target %d", $target)); } $this->targets[$target] = $renderer; return $this; }
php
public function setRenderer(int $target, RendererInterface $renderer): Dumper { if (!isset($this->targets[$target])) { throw new DumperException(sprintf("Undefined dump target %d", $target)); } $this->targets[$target] = $renderer; return $this; }
[ "public", "function", "setRenderer", "(", "int", "$", "target", ",", "RendererInterface", "$", "renderer", ")", ":", "Dumper", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "targets", "[", "$", "target", "]", ")", ")", "{", "throw", "new", "DumperException", "(", "sprintf", "(", "\"Undefined dump target %d\"", ",", "$", "target", ")", ")", ";", "}", "$", "this", "->", "targets", "[", "$", "target", "]", "=", "$", "renderer", ";", "return", "$", "this", ";", "}" ]
Associate rendered with given output target. @param int $target @param RendererInterface $renderer @return Dumper @throws DumperException
[ "Associate", "rendered", "with", "given", "output", "target", "." ]
87bc579b0ecd69754197804b1fc5e0d5b3293bd3
https://github.com/spiral/dumper/blob/87bc579b0ecd69754197804b1fc5e0d5b3293bd3/src/Dumper.php#L118-L127
33,481
spiral/dumper
src/Dumper.php
Dumper.getRenderer
private function getRenderer(int $target): RendererInterface { if ($target == self::OUTPUT && System::isCLI()) { if (System::isColorsSupported(STDOUT)) { $target = self::OUTPUT_CLI_COLORS; } else { $target = self::OUTPUT_CLI; } } if (!isset($this->targets[$target])) { throw new DumperException(sprintf("Undefined dump target %d", $target)); } if (is_string($this->targets[$target])) { $this->targets[$target] = new $this->targets[$target](); } return $this->targets[$target]; }
php
private function getRenderer(int $target): RendererInterface { if ($target == self::OUTPUT && System::isCLI()) { if (System::isColorsSupported(STDOUT)) { $target = self::OUTPUT_CLI_COLORS; } else { $target = self::OUTPUT_CLI; } } if (!isset($this->targets[$target])) { throw new DumperException(sprintf("Undefined dump target %d", $target)); } if (is_string($this->targets[$target])) { $this->targets[$target] = new $this->targets[$target](); } return $this->targets[$target]; }
[ "private", "function", "getRenderer", "(", "int", "$", "target", ")", ":", "RendererInterface", "{", "if", "(", "$", "target", "==", "self", "::", "OUTPUT", "&&", "System", "::", "isCLI", "(", ")", ")", "{", "if", "(", "System", "::", "isColorsSupported", "(", "STDOUT", ")", ")", "{", "$", "target", "=", "self", "::", "OUTPUT_CLI_COLORS", ";", "}", "else", "{", "$", "target", "=", "self", "::", "OUTPUT_CLI", ";", "}", "}", "if", "(", "!", "isset", "(", "$", "this", "->", "targets", "[", "$", "target", "]", ")", ")", "{", "throw", "new", "DumperException", "(", "sprintf", "(", "\"Undefined dump target %d\"", ",", "$", "target", ")", ")", ";", "}", "if", "(", "is_string", "(", "$", "this", "->", "targets", "[", "$", "target", "]", ")", ")", "{", "$", "this", "->", "targets", "[", "$", "target", "]", "=", "new", "$", "this", "->", "targets", "[", "$", "target", "]", "(", ")", ";", "}", "return", "$", "this", "->", "targets", "[", "$", "target", "]", ";", "}" ]
Returns renderer instance associated with given output target. Automatically detects CLI mode, RR mode and colorization support. @param int $target @return RendererInterface @throws DumperException
[ "Returns", "renderer", "instance", "associated", "with", "given", "output", "target", ".", "Automatically", "detects", "CLI", "mode", "RR", "mode", "and", "colorization", "support", "." ]
87bc579b0ecd69754197804b1fc5e0d5b3293bd3
https://github.com/spiral/dumper/blob/87bc579b0ecd69754197804b1fc5e0d5b3293bd3/src/Dumper.php#L137-L156
33,482
honey-comb/core
src/Repositories/Acl/HCPermissionRepository.php
HCPermissionRepository.deletePermission
public function deletePermission(string $action): void { /** @var HCAclPermission $permission */ $permission = $this->findOneBy(['action' => $action]); $permission->roles()->detach(); $permission->forceDelete(); }
php
public function deletePermission(string $action): void { /** @var HCAclPermission $permission */ $permission = $this->findOneBy(['action' => $action]); $permission->roles()->detach(); $permission->forceDelete(); }
[ "public", "function", "deletePermission", "(", "string", "$", "action", ")", ":", "void", "{", "/** @var HCAclPermission $permission */", "$", "permission", "=", "$", "this", "->", "findOneBy", "(", "[", "'action'", "=>", "$", "action", "]", ")", ";", "$", "permission", "->", "roles", "(", ")", "->", "detach", "(", ")", ";", "$", "permission", "->", "forceDelete", "(", ")", ";", "}" ]
Deleting permission with and remove it from role_permission connection @param string $action @throws \Exception
[ "Deleting", "permission", "with", "and", "remove", "it", "from", "role_permission", "connection" ]
5c12aba31cae092e9681f0ae3e3664ed3fcec956
https://github.com/honey-comb/core/blob/5c12aba31cae092e9681f0ae3e3664ed3fcec956/src/Repositories/Acl/HCPermissionRepository.php#L58-L66
33,483
rollun-com/rollun-datastore
src/DataStore/src/TableGateway/TableManagerMysql.php
TableManagerMysql.createTable
public function createTable($tableName, $tableConfig = null) { if ($this->hasTable($tableName)) { throw new RuntimeException("Table with name {$tableName} is exist. Use rewriteTable()"); } return $this->create($tableName, $tableConfig); }
php
public function createTable($tableName, $tableConfig = null) { if ($this->hasTable($tableName)) { throw new RuntimeException("Table with name {$tableName} is exist. Use rewriteTable()"); } return $this->create($tableName, $tableConfig); }
[ "public", "function", "createTable", "(", "$", "tableName", ",", "$", "tableConfig", "=", "null", ")", "{", "if", "(", "$", "this", "->", "hasTable", "(", "$", "tableName", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"Table with name {$tableName} is exist. Use rewriteTable()\"", ")", ";", "}", "return", "$", "this", "->", "create", "(", "$", "tableName", ",", "$", "tableConfig", ")", ";", "}" ]
Preparing method of creating table Checks if the table exists and than if one don't creates the new table @param string $tableName @param string $tableConfig @return mixed @throws RuntimeException @throws Exception
[ "Preparing", "method", "of", "creating", "table" ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/TableGateway/TableManagerMysql.php#L244-L251
33,484
rollun-com/rollun-datastore
src/DataStore/src/TableGateway/TableManagerMysql.php
TableManagerMysql.rewriteTable
public function rewriteTable($tableName, $tableConfig = null) { if ($this->hasTable($tableName)) { $this->deleteTable($tableName); } return $this->create($tableName, $tableConfig); }
php
public function rewriteTable($tableName, $tableConfig = null) { if ($this->hasTable($tableName)) { $this->deleteTable($tableName); } return $this->create($tableName, $tableConfig); }
[ "public", "function", "rewriteTable", "(", "$", "tableName", ",", "$", "tableConfig", "=", "null", ")", "{", "if", "(", "$", "this", "->", "hasTable", "(", "$", "tableName", ")", ")", "{", "$", "this", "->", "deleteTable", "(", "$", "tableName", ")", ";", "}", "return", "$", "this", "->", "create", "(", "$", "tableName", ",", "$", "tableConfig", ")", ";", "}" ]
Rewrites the table. Rewrite == delete existing table + create the new table @param string $tableName @param string $tableConfig @return mixed
[ "Rewrites", "the", "table", "." ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/TableGateway/TableManagerMysql.php#L262-L269
33,485
rollun-com/rollun-datastore
src/DataStore/src/TableGateway/TableManagerMysql.php
TableManagerMysql.getTableInfoStr
public function getTableInfoStr($tableName) { $metadata = Factory::createSourceFromAdapter($this->db); $table = $metadata->getTable($tableName); $spaces = function ($count) { return str_repeat(' ', $count); }; $result = "{$spaces(4)}With columns:" . PHP_EOL; /** @var ColumnObject $column */ foreach ($table->getColumns() as $column) { $result .= "{$spaces(8)}{$column->getName()} -> {$column->getDataType()}" . PHP_EOL; } $result .= PHP_EOL; $result .= "{$spaces(4)}With constraints:" . PHP_EOL; /** @var ConstraintObject $constraint */ foreach ($metadata->getConstraints($tableName) as $constraint) { $result .= "{$spaces(8)}{$constraint->getName()} -> {$constraint->getType()}" . PHP_EOL; if (!$constraint->hasColumns()) { continue; } $result .= "{$spaces(12)}column: " . implode(', ', $constraint->getColumns()); if ($constraint->isForeignKey()) { $foreignKeyColumns = []; foreach ($constraint->getReferencedColumns() as $referenceColumn) { $foreignKeyColumns[] = "{$constraint->getReferencedTableName()}.{$referenceColumn}"; } $result .= ' => ' . implode(', ', $foreignKeyColumns) . PHP_EOL; $result .= "{$spaces(12)}OnDeleteRule: {$constraint->getDeleteRule()}" . PHP_EOL; $result .= "{$spaces(12)}OnUpdateRule: {$constraint->getUpdateRule()}" . PHP_EOL; } else { $result .= PHP_EOL; } } return $result; }
php
public function getTableInfoStr($tableName) { $metadata = Factory::createSourceFromAdapter($this->db); $table = $metadata->getTable($tableName); $spaces = function ($count) { return str_repeat(' ', $count); }; $result = "{$spaces(4)}With columns:" . PHP_EOL; /** @var ColumnObject $column */ foreach ($table->getColumns() as $column) { $result .= "{$spaces(8)}{$column->getName()} -> {$column->getDataType()}" . PHP_EOL; } $result .= PHP_EOL; $result .= "{$spaces(4)}With constraints:" . PHP_EOL; /** @var ConstraintObject $constraint */ foreach ($metadata->getConstraints($tableName) as $constraint) { $result .= "{$spaces(8)}{$constraint->getName()} -> {$constraint->getType()}" . PHP_EOL; if (!$constraint->hasColumns()) { continue; } $result .= "{$spaces(12)}column: " . implode(', ', $constraint->getColumns()); if ($constraint->isForeignKey()) { $foreignKeyColumns = []; foreach ($constraint->getReferencedColumns() as $referenceColumn) { $foreignKeyColumns[] = "{$constraint->getReferencedTableName()}.{$referenceColumn}"; } $result .= ' => ' . implode(', ', $foreignKeyColumns) . PHP_EOL; $result .= "{$spaces(12)}OnDeleteRule: {$constraint->getDeleteRule()}" . PHP_EOL; $result .= "{$spaces(12)}OnUpdateRule: {$constraint->getUpdateRule()}" . PHP_EOL; } else { $result .= PHP_EOL; } } return $result; }
[ "public", "function", "getTableInfoStr", "(", "$", "tableName", ")", "{", "$", "metadata", "=", "Factory", "::", "createSourceFromAdapter", "(", "$", "this", "->", "db", ")", ";", "$", "table", "=", "$", "metadata", "->", "getTable", "(", "$", "tableName", ")", ";", "$", "spaces", "=", "function", "(", "$", "count", ")", "{", "return", "str_repeat", "(", "' '", ",", "$", "count", ")", ";", "}", ";", "$", "result", "=", "\"{$spaces(4)}With columns:\"", ".", "PHP_EOL", ";", "/** @var ColumnObject $column */", "foreach", "(", "$", "table", "->", "getColumns", "(", ")", "as", "$", "column", ")", "{", "$", "result", ".=", "\"{$spaces(8)}{$column->getName()} -> {$column->getDataType()}\"", ".", "PHP_EOL", ";", "}", "$", "result", ".=", "PHP_EOL", ";", "$", "result", ".=", "\"{$spaces(4)}With constraints:\"", ".", "PHP_EOL", ";", "/** @var ConstraintObject $constraint */", "foreach", "(", "$", "metadata", "->", "getConstraints", "(", "$", "tableName", ")", "as", "$", "constraint", ")", "{", "$", "result", ".=", "\"{$spaces(8)}{$constraint->getName()} -> {$constraint->getType()}\"", ".", "PHP_EOL", ";", "if", "(", "!", "$", "constraint", "->", "hasColumns", "(", ")", ")", "{", "continue", ";", "}", "$", "result", ".=", "\"{$spaces(12)}column: \"", ".", "implode", "(", "', '", ",", "$", "constraint", "->", "getColumns", "(", ")", ")", ";", "if", "(", "$", "constraint", "->", "isForeignKey", "(", ")", ")", "{", "$", "foreignKeyColumns", "=", "[", "]", ";", "foreach", "(", "$", "constraint", "->", "getReferencedColumns", "(", ")", "as", "$", "referenceColumn", ")", "{", "$", "foreignKeyColumns", "[", "]", "=", "\"{$constraint->getReferencedTableName()}.{$referenceColumn}\"", ";", "}", "$", "result", ".=", "' => '", ".", "implode", "(", "', '", ",", "$", "foreignKeyColumns", ")", ".", "PHP_EOL", ";", "$", "result", ".=", "\"{$spaces(12)}OnDeleteRule: {$constraint->getDeleteRule()}\"", ".", "PHP_EOL", ";", "$", "result", ".=", "\"{$spaces(12)}OnUpdateRule: {$constraint->getUpdateRule()}\"", ".", "PHP_EOL", ";", "}", "else", "{", "$", "result", ".=", "PHP_EOL", ";", "}", "}", "return", "$", "result", ";", "}" ]
Builds and gets table info @see http://framework.zend.com/manual/current/en/modules/zend.db.metadata.html @param string $tableName @return string
[ "Builds", "and", "gets", "table", "info" ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/TableGateway/TableManagerMysql.php#L292-L336
33,486
rollun-com/rollun-datastore
src/DataStore/src/TableGateway/TableManagerMysql.php
TableManagerMysql.getTableConfig
public function getTableConfig($tableConfig) { if (is_string($tableConfig)) { $config = $this->getConfig(); if (isset($config[self::KEY_TABLES_CONFIGS][$tableConfig])) { $tableConfig = $config[self::KEY_TABLES_CONFIGS][$tableConfig]; } else { throw new InvalidArgumentException("Unknown table '{$tableConfig}' in config"); } } return $tableConfig; }
php
public function getTableConfig($tableConfig) { if (is_string($tableConfig)) { $config = $this->getConfig(); if (isset($config[self::KEY_TABLES_CONFIGS][$tableConfig])) { $tableConfig = $config[self::KEY_TABLES_CONFIGS][$tableConfig]; } else { throw new InvalidArgumentException("Unknown table '{$tableConfig}' in config"); } } return $tableConfig; }
[ "public", "function", "getTableConfig", "(", "$", "tableConfig", ")", "{", "if", "(", "is_string", "(", "$", "tableConfig", ")", ")", "{", "$", "config", "=", "$", "this", "->", "getConfig", "(", ")", ";", "if", "(", "isset", "(", "$", "config", "[", "self", "::", "KEY_TABLES_CONFIGS", "]", "[", "$", "tableConfig", "]", ")", ")", "{", "$", "tableConfig", "=", "$", "config", "[", "self", "::", "KEY_TABLES_CONFIGS", "]", "[", "$", "tableConfig", "]", ";", "}", "else", "{", "throw", "new", "InvalidArgumentException", "(", "\"Unknown table '{$tableConfig}' in config\"", ")", ";", "}", "}", "return", "$", "tableConfig", ";", "}" ]
Fetches the table config from common config of all the tables @param $tableConfig @return mixed @throws Exception
[ "Fetches", "the", "table", "config", "from", "common", "config", "of", "all", "the", "tables" ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/TableGateway/TableManagerMysql.php#L383-L396
33,487
rollun-com/rollun-datastore
src/DataStore/src/TableGateway/TableManagerMysql.php
TableManagerMysql.create
protected function create($tableName, $tableConfig = null) { $tableConfig = is_null($tableConfig) ? $tableConfig = $tableName : $tableConfig; $createTable = $this->createCreateTable($tableName, $this->getTableConfig($tableConfig)); $sql = $this->getCreateTableSql($createTable, $tableName); return $this->db->query($sql, Adapter\Adapter::QUERY_MODE_EXECUTE); }
php
protected function create($tableName, $tableConfig = null) { $tableConfig = is_null($tableConfig) ? $tableConfig = $tableName : $tableConfig; $createTable = $this->createCreateTable($tableName, $this->getTableConfig($tableConfig)); $sql = $this->getCreateTableSql($createTable, $tableName); return $this->db->query($sql, Adapter\Adapter::QUERY_MODE_EXECUTE); }
[ "protected", "function", "create", "(", "$", "tableName", ",", "$", "tableConfig", "=", "null", ")", "{", "$", "tableConfig", "=", "is_null", "(", "$", "tableConfig", ")", "?", "$", "tableConfig", "=", "$", "tableName", ":", "$", "tableConfig", ";", "$", "createTable", "=", "$", "this", "->", "createCreateTable", "(", "$", "tableName", ",", "$", "this", "->", "getTableConfig", "(", "$", "tableConfig", ")", ")", ";", "$", "sql", "=", "$", "this", "->", "getCreateTableSql", "(", "$", "createTable", ",", "$", "tableName", ")", ";", "return", "$", "this", "->", "db", "->", "query", "(", "$", "sql", ",", "Adapter", "\\", "Adapter", "::", "QUERY_MODE_EXECUTE", ")", ";", "}" ]
Creates table by its name and config @param $tableName @param $tableConfig @return Adapter\Driver\StatementInterface|\Zend\Db\ResultSet\ResultSet @throws Exception
[ "Creates", "table", "by", "its", "name", "and", "config" ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/TableGateway/TableManagerMysql.php#L406-L413
33,488
rollun-com/rollun-datastore
src/DataStore/src/TableGateway/TableManagerMysql.php
TableManagerMysql.createCreateTable
protected function createCreateTable(string $tableName, array $tableConfig): CreateTable { $createTable = new CreateTable($tableName); $primaryKeys = []; foreach ($tableConfig as $fieldName => $fieldData) { if (isset($fieldData[static::PRIMARY_KEY])) { $primaryKeys[] = $fieldName; } $column = $this->createColumn($fieldData, $fieldName); $createTable->addColumn($column); if (isset($fieldData[self::UNIQUE_KEY])) { $constrain = $this->createUniqueKeyConstraint($fieldData[self::UNIQUE_KEY], $fieldName, $tableName); $createTable->addConstraint($constrain); } if (isset($fieldData[self::FOREIGN_KEY])) { $constrain = $this->createForeignKeyConstraint($fieldData[self::FOREIGN_KEY], $fieldName, $tableName); $createTable->addConstraint($constrain); } } if (count($primaryKeys)) { $createTable->addConstraint(new Constraint\PrimaryKey(...$primaryKeys)); } else { $createTable->addConstraint(new Constraint\PrimaryKey('id')); } return $createTable; }
php
protected function createCreateTable(string $tableName, array $tableConfig): CreateTable { $createTable = new CreateTable($tableName); $primaryKeys = []; foreach ($tableConfig as $fieldName => $fieldData) { if (isset($fieldData[static::PRIMARY_KEY])) { $primaryKeys[] = $fieldName; } $column = $this->createColumn($fieldData, $fieldName); $createTable->addColumn($column); if (isset($fieldData[self::UNIQUE_KEY])) { $constrain = $this->createUniqueKeyConstraint($fieldData[self::UNIQUE_KEY], $fieldName, $tableName); $createTable->addConstraint($constrain); } if (isset($fieldData[self::FOREIGN_KEY])) { $constrain = $this->createForeignKeyConstraint($fieldData[self::FOREIGN_KEY], $fieldName, $tableName); $createTable->addConstraint($constrain); } } if (count($primaryKeys)) { $createTable->addConstraint(new Constraint\PrimaryKey(...$primaryKeys)); } else { $createTable->addConstraint(new Constraint\PrimaryKey('id')); } return $createTable; }
[ "protected", "function", "createCreateTable", "(", "string", "$", "tableName", ",", "array", "$", "tableConfig", ")", ":", "CreateTable", "{", "$", "createTable", "=", "new", "CreateTable", "(", "$", "tableName", ")", ";", "$", "primaryKeys", "=", "[", "]", ";", "foreach", "(", "$", "tableConfig", "as", "$", "fieldName", "=>", "$", "fieldData", ")", "{", "if", "(", "isset", "(", "$", "fieldData", "[", "static", "::", "PRIMARY_KEY", "]", ")", ")", "{", "$", "primaryKeys", "[", "]", "=", "$", "fieldName", ";", "}", "$", "column", "=", "$", "this", "->", "createColumn", "(", "$", "fieldData", ",", "$", "fieldName", ")", ";", "$", "createTable", "->", "addColumn", "(", "$", "column", ")", ";", "if", "(", "isset", "(", "$", "fieldData", "[", "self", "::", "UNIQUE_KEY", "]", ")", ")", "{", "$", "constrain", "=", "$", "this", "->", "createUniqueKeyConstraint", "(", "$", "fieldData", "[", "self", "::", "UNIQUE_KEY", "]", ",", "$", "fieldName", ",", "$", "tableName", ")", ";", "$", "createTable", "->", "addConstraint", "(", "$", "constrain", ")", ";", "}", "if", "(", "isset", "(", "$", "fieldData", "[", "self", "::", "FOREIGN_KEY", "]", ")", ")", "{", "$", "constrain", "=", "$", "this", "->", "createForeignKeyConstraint", "(", "$", "fieldData", "[", "self", "::", "FOREIGN_KEY", "]", ",", "$", "fieldName", ",", "$", "tableName", ")", ";", "$", "createTable", "->", "addConstraint", "(", "$", "constrain", ")", ";", "}", "}", "if", "(", "count", "(", "$", "primaryKeys", ")", ")", "{", "$", "createTable", "->", "addConstraint", "(", "new", "Constraint", "\\", "PrimaryKey", "(", "...", "$", "primaryKeys", ")", ")", ";", "}", "else", "{", "$", "createTable", "->", "addConstraint", "(", "new", "Constraint", "\\", "PrimaryKey", "(", "'id'", ")", ")", ";", "}", "return", "$", "createTable", ";", "}" ]
Create and return instance of CreateTable @param $tableName @param $tableConfig @return CreateTable
[ "Create", "and", "return", "instance", "of", "CreateTable" ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/TableGateway/TableManagerMysql.php#L422-L453
33,489
rollun-com/rollun-datastore
src/DataStore/src/TableGateway/TableManagerMysql.php
TableManagerMysql.createColumn
protected function createColumn(array $fieldData, string $fieldName): ColumnInterface { $fieldType = $fieldData[self::FIELD_TYPE]; switch (true) { case key_exists($fieldType, $this->fieldClasses[self::COLUMN_SIMPLE]): $defaultFieldParameters = $this->parameters[self::COLUMN_SIMPLE]; $columnClass = $this->fieldClasses[self::COLUMN_SIMPLE][$fieldType]; break; case key_exists($fieldType, $this->fieldClasses[self::COLUMN_LENGTH]): $defaultFieldParameters = $this->parameters[self::COLUMN_LENGTH]; $columnClass = $this->fieldClasses[self::COLUMN_LENGTH][$fieldType]; break; case key_exists($fieldType, $this->fieldClasses[self::COLUMN_PRECISION]): $defaultFieldParameters = $this->parameters[self::COLUMN_PRECISION]; $columnClass = $this->fieldClasses[self::COLUMN_PRECISION][$fieldType]; break; default: throw new InvalidArgumentException("Unknown field type: {$fieldType}"); } $args = []; foreach ($defaultFieldParameters as $key => $value) { if ($key === self::PROPERTY_OPTIONS && isset($fieldData[self::FIELD_PARAMS][self::PROPERTY_OPTIONS]) && key_exists(self::OPTION_AUTOINCREMENT, $fieldData[self::FIELD_PARAMS][self::PROPERTY_OPTIONS])) { trigger_error("Autoincrement field is deprecated", E_USER_DEPRECATED); } if (isset($fieldData[self::FIELD_PARAMS]) && key_exists($key, $fieldData[self::FIELD_PARAMS])) { $args[] = $fieldData[self::FIELD_PARAMS][$key]; } else { $args[] = $value; } } array_unshift($args, $fieldName); return new $columnClass(...$args); }
php
protected function createColumn(array $fieldData, string $fieldName): ColumnInterface { $fieldType = $fieldData[self::FIELD_TYPE]; switch (true) { case key_exists($fieldType, $this->fieldClasses[self::COLUMN_SIMPLE]): $defaultFieldParameters = $this->parameters[self::COLUMN_SIMPLE]; $columnClass = $this->fieldClasses[self::COLUMN_SIMPLE][$fieldType]; break; case key_exists($fieldType, $this->fieldClasses[self::COLUMN_LENGTH]): $defaultFieldParameters = $this->parameters[self::COLUMN_LENGTH]; $columnClass = $this->fieldClasses[self::COLUMN_LENGTH][$fieldType]; break; case key_exists($fieldType, $this->fieldClasses[self::COLUMN_PRECISION]): $defaultFieldParameters = $this->parameters[self::COLUMN_PRECISION]; $columnClass = $this->fieldClasses[self::COLUMN_PRECISION][$fieldType]; break; default: throw new InvalidArgumentException("Unknown field type: {$fieldType}"); } $args = []; foreach ($defaultFieldParameters as $key => $value) { if ($key === self::PROPERTY_OPTIONS && isset($fieldData[self::FIELD_PARAMS][self::PROPERTY_OPTIONS]) && key_exists(self::OPTION_AUTOINCREMENT, $fieldData[self::FIELD_PARAMS][self::PROPERTY_OPTIONS])) { trigger_error("Autoincrement field is deprecated", E_USER_DEPRECATED); } if (isset($fieldData[self::FIELD_PARAMS]) && key_exists($key, $fieldData[self::FIELD_PARAMS])) { $args[] = $fieldData[self::FIELD_PARAMS][$key]; } else { $args[] = $value; } } array_unshift($args, $fieldName); return new $columnClass(...$args); }
[ "protected", "function", "createColumn", "(", "array", "$", "fieldData", ",", "string", "$", "fieldName", ")", ":", "ColumnInterface", "{", "$", "fieldType", "=", "$", "fieldData", "[", "self", "::", "FIELD_TYPE", "]", ";", "switch", "(", "true", ")", "{", "case", "key_exists", "(", "$", "fieldType", ",", "$", "this", "->", "fieldClasses", "[", "self", "::", "COLUMN_SIMPLE", "]", ")", ":", "$", "defaultFieldParameters", "=", "$", "this", "->", "parameters", "[", "self", "::", "COLUMN_SIMPLE", "]", ";", "$", "columnClass", "=", "$", "this", "->", "fieldClasses", "[", "self", "::", "COLUMN_SIMPLE", "]", "[", "$", "fieldType", "]", ";", "break", ";", "case", "key_exists", "(", "$", "fieldType", ",", "$", "this", "->", "fieldClasses", "[", "self", "::", "COLUMN_LENGTH", "]", ")", ":", "$", "defaultFieldParameters", "=", "$", "this", "->", "parameters", "[", "self", "::", "COLUMN_LENGTH", "]", ";", "$", "columnClass", "=", "$", "this", "->", "fieldClasses", "[", "self", "::", "COLUMN_LENGTH", "]", "[", "$", "fieldType", "]", ";", "break", ";", "case", "key_exists", "(", "$", "fieldType", ",", "$", "this", "->", "fieldClasses", "[", "self", "::", "COLUMN_PRECISION", "]", ")", ":", "$", "defaultFieldParameters", "=", "$", "this", "->", "parameters", "[", "self", "::", "COLUMN_PRECISION", "]", ";", "$", "columnClass", "=", "$", "this", "->", "fieldClasses", "[", "self", "::", "COLUMN_PRECISION", "]", "[", "$", "fieldType", "]", ";", "break", ";", "default", ":", "throw", "new", "InvalidArgumentException", "(", "\"Unknown field type: {$fieldType}\"", ")", ";", "}", "$", "args", "=", "[", "]", ";", "foreach", "(", "$", "defaultFieldParameters", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "$", "key", "===", "self", "::", "PROPERTY_OPTIONS", "&&", "isset", "(", "$", "fieldData", "[", "self", "::", "FIELD_PARAMS", "]", "[", "self", "::", "PROPERTY_OPTIONS", "]", ")", "&&", "key_exists", "(", "self", "::", "OPTION_AUTOINCREMENT", ",", "$", "fieldData", "[", "self", "::", "FIELD_PARAMS", "]", "[", "self", "::", "PROPERTY_OPTIONS", "]", ")", ")", "{", "trigger_error", "(", "\"Autoincrement field is deprecated\"", ",", "E_USER_DEPRECATED", ")", ";", "}", "if", "(", "isset", "(", "$", "fieldData", "[", "self", "::", "FIELD_PARAMS", "]", ")", "&&", "key_exists", "(", "$", "key", ",", "$", "fieldData", "[", "self", "::", "FIELD_PARAMS", "]", ")", ")", "{", "$", "args", "[", "]", "=", "$", "fieldData", "[", "self", "::", "FIELD_PARAMS", "]", "[", "$", "key", "]", ";", "}", "else", "{", "$", "args", "[", "]", "=", "$", "value", ";", "}", "}", "array_unshift", "(", "$", "args", ",", "$", "fieldName", ")", ";", "return", "new", "$", "columnClass", "(", "...", "$", "args", ")", ";", "}" ]
Create and return instance of ColumnInterface @param array $fieldData @param string $fieldName @return ColumnInterface
[ "Create", "and", "return", "instance", "of", "ColumnInterface" ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/TableGateway/TableManagerMysql.php#L480-L520
33,490
rollun-com/rollun-datastore
src/DataStore/src/TableGateway/TableManagerMysql.php
TableManagerMysql.createUniqueKeyConstraint
protected function createUniqueKeyConstraint( $constraintOptions, string $fieldName, string $tableName ): Constraint\UniqueKey { $constraintName = is_string($constraintOptions) ? $constraintOptions : "UniqueKey_{$tableName}_{$fieldName}"; return new Constraint\UniqueKey([$fieldName], $constraintName); }
php
protected function createUniqueKeyConstraint( $constraintOptions, string $fieldName, string $tableName ): Constraint\UniqueKey { $constraintName = is_string($constraintOptions) ? $constraintOptions : "UniqueKey_{$tableName}_{$fieldName}"; return new Constraint\UniqueKey([$fieldName], $constraintName); }
[ "protected", "function", "createUniqueKeyConstraint", "(", "$", "constraintOptions", ",", "string", "$", "fieldName", ",", "string", "$", "tableName", ")", ":", "Constraint", "\\", "UniqueKey", "{", "$", "constraintName", "=", "is_string", "(", "$", "constraintOptions", ")", "?", "$", "constraintOptions", ":", "\"UniqueKey_{$tableName}_{$fieldName}\"", ";", "return", "new", "Constraint", "\\", "UniqueKey", "(", "[", "$", "fieldName", "]", ",", "$", "constraintName", ")", ";", "}" ]
Create and return instance of Constraint\UniqueKey @param null $constraintOptions @param string $fieldName @param string $tableName @return Constraint\UniqueKey
[ "Create", "and", "return", "instance", "of", "Constraint", "\\", "UniqueKey" ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/TableGateway/TableManagerMysql.php#L530-L538
33,491
rollun-com/rollun-datastore
src/DataStore/src/TableGateway/TableManagerMysql.php
TableManagerMysql.createForeignKeyConstraint
protected function createForeignKeyConstraint(array $constraintOptions, string $fieldName, string $tableName) { if (is_string($constraintOptions['name'] ?? null)) { $constraintName = $constraintOptions; } else { $constraintName = "ForeignKey_{$tableName}_{$fieldName}"; } if (empty($constraintOptions['referenceTable'])) { throw new InvalidArgumentException("Missing option 'referenceTable' for foreign key constraint"); } if (empty($constraintOptions['referenceColumn'])) { throw new InvalidArgumentException("Missing option 'referenceColumn' for foreign key constraint"); } return new Constraint\ForeignKey( $constraintName, [$fieldName], $constraintOptions['referenceTable'], $constraintOptions['referenceColumn'], $constraintOptions['onDeleteRule'] ?? null, $constraintOptions['onUpdateRule'] ?? null ); }
php
protected function createForeignKeyConstraint(array $constraintOptions, string $fieldName, string $tableName) { if (is_string($constraintOptions['name'] ?? null)) { $constraintName = $constraintOptions; } else { $constraintName = "ForeignKey_{$tableName}_{$fieldName}"; } if (empty($constraintOptions['referenceTable'])) { throw new InvalidArgumentException("Missing option 'referenceTable' for foreign key constraint"); } if (empty($constraintOptions['referenceColumn'])) { throw new InvalidArgumentException("Missing option 'referenceColumn' for foreign key constraint"); } return new Constraint\ForeignKey( $constraintName, [$fieldName], $constraintOptions['referenceTable'], $constraintOptions['referenceColumn'], $constraintOptions['onDeleteRule'] ?? null, $constraintOptions['onUpdateRule'] ?? null ); }
[ "protected", "function", "createForeignKeyConstraint", "(", "array", "$", "constraintOptions", ",", "string", "$", "fieldName", ",", "string", "$", "tableName", ")", "{", "if", "(", "is_string", "(", "$", "constraintOptions", "[", "'name'", "]", "??", "null", ")", ")", "{", "$", "constraintName", "=", "$", "constraintOptions", ";", "}", "else", "{", "$", "constraintName", "=", "\"ForeignKey_{$tableName}_{$fieldName}\"", ";", "}", "if", "(", "empty", "(", "$", "constraintOptions", "[", "'referenceTable'", "]", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "\"Missing option 'referenceTable' for foreign key constraint\"", ")", ";", "}", "if", "(", "empty", "(", "$", "constraintOptions", "[", "'referenceColumn'", "]", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "\"Missing option 'referenceColumn' for foreign key constraint\"", ")", ";", "}", "return", "new", "Constraint", "\\", "ForeignKey", "(", "$", "constraintName", ",", "[", "$", "fieldName", "]", ",", "$", "constraintOptions", "[", "'referenceTable'", "]", ",", "$", "constraintOptions", "[", "'referenceColumn'", "]", ",", "$", "constraintOptions", "[", "'onDeleteRule'", "]", "??", "null", ",", "$", "constraintOptions", "[", "'onUpdateRule'", "]", "??", "null", ")", ";", "}" ]
Create and return instance of Constraint\ForeignKey @param array $constraintOptions @param string $fieldName @param string $tableName @return Constraint\ForeignKey
[ "Create", "and", "return", "instance", "of", "Constraint", "\\", "ForeignKey" ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/TableGateway/TableManagerMysql.php#L548-L572
33,492
silverorange/swat
Swat/SwatPagination.php
SwatPagination.getResultsMessage
public function getResultsMessage($unit = null, $unit_plural = null) { if ($unit === null) { $unit = Swat::_('record'); } if ($unit_plural === null) { $unit_plural = Swat::_('records'); } $message = ''; if ($this->total_records === 0) { $message = sprintf(Swat::_('No %s.'), $unit_plural); } elseif ($this->total_records === 1) { $message = sprintf(Swat::_('One %s.'), $unit); } else { $locale = SwatI18NLocale::get(); $message = sprintf( Swat::_('%s %s, displaying %s to %s'), $locale->formatNumber($this->total_records), $unit_plural, $locale->formatNumber($this->current_record + 1), $locale->formatNumber( min( $this->current_record + $this->page_size, $this->total_records ) ) ); } return $message; }
php
public function getResultsMessage($unit = null, $unit_plural = null) { if ($unit === null) { $unit = Swat::_('record'); } if ($unit_plural === null) { $unit_plural = Swat::_('records'); } $message = ''; if ($this->total_records === 0) { $message = sprintf(Swat::_('No %s.'), $unit_plural); } elseif ($this->total_records === 1) { $message = sprintf(Swat::_('One %s.'), $unit); } else { $locale = SwatI18NLocale::get(); $message = sprintf( Swat::_('%s %s, displaying %s to %s'), $locale->formatNumber($this->total_records), $unit_plural, $locale->formatNumber($this->current_record + 1), $locale->formatNumber( min( $this->current_record + $this->page_size, $this->total_records ) ) ); } return $message; }
[ "public", "function", "getResultsMessage", "(", "$", "unit", "=", "null", ",", "$", "unit_plural", "=", "null", ")", "{", "if", "(", "$", "unit", "===", "null", ")", "{", "$", "unit", "=", "Swat", "::", "_", "(", "'record'", ")", ";", "}", "if", "(", "$", "unit_plural", "===", "null", ")", "{", "$", "unit_plural", "=", "Swat", "::", "_", "(", "'records'", ")", ";", "}", "$", "message", "=", "''", ";", "if", "(", "$", "this", "->", "total_records", "===", "0", ")", "{", "$", "message", "=", "sprintf", "(", "Swat", "::", "_", "(", "'No %s.'", ")", ",", "$", "unit_plural", ")", ";", "}", "elseif", "(", "$", "this", "->", "total_records", "===", "1", ")", "{", "$", "message", "=", "sprintf", "(", "Swat", "::", "_", "(", "'One %s.'", ")", ",", "$", "unit", ")", ";", "}", "else", "{", "$", "locale", "=", "SwatI18NLocale", "::", "get", "(", ")", ";", "$", "message", "=", "sprintf", "(", "Swat", "::", "_", "(", "'%s %s, displaying %s to %s'", ")", ",", "$", "locale", "->", "formatNumber", "(", "$", "this", "->", "total_records", ")", ",", "$", "unit_plural", ",", "$", "locale", "->", "formatNumber", "(", "$", "this", "->", "current_record", "+", "1", ")", ",", "$", "locale", "->", "formatNumber", "(", "min", "(", "$", "this", "->", "current_record", "+", "$", "this", "->", "page_size", ",", "$", "this", "->", "total_records", ")", ")", ")", ";", "}", "return", "$", "message", ";", "}" ]
Gets a human readable summary of the current state of this pagination widget @param $unit string optional. The type of unit being returned. By default this is 'record'. @param $unit_plural string optional. The plural version of the <i>$unit</i> parameter. By default this is 'records'. @return string a human readable summary of the current state of this pagination widget.
[ "Gets", "a", "human", "readable", "summary", "of", "the", "current", "state", "of", "this", "pagination", "widget" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatPagination.php#L188-L221
33,493
silverorange/swat
Swat/SwatPagination.php
SwatPagination.display
public function display() { if (!$this->visible) { return; } parent::display(); $this->calculatePages(); if ($this->total_pages > 1) { $div_tag = new SwatHtmlTag('div'); $div_tag->id = $this->id; $div_tag->class = $this->getCSSClassString(); $div_tag->open(); if ($this->display_parts & self::POSITION) { $this->displayPosition(); } if ($this->display_parts & self::PREV) { $this->displayPrev(); } if ($this->display_parts & self::PAGES) { $this->displayPages(); } if ($this->display_parts & self::NEXT) { $this->displayNext(); } $div_tag->close(); } }
php
public function display() { if (!$this->visible) { return; } parent::display(); $this->calculatePages(); if ($this->total_pages > 1) { $div_tag = new SwatHtmlTag('div'); $div_tag->id = $this->id; $div_tag->class = $this->getCSSClassString(); $div_tag->open(); if ($this->display_parts & self::POSITION) { $this->displayPosition(); } if ($this->display_parts & self::PREV) { $this->displayPrev(); } if ($this->display_parts & self::PAGES) { $this->displayPages(); } if ($this->display_parts & self::NEXT) { $this->displayNext(); } $div_tag->close(); } }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "parent", "::", "display", "(", ")", ";", "$", "this", "->", "calculatePages", "(", ")", ";", "if", "(", "$", "this", "->", "total_pages", ">", "1", ")", "{", "$", "div_tag", "=", "new", "SwatHtmlTag", "(", "'div'", ")", ";", "$", "div_tag", "->", "id", "=", "$", "this", "->", "id", ";", "$", "div_tag", "->", "class", "=", "$", "this", "->", "getCSSClassString", "(", ")", ";", "$", "div_tag", "->", "open", "(", ")", ";", "if", "(", "$", "this", "->", "display_parts", "&", "self", "::", "POSITION", ")", "{", "$", "this", "->", "displayPosition", "(", ")", ";", "}", "if", "(", "$", "this", "->", "display_parts", "&", "self", "::", "PREV", ")", "{", "$", "this", "->", "displayPrev", "(", ")", ";", "}", "if", "(", "$", "this", "->", "display_parts", "&", "self", "::", "PAGES", ")", "{", "$", "this", "->", "displayPages", "(", ")", ";", "}", "if", "(", "$", "this", "->", "display_parts", "&", "self", "::", "NEXT", ")", "{", "$", "this", "->", "displayNext", "(", ")", ";", "}", "$", "div_tag", "->", "close", "(", ")", ";", "}", "}" ]
Displays this pagination widget
[ "Displays", "this", "pagination", "widget" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatPagination.php#L229-L263
33,494
silverorange/swat
Swat/SwatPagination.php
SwatPagination.setCurrentPage
public function setCurrentPage($page) { $this->current_page = max(1, (int) $page); $this->current_record = ($this->current_page - 1) * $this->page_size; }
php
public function setCurrentPage($page) { $this->current_page = max(1, (int) $page); $this->current_record = ($this->current_page - 1) * $this->page_size; }
[ "public", "function", "setCurrentPage", "(", "$", "page", ")", "{", "$", "this", "->", "current_page", "=", "max", "(", "1", ",", "(", "int", ")", "$", "page", ")", ";", "$", "this", "->", "current_record", "=", "(", "$", "this", "->", "current_page", "-", "1", ")", "*", "$", "this", "->", "page_size", ";", "}" ]
Set the current page that is displayed Calculates the current_record properties. @param integer $page The current page being displayed.
[ "Set", "the", "current", "page", "that", "is", "displayed" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatPagination.php#L275-L280
33,495
silverorange/swat
Swat/SwatPagination.php
SwatPagination.displayPrev
protected function displayPrev() { if ($this->prev_page > 0) { $link = $this->getLink(); $anchor = new SwatHtmlTag('a'); $anchor->href = sprintf($link, (string) $this->prev_page); // this is a non-breaking space $anchor->setContent($this->previous_label); $anchor->class = 'swat-pagination-nextprev'; $anchor->display(); } else { $span = new SwatHtmlTag('span'); $span->class = 'swat-pagination-nextprev'; $span->setContent($this->previous_label); $span->display(); } }
php
protected function displayPrev() { if ($this->prev_page > 0) { $link = $this->getLink(); $anchor = new SwatHtmlTag('a'); $anchor->href = sprintf($link, (string) $this->prev_page); // this is a non-breaking space $anchor->setContent($this->previous_label); $anchor->class = 'swat-pagination-nextprev'; $anchor->display(); } else { $span = new SwatHtmlTag('span'); $span->class = 'swat-pagination-nextprev'; $span->setContent($this->previous_label); $span->display(); } }
[ "protected", "function", "displayPrev", "(", ")", "{", "if", "(", "$", "this", "->", "prev_page", ">", "0", ")", "{", "$", "link", "=", "$", "this", "->", "getLink", "(", ")", ";", "$", "anchor", "=", "new", "SwatHtmlTag", "(", "'a'", ")", ";", "$", "anchor", "->", "href", "=", "sprintf", "(", "$", "link", ",", "(", "string", ")", "$", "this", "->", "prev_page", ")", ";", "// this is a non-breaking space", "$", "anchor", "->", "setContent", "(", "$", "this", "->", "previous_label", ")", ";", "$", "anchor", "->", "class", "=", "'swat-pagination-nextprev'", ";", "$", "anchor", "->", "display", "(", ")", ";", "}", "else", "{", "$", "span", "=", "new", "SwatHtmlTag", "(", "'span'", ")", ";", "$", "span", "->", "class", "=", "'swat-pagination-nextprev'", ";", "$", "span", "->", "setContent", "(", "$", "this", "->", "previous_label", ")", ";", "$", "span", "->", "display", "(", ")", ";", "}", "}" ]
Displays the previous page link
[ "Displays", "the", "previous", "page", "link" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatPagination.php#L301-L318
33,496
silverorange/swat
Swat/SwatPagination.php
SwatPagination.displayPosition
protected function displayPosition() { $div = new SwatHtmlTag('div'); $div->class = 'swat-pagination-position'; $div->setContent( sprintf( Swat::_('Page %d of %d'), $this->current_page, $this->total_pages ) ); $div->display(); }
php
protected function displayPosition() { $div = new SwatHtmlTag('div'); $div->class = 'swat-pagination-position'; $div->setContent( sprintf( Swat::_('Page %d of %d'), $this->current_page, $this->total_pages ) ); $div->display(); }
[ "protected", "function", "displayPosition", "(", ")", "{", "$", "div", "=", "new", "SwatHtmlTag", "(", "'div'", ")", ";", "$", "div", "->", "class", "=", "'swat-pagination-position'", ";", "$", "div", "->", "setContent", "(", "sprintf", "(", "Swat", "::", "_", "(", "'Page %d of %d'", ")", ",", "$", "this", "->", "current_page", ",", "$", "this", "->", "total_pages", ")", ")", ";", "$", "div", "->", "display", "(", ")", ";", "}" ]
Displays the current page position i.e. "1 of 3"
[ "Displays", "the", "current", "page", "position" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatPagination.php#L328-L342
33,497
silverorange/swat
Swat/SwatPagination.php
SwatPagination.displayNext
protected function displayNext() { if ($this->next_page > 0) { $link = $this->getLink(); $anchor = new SwatHtmlTag('a'); $anchor->href = sprintf($link, (string) $this->next_page); // this is a non-breaking space $anchor->setContent($this->next_label); $anchor->class = 'swat-pagination-nextprev'; $anchor->display(); } else { $span = new SwatHtmlTag('span'); $span->class = 'swat-pagination-nextprev'; // this is a non-breaking space $span->setContent($this->next_label); $span->display(); } }
php
protected function displayNext() { if ($this->next_page > 0) { $link = $this->getLink(); $anchor = new SwatHtmlTag('a'); $anchor->href = sprintf($link, (string) $this->next_page); // this is a non-breaking space $anchor->setContent($this->next_label); $anchor->class = 'swat-pagination-nextprev'; $anchor->display(); } else { $span = new SwatHtmlTag('span'); $span->class = 'swat-pagination-nextprev'; // this is a non-breaking space $span->setContent($this->next_label); $span->display(); } }
[ "protected", "function", "displayNext", "(", ")", "{", "if", "(", "$", "this", "->", "next_page", ">", "0", ")", "{", "$", "link", "=", "$", "this", "->", "getLink", "(", ")", ";", "$", "anchor", "=", "new", "SwatHtmlTag", "(", "'a'", ")", ";", "$", "anchor", "->", "href", "=", "sprintf", "(", "$", "link", ",", "(", "string", ")", "$", "this", "->", "next_page", ")", ";", "// this is a non-breaking space", "$", "anchor", "->", "setContent", "(", "$", "this", "->", "next_label", ")", ";", "$", "anchor", "->", "class", "=", "'swat-pagination-nextprev'", ";", "$", "anchor", "->", "display", "(", ")", ";", "}", "else", "{", "$", "span", "=", "new", "SwatHtmlTag", "(", "'span'", ")", ";", "$", "span", "->", "class", "=", "'swat-pagination-nextprev'", ";", "// this is a non-breaking space", "$", "span", "->", "setContent", "(", "$", "this", "->", "next_label", ")", ";", "$", "span", "->", "display", "(", ")", ";", "}", "}" ]
Displays the next page link
[ "Displays", "the", "next", "page", "link" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatPagination.php#L350-L368
33,498
silverorange/swat
Swat/SwatPagination.php
SwatPagination.calculatePages
protected function calculatePages() { $this->total_pages = ceil($this->total_records / $this->page_size); if ( $this->total_pages <= 1 || $this->total_pages == $this->current_page ) { $this->next_page = 0; } else { $this->next_page = $this->current_page + 1; } if ($this->current_page > 0) { $this->prev_page = $this->current_page - 1; } else { $this->prev_page = 0; } }
php
protected function calculatePages() { $this->total_pages = ceil($this->total_records / $this->page_size); if ( $this->total_pages <= 1 || $this->total_pages == $this->current_page ) { $this->next_page = 0; } else { $this->next_page = $this->current_page + 1; } if ($this->current_page > 0) { $this->prev_page = $this->current_page - 1; } else { $this->prev_page = 0; } }
[ "protected", "function", "calculatePages", "(", ")", "{", "$", "this", "->", "total_pages", "=", "ceil", "(", "$", "this", "->", "total_records", "/", "$", "this", "->", "page_size", ")", ";", "if", "(", "$", "this", "->", "total_pages", "<=", "1", "||", "$", "this", "->", "total_pages", "==", "$", "this", "->", "current_page", ")", "{", "$", "this", "->", "next_page", "=", "0", ";", "}", "else", "{", "$", "this", "->", "next_page", "=", "$", "this", "->", "current_page", "+", "1", ";", "}", "if", "(", "$", "this", "->", "current_page", ">", "0", ")", "{", "$", "this", "->", "prev_page", "=", "$", "this", "->", "current_page", "-", "1", ";", "}", "else", "{", "$", "this", "->", "prev_page", "=", "0", ";", "}", "}" ]
Calculates page totals Sets the internal total_pages, next_page and prev_page properties.
[ "Calculates", "page", "totals" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatPagination.php#L469-L487
33,499
TeknooSoftware/states
src/Automated/Assertion/Property/AbstractConstraint.php
AbstractConstraint.isValid
protected function isValid(&$value): ConstraintInterface { if ($this->constraintsSet instanceof ConstraintsSetInterface) { $this->constraintsSet->isValid($value); } return $this; }
php
protected function isValid(&$value): ConstraintInterface { if ($this->constraintsSet instanceof ConstraintsSetInterface) { $this->constraintsSet->isValid($value); } return $this; }
[ "protected", "function", "isValid", "(", "&", "$", "value", ")", ":", "ConstraintInterface", "{", "if", "(", "$", "this", "->", "constraintsSet", "instanceof", "ConstraintsSetInterface", ")", "{", "$", "this", "->", "constraintsSet", "->", "isValid", "(", "$", "value", ")", ";", "}", "return", "$", "this", ";", "}" ]
To return the success of the check to the ConstraintSet and continue the workflow @param mixed $value @return ConstraintInterface
[ "To", "return", "the", "success", "of", "the", "check", "to", "the", "ConstraintSet", "and", "continue", "the", "workflow" ]
0c675b768781ee3a3a15c2663cffec5d50c1d5fd
https://github.com/TeknooSoftware/states/blob/0c675b768781ee3a3a15c2663cffec5d50c1d5fd/src/Automated/Assertion/Property/AbstractConstraint.php#L67-L74