Inline variable
JavaScript example
| Before | After |
|---|---|
Parenizor.method('toString', function ()
{
var string = '(' + this.getValue() + ')';
return string;
}
|
Parenizor.method('toString', function ()
{
return '(' + this.getValue() + ')';
}
|
PHP example
| Before | After |
|---|---|
public function getFeedObject($title, $description)
{
global $wgSitename, $wgContLanguageCode, $wgFeedClasses, $wgTitle;
$feedTitle = "$wgSitename - {$title} [$wgContLanguageCode]";
if (!isset($wgFeedClasses[$this->format]))
return false;
return new $wgFeedClasses[$this->format]
($feedTitle, htmlspecialchars());
}
|
public function getFeedObject($title, $description)
{
global $wgSitename, $wgContLanguageCode, $wgFeedClasses, $wgTitle;
if (!isset($wgFeedClasses[$this->format]))
return false;
return new $wgFeedClasses[$this->format]
("$wgSitename - {$title} [$wgContLanguageCode]", htmlspecialchars());
}
|
Inline method or function
| Before | After |
|---|---|
function
sum(a, b){
returna + b;
}
functionmultiplication(a, b){
c = sum(a, b);
d = c * c;
returnd;
}
functiondivision(a, b){
result = sum(a, b) / multiplication(a, b);
returnresult;
}
|
function
multiplication(a, b){
c = a + b;
d = c * c;
returnd;
}
functiondivision(a, b){
result = a + b / multiplication(a, b);
returnresult;
}
|
- Place the caret in the editor at the desired symbol to be inlined.
- Do one of the following:
- On the main menu or on the context menu of the selection, choose .
- Press Ctrl+Alt+NCtrl+Alt+NCtrl+Alt+NCtrl+Alt+NCtrl+Alt+NCtrl+Alt+NCtrl+Alt+NAlt+Shift+IMeta Alt NMeta Alt NMeta Alt I.
- In the Inline dialog box that corresponds to the selected symbol, confirm the inline refactoring.

