Skip to content

Commit

Permalink
A stab at class property standardization (assuming camelCase).
Browse files Browse the repository at this point in the history
This commit is a proof of concept for changing the "code standard hell" that exists at the moment, and stay BC.
  • Loading branch information
frankmayer committed Dec 29, 2016
1 parent cfc690b commit 64440c5
Show file tree
Hide file tree
Showing 3 changed files with 158 additions and 31 deletions.
83 changes: 82 additions & 1 deletion libraries/cms/installer/manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,19 @@ abstract class JInstallerManifest
*
* @var string
* @since 3.1
*
* @deprecated 4.0
*/
public $manifest_file = '';

/**
* Path to the manifest file
*
* @var string
* @since __DEPLOY_VERSION__
*/
public $manifestFile = '';

/**
* Name of the extension
*
Expand All @@ -50,6 +60,50 @@ abstract class JInstallerManifest
*/
public $description = '';

/**
* Author for the library
*
* @var string
* @since 3.1
*/
public $author = '';

/**
* Author email for the library (alias)
*
* @var string
* @since 3.1
*
* @deprecated 4.0
*/
public $authoremail = '';

/**
* Author email for the library
*
* @var string
* @since __DEPLOY_VERSION__
*/
public $authorEmail = '';

/**
* Author URL for the library
*
* @var string
* @since 3.1
*
* @deprecated 4.0
*/
public $authorurl = '';

/**
* Author URL for the library
*
* @var string
* @since __DEPLOY_VERSION__
*/
public $authorURL = '';

/**
* Packager of the extension
*
Expand All @@ -63,9 +117,19 @@ abstract class JInstallerManifest
*
* @var string
* @since 3.1
*
* @deprecated 4.0
*/
public $packagerurl = '';

/**
* Packager's URL of the extension
*
* @var string
* @since __DEPLOY_VERSION__
*/
public $packagerURL = '';

/**
* Update site for the extension
*
Expand All @@ -79,9 +143,19 @@ abstract class JInstallerManifest
*
* @var array
* @since 3.1
*
* @deprecated 4.0
*/
public $filelist = array();

/**
* List of files in the extension
*
* @var array
* @since __DEPLOY_VERSION__
*/
public $fileList = array();

/**
* Constructor
*
Expand All @@ -91,6 +165,13 @@ abstract class JInstallerManifest
*/
public function __construct($xmlpath = '')
{
// old and new variables are referenced for B/C
$this->authorEmail = &$this->authoremail;
$this->authorURL = &$this->authorurl;
$this->manifestFile = &$this->manifest_file;
$this->packagerURL = &$this->packagerurl;
$this->fileList = &$this->filelist;

if (strlen($xmlpath))
{
$this->loadManifestFromXml($xmlpath);
Expand All @@ -108,7 +189,7 @@ public function __construct($xmlpath = '')
*/
public function loadManifestFromXml($xmlfile)
{
$this->manifest_file = basename($xmlfile, '.xml');
$this->manifestFile = basename($xmlfile, '.xml');

$xml = simplexml_load_file($xmlfile);

Expand Down
57 changes: 34 additions & 23 deletions libraries/cms/installer/manifest/library.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,60 +17,71 @@
class JInstallerManifestLibrary extends JInstallerManifest
{
/**
* File system name of the library
* File system name of the library (alias)
*
* @var string
* @since 3.1
*
* @deprecated 4.0
*/
public $libraryname = '';

/**
* Creation Date of the library
* File system name of the library
*
* @var string
* @since 3.1
* @since __DEPLOY_VERSION__
*/
public $creationDate = '';
public $libraryName = '';

/**
* Copyright notice for the library
* Creation Date of the library
*
* @var string
* @since 3.1
*/
public $copyright = '';
public $creationDate = '';

/**
* License for the library
* Creation Date of the library
*
* @var string
* @since 3.1
* @since __DEPLOY_VERSION__
*
* @deprecated 4.0
*/
public $license = '';
public $creationdate = '';

/**
* Author for the library
* Copyright notice for the library
*
* @var string
* @since 3.1
*/
public $author = '';
public $copyright = '';

/**
* Author email for the library
* License for the library
*
* @var string
* @since 3.1
*/
public $authoremail = '';
public $license = '';

/**
* Author URL for the library
* JInstallerManifestLibrary constructor.
*
* @var string
* @since 3.1
* @param string $xmlpath Path to XML manifest file.
* @since __DEPLOY_VERSION__
*/
public $authorurl = '';
public function __construct($xmlpath = '')
{
// old and new variables are referenced for B/C
$this->creationDate = &$this->creationdate;
$this->libraryName = &$this->libraryname;

parent::__construct($xmlpath);
}

/**
* Apply manifest data from a SimpleXMLElement to the object.
Expand All @@ -84,22 +95,22 @@ class JInstallerManifestLibrary extends JInstallerManifest
protected function loadManifestFromData(SimpleXMLElement $xml)
{
$this->name = (string) $xml->name;
$this->libraryname = (string) $xml->libraryname;
$this->libraryName = (string) $xml->libraryname;
$this->version = (string) $xml->version;
$this->description = (string) $xml->description;
$this->creationdate = (string) $xml->creationDate;
$this->creationDate = (string) $xml->creationDate;
$this->author = (string) $xml->author;
$this->authoremail = (string) $xml->authorEmail;
$this->authorurl = (string) $xml->authorUrl;
$this->authorEmail = (string) $xml->authorEmail;
$this->authorURL = (string) $xml->authorUrl;
$this->packager = (string) $xml->packager;
$this->packagerurl = (string) $xml->packagerurl;
$this->packagerURL = (string) $xml->packagerurl;
$this->update = (string) $xml->update;

if (isset($xml->files) && isset($xml->files->file) && count($xml->files->file))
{
foreach ($xml->files->file as $file)
{
$this->filelist[] = (string) $file;
$this->fileList[] = (string) $file;
}
}
}
Expand Down
49 changes: 42 additions & 7 deletions libraries/cms/installer/manifest/package.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,19 @@ class JInstallerManifestPackage extends JInstallerManifest
*
* @var string
* @since 3.1
*
* @deprecated 4.0
*/
public $packagename = '';

/**
* Unique name of the package
*
* @var string
* @since __DEPLOY_VERSION__
*/
public $packageName = '';

/**
* Website for the package
*
Expand All @@ -37,9 +47,19 @@ class JInstallerManifestPackage extends JInstallerManifest
*
* @var string
* @since 3.1
*
* @deprecated 4.0
*/
public $scriptfile = '';

/**
* Scriptfile for the package
*
* @var string
* @since __DEPLOY_VERSION__
*/
public $scriptFile = '';

/**
* Flag if the package blocks individual child extensions from being uninstalled
*
Expand All @@ -48,6 +68,21 @@ class JInstallerManifestPackage extends JInstallerManifest
*/
public $blockChildUninstall = false;

/**
* JInstallerManifestPackage constructor.
*
* @param string $xmlpath Path to XML manifest file.
* @since __DEPLOY_VERSION__
*/
public function __construct($xmlpath = '')
{
// old and new variables are referenced for B/C
$this->packageName = &$this->packagename;
$this->scriptFile = &$this->scriptfile;

parent::__construct($xmlpath);
}

/**
* Apply manifest data from a SimpleXMLElement to the object.
*
Expand All @@ -60,15 +95,15 @@ class JInstallerManifestPackage extends JInstallerManifest
protected function loadManifestFromData(SimpleXMLElement $xml)
{
$this->name = (string) $xml->name;
$this->packagename = (string) $xml->packagename;
$this->packageName = (string) $xml->packagename;
$this->update = (string) $xml->update;
$this->authorurl = (string) $xml->authorUrl;
$this->authorURL = (string) $xml->authorUrl;
$this->author = (string) $xml->author;
$this->authoremail = (string) $xml->authorEmail;
$this->authorEmail = (string) $xml->authorEmail;
$this->description = (string) $xml->description;
$this->packager = (string) $xml->packager;
$this->packagerurl = (string) $xml->packagerurl;
$this->scriptfile = (string) $xml->scriptfile;
$this->packagerURL = (string) $xml->packagerurl;
$this->scriptFile = (string) $xml->scriptfile;
$this->version = (string) $xml->version;

if (isset($xml->blockChildUninstall))
Expand All @@ -87,7 +122,7 @@ protected function loadManifestFromData(SimpleXMLElement $xml)
{
// NOTE: JInstallerExtension doesn't expect a string.
// DO NOT CAST $file
$this->filelist[] = new JInstallerExtension($file);
$this->fileList[] = new JInstallerExtension($file);
}
}

Expand All @@ -98,7 +133,7 @@ protected function loadManifestFromData(SimpleXMLElement $xml)
{
// NOTE: JInstallerExtension doesn't expect a string.
// DO NOT CAST $folder
$this->filelist[] = new JInstallerExtension($folder);
$this->fileList[] = new JInstallerExtension($folder);
}
}
}
Expand Down

0 comments on commit 64440c5

Please sign in to comment.