From 93312cae42824274722fe7a285d5ce8e40f177a1 Mon Sep 17 00:00:00 2001 From: Olexii Korshenko <okorshenko@ebay.com> Date: Wed, 29 Jul 2015 17:55:38 +0300 Subject: [PATCH] MAGETWO-37817: Adaptation of code to PHP7 - Renamed classes and namespaces with reserved words (Object, String, Null, Boolean, etc.) - Updated dependencies --- .php_cs | 1 - .../Block/Grid/Renderer/Actions.php | 4 +- .../Block/Grid/Renderer/Notice.php | 4 +- .../Block/Grid/Renderer/Severity.php | 4 +- .../Authorization/Model/Resource/Rules.php | 4 +- .../Controller/Directpost/Payment/Place.php | 4 +- app/code/Magento/Authorizenet/Helper/Data.php | 2 +- .../Authorizenet/Model/Authorizenet.php | 12 +- .../Magento/Authorizenet/Model/Directpost.php | 22 +- .../Magento/Authorizenet/Model/Request.php | 4 +- .../Magento/Authorizenet/Model/Response.php | 4 +- .../Directpost/Payment/PlaceTest.php | 4 +- .../Test/Unit/Helper/DataTest.php | 2 +- .../Unit/Model/Directpost/ObserverTest.php | 4 +- .../Searches/Renderer/Searchquery.php | 10 +- .../Magento/Backend/Block/Media/Uploader.php | 6 +- .../Block/System/Store/Grid/Render/Group.php | 2 +- .../Block/System/Store/Grid/Render/Store.php | 2 +- .../System/Store/Grid/Render/Website.php | 2 +- .../Backend/Block/Widget/Button/Item.php | 2 +- .../Backend/Block/Widget/Form/Container.php | 2 +- .../Backend/Block/Widget/Form/Element.php | 4 +- .../Magento/Backend/Block/Widget/Grid.php | 8 +- .../Backend/Block/Widget/Grid/Column.php | 8 +- .../Grid/Column/Renderer/AbstractRenderer.php | 12 +- .../Widget/Grid/Column/Renderer/Action.php | 20 +- .../Widget/Grid/Column/Renderer/Button.php | 4 +- .../Widget/Grid/Column/Renderer/Checkbox.php | 4 +- .../Widget/Grid/Column/Renderer/Concat.php | 4 +- .../Widget/Grid/Column/Renderer/Country.php | 4 +- .../Widget/Grid/Column/Renderer/Currency.php | 10 +- .../Widget/Grid/Column/Renderer/Date.php | 4 +- .../Widget/Grid/Column/Renderer/Datetime.php | 4 +- .../Grid/Column/Renderer/DraggableHandle.php | 4 +- .../Widget/Grid/Column/Renderer/Input.php | 4 +- .../Block/Widget/Grid/Column/Renderer/Ip.php | 4 +- .../Widget/Grid/Column/Renderer/Longtext.php | 4 +- .../Grid/Column/Renderer/Massaction.php | 4 +- .../Widget/Grid/Column/Renderer/Number.php | 4 +- .../Widget/Grid/Column/Renderer/Options.php | 4 +- .../Widget/Grid/Column/Renderer/Price.php | 10 +- .../Widget/Grid/Column/Renderer/Radio.php | 4 +- .../Column/Renderer/RendererInterface.php | 4 +- .../Widget/Grid/Column/Renderer/Select.php | 4 +- .../Widget/Grid/Column/Renderer/Store.php | 8 +- .../Widget/Grid/Column/Renderer/Text.php | 4 +- .../Widget/Grid/Column/Renderer/Wrapline.php | 10 +- .../Backend/Block/Widget/Grid/ColumnSet.php | 24 +- .../Backend/Block/Widget/Grid/Export.php | 20 +- .../Backend/Block/Widget/Grid/Extended.php | 40 +- .../Grid/Massaction/AbstractMassaction.php | 6 +- .../Magento/Backend/Block/Widget/Tabs.php | 26 +- .../Controller/Adminhtml/Dashboard/Tunnel.php | 6 +- .../Helper/Dashboard/AbstractDashboard.php | 2 +- .../Model/Resource/Translate/String.php | 23 - .../Magento/Backend/Model/Search/Customer.php | 2 +- .../Magento/Backend/Model/Search/Order.php | 2 +- .../Backend/Model/Session/AdminConfig.php | 4 +- .../Model/Widget/Grid/AbstractTotals.php | 10 +- .../Widget/Grid/Row/GeneratorInterface.php | 2 +- .../Model/Widget/Grid/Row/UrlGenerator.php | 4 +- .../Model/Widget/Grid/Row/UrlGeneratorId.php | 2 +- .../Model/Widget/Grid/TotalsInterface.php | 2 +- .../Unit/Block/Widget/Form/ContainerTest.php | 4 +- .../Grid/Column/Renderer/ConcatTest.php | 4 +- .../Grid/Column/Renderer/CurrencyTest.php | 4 +- .../Column/Renderer/Radio/ExtendedTest.php | 4 +- .../Widget/Grid/Column/Renderer/RadioTest.php | 2 +- .../Unit/Block/Widget/Grid/ColumnSetTest.php | 46 +- .../Unit/Block/Widget/Grid/MassactionTest.php | 10 +- .../Test/Unit/Model/Locale/ManagerTest.php | 2 +- .../Model/Widget/Grid/AbstractTotalsTest.php | 14 +- .../Widget/Grid/Row/UrlGeneratorTest.php | 2 +- .../Unit/Model/Widget/Grid/SubTotalsTest.php | 12 +- .../Unit/Model/Widget/Grid/TotalsTest.php | 32 +- .../Grid/Column/Renderer/Download.php | 4 +- .../Controller/Adminhtml/Index/Create.php | 2 +- .../Controller/Adminhtml/Index/MassDelete.php | 2 +- .../Controller/Adminhtml/Index/Rollback.php | 2 +- app/code/Magento/Backup/Helper/Data.php | 4 +- app/code/Magento/Backup/Model/Backup.php | 2 +- app/code/Magento/Backup/Model/Resource/Db.php | 4 +- .../Test/Unit/Model/BackupFactoryTest.php | 2 +- .../Form/Field/Countrycreditcard.php | 4 +- app/code/Magento/Braintree/Block/Info.php | 2 +- .../Magento/Braintree/Block/Info/PayPal.php | 2 +- .../Braintree/Controller/PayPal/Review.php | 4 +- app/code/Magento/Braintree/Model/Observer.php | 8 +- .../Magento/Braintree/Model/PaymentMethod.php | 8 +- .../Braintree/Model/PaymentMethod/PayPal.php | 8 +- .../Unit/Block/Creditcard/ManagementTest.php | 4 +- .../Test/Unit/Block/PayPal/ShortcutTest.php | 14 +- .../Test/Unit/Controller/PayPalTest.php | 4 +- .../Test/Unit/Model/ConfigProviderTest.php | 2 +- .../Test/Unit/Model/ObserverTest.php | 36 +- .../Unit/Model/PaymentMethod/PayPalTest.php | 14 +- .../Test/Unit/Model/PaymentMethodTest.php | 14 +- .../Adminhtml/Sales/Order/Items/Renderer.php | 2 +- .../Bundle/Block/Catalog/Product/Price.php | 4 +- .../Catalog/Product/View/Type/Bundle.php | 4 +- .../Product/View/Type/Bundle/Option.php | 4 +- .../Block/Sales/Order/Items/Renderer.php | 2 +- .../Magento/Bundle/Model/LinkManagement.php | 2 +- app/code/Magento/Bundle/Model/Observer.php | 6 +- .../Magento/Bundle/Model/OptionRepository.php | 35 +- .../Bundle/Model/Plugin/PriceBackend.php | 2 +- .../Bundle/Model/Product/CatalogPrice.php | 2 +- .../Magento/Bundle/Model/Product/Type.php | 26 +- .../Magento/Bundle/Model/Resource/Option.php | 2 +- .../Model/Resource/Option/Collection.php | 2 +- .../Sales/Order/Pdf/Items/AbstractItems.php | 12 +- .../Sales/Order/Pdf/Items/Creditmemo.php | 6 +- .../Model/Sales/Order/Pdf/Items/Invoice.php | 6 +- .../Model/Sales/Order/Pdf/Items/Shipment.php | 6 +- .../Product/Edit/Tab/Bundle/OptionTest.php | 6 +- .../Product/View/Type/Bundle/OptionTest.php | 2 +- .../Catalog/Product/View/Type/BundleTest.php | 4 +- .../Test/Unit/Model/LinkManagementTest.php | 2 +- .../Test/Unit/Model/Product/TypeTest.php | 88 +- .../CacheInvalidate/Model/Observer.php | 2 +- .../Test/Unit/Model/ObserverTest.php | 2 +- .../Captcha/Controller/Refresh/Index.php | 6 +- .../Model/Customer/Plugin/AjaxLogin.php | 10 +- .../Catalog/Block/Adminhtml/Category/Tree.php | 8 +- .../Product/Attribute/Edit/Tab/Main.php | 2 +- .../NewAttribute/Product/Attributes.php | 2 +- .../Edit/Action/Attribute/Tab/Attributes.php | 2 +- .../Adminhtml/Product/Edit/Tab/Attributes.php | 2 +- .../Product/Edit/Tab/Attributes/Create.php | 6 +- .../Product/Edit/Tab/Options/Option.php | 6 +- .../Product/Edit/Tab/Options/Popup/Grid.php | 2 +- .../Catalog/Block/Adminhtml/Product/Grid.php | 2 +- .../Magento/Catalog/Block/Category/View.php | 2 +- app/code/Magento/Catalog/Block/Navigation.php | 4 +- .../Catalog/Block/Product/AbstractProduct.php | 2 +- .../Catalog/Block/Product/ListProduct.php | 2 +- .../Catalog/Block/Product/NewProduct.php | 2 +- .../Magento/Catalog/Block/Product/Price.php | 8 +- .../Block/Product/ProductList/Related.php | 2 +- .../Block/Product/ProductList/Toolbar.php | 8 +- .../Block/Product/ProductList/Upsell.php | 6 +- .../Magento/Catalog/Block/Product/View.php | 10 +- .../Catalog/Block/Product/View/Gallery.php | 6 +- .../Catalog/Block/Product/View/Options.php | 2 +- .../Block/Product/View/Options/Type/File.php | 4 +- .../Controller/Adminhtml/Category/Edit.php | 2 +- .../Controller/Adminhtml/Category/Save.php | 5 +- .../Product/Action/Attribute/Validate.php | 2 +- .../Product/AddAttributeToTemplate.php | 2 +- .../Adminhtml/Product/Attribute/Validate.php | 2 +- .../Adminhtml/Product/ShowUpdateResult.php | 2 +- .../Controller/Adminhtml/Product/Validate.php | 2 +- .../Magento/Catalog/Controller/Product.php | 2 +- .../Catalog/Controller/Product/View.php | 2 +- app/code/Magento/Catalog/Helper/Data.php | 6 +- app/code/Magento/Catalog/Helper/Product.php | 36 +- .../Catalog/Helper/Product/Composite.php | 8 +- .../Catalog/Helper/Product/Configuration.php | 6 +- .../Magento/Catalog/Helper/Product/View.php | 8 +- .../Magento/Catalog/Model/AbstractModel.php | 2 +- .../Attribute/Backend/Customlayoutupdate.php | 2 +- .../Model/Attribute/Backend/Startdate.php | 6 +- app/code/Magento/Catalog/Model/Category.php | 4 +- .../Category/Attribute/Backend/Image.php | 2 +- .../Category/Attribute/Backend/Sortby.php | 6 +- app/code/Magento/Catalog/Model/Config.php | 2 +- app/code/Magento/Catalog/Model/Design.php | 12 +- .../Indexer/Product/Flat/AbstractAction.php | 2 +- app/code/Magento/Catalog/Model/Layer.php | 2 +- .../Model/Layer/Filter/AbstractFilter.php | 2 +- .../Catalog/Model/Layer/Filter/Attribute.php | 6 +- .../Catalog/Model/Layer/Filter/Item.php | 2 +- .../Magento/Catalog/Model/Layer/State.php | 4 +- app/code/Magento/Catalog/Model/Product.php | 18 +- .../Product/Attribute/Backend/Boolean.php | 2 +- .../Backend/GroupPrice/AbstractGroupPrice.php | 4 +- .../Model/Product/Attribute/Backend/Media.php | 6 +- .../Model/Product/Attribute/Backend/Sku.php | 6 +- .../Product/Attribute/Source/Inputtype.php | 2 +- .../Catalog/Model/Product/Compare/Item.php | 2 +- .../Model/Product/Compare/ListCompare.php | 2 +- .../Catalog/Model/Product/Condition.php | 2 +- .../Configuration/Item/ItemInterface.php | 4 +- .../Product/Configuration/Item/Option.php | 2 +- .../Catalog/Model/Product/Image/View.php | 2 +- .../Magento/Catalog/Model/Product/Option.php | 6 +- .../Model/Product/Option/Type/DefaultType.php | 6 +- .../Model/Product/Option/Type/File.php | 8 +- .../Option/Type/File/ValidatorFile.php | 2 +- .../Model/Product/Option/Type/Select.php | 6 +- .../Model/Product/Option/Type/Text.php | 6 +- .../Model/Product/Type/AbstractType.php | 34 +- .../Magento/Catalog/Model/Product/Url.php | 2 +- .../Catalog/Model/Product/Validator.php | 4 +- .../Catalog/Model/Product/Visibility.php | 2 +- .../Model/Resource/AbstractResource.php | 22 +- .../Catalog/Model/Resource/Category.php | 18 +- .../Category/Attribute/Frontend/Image.php | 2 +- .../Catalog/Model/Resource/Category/Flat.php | 4 +- .../Catalog/Model/Resource/Product.php | 12 +- .../Catalog/Model/Resource/Product/Action.php | 2 +- .../Backend/GroupPrice/AbstractGroupPrice.php | 4 +- .../Product/Attribute/Backend/Image.php | 2 +- .../Product/Attribute/Backend/Media.php | 4 +- .../Model/Resource/Product/Collection.php | 6 +- .../Catalog/Model/Resource/Product/Option.php | 12 +- .../Magento/Catalog/Model/Resource/Url.php | 12 +- .../Magento/Catalog/Model/Template/Filter.php | 4 +- .../Test/Unit/Block/Product/ListTest.php | 2 +- .../Test/Unit/Block/Rss/CategoryTest.php | 2 +- .../Helper/HandlerFactoryTest.php | 4 +- .../Product/ShowUpdateResultTest.php | 2 +- .../Unit/Controller/Category/ViewTest.php | 2 +- .../Backend/CustomlayoutupdateTest.php | 6 +- .../Category/Attribute/Backend/SortbyTest.php | 14 +- .../Category/AttributeRepositoryTest.php | 4 +- .../Unit/Model/CategoryRepositoryTest.php | 10 +- .../Catalog/Test/Unit/Model/ConfigTest.php | 2 +- .../Unit/Model/Layer/Filter/AttributeTest.php | 2 +- .../Attribute/Backend/CategoryTest.php | 4 +- .../Backend/GroupPrice/AbstractTest.php | 2 +- .../Product/Attribute/Backend/MediaTest.php | 6 +- .../Product/Attribute/Backend/StockTest.php | 10 +- .../Model/Product/Attribute/GroupTest.php | 4 +- .../Product/Attribute/RepositoryTest.php | 2 +- .../Product/CopyConstructorFactoryTest.php | 4 +- .../Unit/Model/Product/Image/CacheTest.php | 2 +- .../Option/Validator/DefaultValidatorTest.php | 16 +- .../Test/Unit/Model/Product/ValidatorTest.php | 2 +- .../Test/Unit/Model/ProductRepositoryTest.php | 2 +- .../Test/Unit/Model/Resource/AbstractTest.php | 2 +- .../Product/Link/Product/CollectionTest.php | 4 +- .../Test/Unit/Model/Resource/ProductTest.php | 8 +- .../Pricing/Price/CustomOptionPriceTest.php | 2 +- .../Component/Listing/Columns/Thumbnail.php | 2 +- .../catalog/product/edit/options/option.phtml | 2 +- .../Model/Import/Product.php | 4 +- .../Test/Unit/Model/Import/ProductTest.php | 8 +- .../Block/Adminhtml/Form/Field/Minsaleqty.php | 4 +- .../CatalogInventory/Block/Qtyincrements.php | 2 +- .../Block/Stockqty/DefaultStockqty.php | 2 +- .../Model/Adminhtml/Stock/Item.php | 2 +- .../QuantityValidator/Initializer/Option.php | 2 +- .../Initializer/StockItem.php | 2 +- .../Model/Resource/Stock/Item.php | 4 +- .../Model/Spi/StockStateProviderInterface.php | 2 +- .../CatalogInventory/Model/StockIndex.php | 3 +- .../CatalogInventory/Model/StockState.php | 4 +- .../Model/StockStateProvider.php | 8 +- .../Test/Unit/Api/StockStateTest.php | 4 +- .../Initializer/OptionTest.php | 2 +- .../Initializer/StockItemTest.php | 4 +- .../Unit/Model/Spi/StockStateProviderTest.php | 8 +- .../Adminhtml/Promo/Catalog/Edit/Tab/Main.php | 6 +- .../Adminhtml/Promo/Catalog/Save.php | 2 +- .../Model/Indexer/AbstractIndexer.php | 2 +- .../Magento/CatalogRule/Model/Rule/Job.php | 2 +- .../Model/Indexer/Fulltext/Action/Full.php | 4 +- .../CatalogSearch/Model/Search/Catalog.php | 8 +- .../Model/Search/IndexBuilder.php | 2 +- .../Model/Autocomplete/DataProviderTest.php | 2 +- .../Model/ObjectRegistry.php | 8 +- .../Test/Unit/Model/ObjectRegistryTest.php | 6 +- app/code/Magento/Checkout/Block/Cart.php | 2 +- .../Checkout/Block/Cart/Item/Renderer.php | 2 +- .../Checkout/Controller/Cart/Configure.php | 2 +- .../Controller/Cart/UpdateItemOptions.php | 2 +- .../Checkout/Controller/Onepage/SaveOrder.php | 4 +- .../Magento/Checkout/CustomerData/Cart.php | 4 +- app/code/Magento/Checkout/Helper/Data.php | 6 +- app/code/Magento/Checkout/Model/Cart.php | 26 +- .../Checkout/Model/Cart/CartInterface.php | 2 +- .../Magento/Checkout/Model/Type/Onepage.php | 6 +- .../Unit/Controller/Cart/ConfigureTest.php | 2 +- .../Test/Unit/CustomerData/CartTest.php | 4 +- .../Checkout/Test/Unit/Helper/CartTest.php | 4 +- .../Checkout/Test/Unit/Helper/DataTest.php | 26 +- .../Checkout/Test/Unit/Model/CartTest.php | 2 +- .../Checkout/Test/Unit/Model/ObserverTest.php | 4 +- .../Test/Unit/Model/Type/OnepageTest.php | 4 +- app/code/Magento/Checkout/etc/fieldset.xml | 2 +- .../Block/Adminhtml/Agreement/Grid.php | 2 +- .../Controller/Adminhtml/Agreement/Save.php | 2 +- .../CheckoutAgreements/Model/Agreement.php | 2 +- .../Test/Unit/Model/AgreementTest.php | 16 +- .../Magento/Cms/Block/Adminhtml/Page/Grid.php | 6 +- .../Adminhtml/Page/Grid/Renderer/Action.php | 4 +- .../Adminhtml/Wysiwyg/Images/Content.php | 2 +- .../Wysiwyg/Images/Content/Files.php | 24 +- app/code/Magento/Cms/Block/Block.php | 2 +- app/code/Magento/Cms/Block/Page.php | 2 +- app/code/Magento/Cms/Controller/Router.php | 2 +- app/code/Magento/Cms/Model/Block.php | 2 +- app/code/Magento/Cms/Model/Page.php | 2 +- app/code/Magento/Cms/Model/Wysiwyg/Config.php | 10 +- .../Cms/Model/Wysiwyg/Images/Storage.php | 2 +- .../Block/Adminhtml/Block/Edit/FormTest.php | 2 +- .../Cms/Test/Unit/Model/ObserverTest.php | 4 +- .../Test/Unit/Model/Wysiwyg/ConfigTest.php | 2 +- .../Unit/Model/Wysiwyg/Images/StorageTest.php | 4 +- .../Field/FieldArray/AbstractFieldArray.php | 8 +- .../Form/Fieldset/Modules/DisableOutput.php | 8 +- .../Adminhtml/System/Config/Save.php | 6 +- app/code/Magento/Config/Model/Config.php | 2 +- .../Model/Config/Compiler/IncludeElement.php | 14 +- .../Model/Config/Source/Email/Template.php | 2 +- .../Model/Config/Structure/Element/Field.php | 2 +- .../Config/Model/Config/Structure/Reader.php | 4 +- .../Form/Field/FieldArray/AbstractTest.php | 2 +- .../System/Config/Form/Field/FileTest.php | 2 +- .../System/Config/Form/Field/ImageTest.php | 2 +- .../Adminhtml/System/Config/SaveTest.php | 2 +- .../Model/Compiler/IncludeElementTest.php | 4 +- .../Test/Unit/Model/Config/LoaderTest.php | 2 +- .../Config/Structure/Element/FieldTest.php | 4 +- .../Model/Config/Structure/ReaderTest.php | 4 +- .../Import/Product/Type/ConfigurableTest.php | 4 +- .../Super/Config/Grid/Renderer/Checkbox.php | 8 +- .../Super/Config/Grid/Renderer/Inventory.php | 4 +- .../Block/Cart/Item/Renderer/Configurable.php | 2 +- .../AssociatedSelector/Renderer/Id.php | 4 +- .../Model/ConfigurableProductManagement.php | 4 +- .../Model/Product/Type/Configurable.php | 20 +- .../Model/Product/Validator/Plugin.php | 10 +- .../Plugin/Model/Resource/Product.php | 4 +- .../Test/Unit/Helper/DataTest.php | 4 +- .../Model/ConfigurableAttributeDataTest.php | 2 +- .../Group/AttributeMapper/PluginTest.php | 4 +- .../Model/Product/Type/ConfigurableTest.php | 2 +- .../Model/Product/Validator/PluginTest.php | 2 +- .../Magento/Contact/Controller/Index/Post.php | 2 +- .../Model/System/Config/Backend/Links.php | 4 +- .../Cookie/Controller/Index/NoCookies.php | 2 +- app/code/Magento/Cookie/Helper/Cookie.php | 5 +- .../Unit/Controller/Index/NoCookiesTest.php | 4 +- .../Cron/Test/Unit/Model/ObserverTest.php | 4 +- .../Test/Unit/Model/ObserverTest.php | 4 +- .../Address/Renderer/DefaultRenderer.php | 8 +- .../Address/Renderer/RendererInterface.php | 6 +- .../Tab/Newsletter/Grid/Renderer/Action.php | 6 +- .../Tab/Newsletter/Grid/Renderer/Status.php | 4 +- .../Block/Adminhtml/Edit/Tab/Orders.php | 2 +- .../Edit/Tab/View/Grid/Renderer/Item.php | 4 +- .../Block/Adminhtml/Edit/Tab/View/Sales.php | 2 +- .../Wishlist/Grid/Renderer/Description.php | 4 +- .../Adminhtml/Grid/Renderer/Multiaction.php | 8 +- .../Magento/Customer/Block/Form/Register.php | 2 +- .../Cart/Product/Composite/Cart/Configure.php | 2 +- .../Cart/Product/Composite/Cart/Update.php | 4 +- .../Adminhtml/Customer/InvalidateToken.php | 6 +- .../Customer/Controller/Adminhtml/Index.php | 4 +- .../Controller/Adminhtml/Index/Validate.php | 6 +- .../Controller/Adminhtml/Index/Viewfile.php | 6 +- .../Adminhtml/System/Config/Validatevat.php | 2 +- .../Product/Composite/Wishlist/Configure.php | 2 +- .../Product/Composite/Wishlist/Update.php | 4 +- .../Customer/Model/AccountManagement.php | 6 +- .../Model/Address/AbstractAddress.php | 2 +- .../Magento/Customer/Model/Address/Config.php | 8 +- .../Model/AttributeMetadataDataProvider.php | 2 +- .../Customer/Model/Config/Source/Group.php | 6 +- .../Model/Config/Source/Group/Multiselect.php | 6 +- app/code/Magento/Customer/Model/Customer.php | 4 +- .../Customer/Attribute/Backend/Billing.php | 4 +- .../Customer/Attribute/Backend/Password.php | 10 +- .../Customer/Attribute/Backend/Shipping.php | 4 +- .../Customer/Attribute/Backend/Store.php | 2 +- .../Customer/Attribute/Backend/Website.php | 2 +- .../Model/Customer/Attribute/Source/Group.php | 6 +- .../Customer/Model/Data/CustomerSecure.php | 2 +- .../Model/Metadata/ElementFactory.php | 6 +- .../Customer/Model/Metadata/Form/Text.php | 6 +- .../Customer/Model/Metadata/Validator.php | 4 +- .../Customer/Model/Resource/Address.php | 8 +- .../Address/Attribute/Backend/Region.php | 2 +- .../Customer/Model/Resource/Customer.php | 14 +- .../Model/Resource/Customer/Collection.php | 6 +- .../Customer/Grid/ServiceCollection.php | 4 +- .../Resource/Group/Grid/ServiceCollection.php | 2 +- app/code/Magento/Customer/Model/Vat.php | 8 +- .../Test/Unit/Block/Form/RegisterTest.php | 20 +- .../Controller/Adminhtml/Index/SaveTest.php | 24 +- .../Adminhtml/Index/ViewfileTest.php | 23 +- .../Customer/Test/Unit/Helper/AddressTest.php | 4 +- .../Test/Unit/Model/AccountManagementTest.php | 8 +- .../Model/Address/AbstractAddressTest.php | 4 +- .../Test/Unit/Model/Address/ConfigTest.php | 6 +- .../Test/Unit/Model/Backend/CustomerTest.php | 2 +- .../Config/Source/Group/MultiselectTest.php | 2 +- .../Unit/Model/Config/Source/GroupTest.php | 2 +- .../Attribute/Backend/BillingTest.php | 10 +- .../Attribute/Backend/PasswordTest.php | 16 +- .../Attribute/Backend/ShippingTest.php | 10 +- .../Customer/Attribute/Backend/StoreTest.php | 10 +- .../Attribute/Backend/WebsiteTest.php | 10 +- .../Customer/Test/Unit/Model/CustomerTest.php | 2 +- .../Model/Metadata/ElementFactoryTest.php | 4 +- .../Unit/Model/Metadata/Form/TextTest.php | 4 +- .../Unit/Model/Metadata/ValidatorTest.php | 4 +- .../Customer/Test/Unit/Model/ObserverTest.php | 2 +- .../Test/Unit/Model/Renderer/RegionTest.php | 4 +- .../Address/Attribute/Backend/RegionTest.php | 4 +- .../Customer/Test/Unit/Model/VisitorTest.php | 28 +- app/code/Magento/Customer/etc/fieldset.xml | 2 +- .../Model/Import/AbstractCustomer.php | 4 +- .../Model/Import/Address.php | 4 +- .../Model/Import/Customer.php | 4 +- .../Model/Import/CustomerComposite.php | 6 +- .../Resource/Import/Customer/Storage.php | 4 +- .../Test/Unit/Model/Export/AddressTest.php | 2 +- .../Test/Unit/Model/Export/CustomerTest.php | 4 +- .../Model/Import/AbstractCustomerTest.php | 2 +- .../Test/Unit/Model/Import/AddressTest.php | 10 +- .../Model/Import/CustomerCompositeTest.php | 8 +- .../Resource/Import/Customer/StorageTest.php | 6 +- .../Adminhtml/Editor/Tools/Files/Content.php | 2 +- .../Tools/QuickStyles/ImageUploader.php | 2 +- .../Model/Editor/QuickStyles/RendererTest.php | 2 +- .../ClientSideLessCompilation/Renderer.php | 4 +- app/code/Magento/Dhl/Model/Carrier.php | 60 +- .../Rma/Edit/Tab/General/Shippingmethod.php | 4 +- .../Dhl/Test/Unit/Model/CarrierTest.php | 2 +- app/code/Magento/Directory/Model/Country.php | 4 +- .../Directory/Test/Unit/Helper/DataTest.php | 10 +- .../Model/Resource/Country/CollectionTest.php | 2 +- .../Catalog/Product/Edit/Tab/Downloadable.php | 2 +- .../Product/Edit/Tab/Downloadable/Links.php | 8 +- .../Product/Edit/Tab/Downloadable/Samples.php | 8 +- .../Order/Item/Renderer/Downloadable.php | 4 +- .../Magento/Downloadable/Model/Observer.php | 14 +- .../Downloadable/Model/Product/Type.php | 8 +- .../TypeHandler/AbstractTypeHandler.php | 7 +- .../Model/Product/TypeHandler/Link.php | 2 +- .../Plugin/Downloadable.php | 2 +- .../Sales/Order/Pdf/Items/Creditmemo.php | 6 +- .../Model/Sales/Order/Pdf/Items/Invoice.php | 6 +- .../Edit/Tab/Downloadable/LinksTest.php | 4 +- .../Edit/Tab/Downloadable/SamplesTest.php | 4 +- .../Test/Unit/Model/ObserverTest.php | 28 +- .../Sales/Order/Pdf/Items/CreditmemoTest.php | 10 +- .../Magento/Downloadable/etc/fieldset.xml | 2 +- .../Data/AttributeValidationRuleInterface.php | 2 +- .../Attribute/Edit/Options/Options.php | 2 +- .../Adminhtml/Attribute/Grid/AbstractGrid.php | 2 +- .../Magento/Eav/Model/Attribute/Data/Text.php | 7 +- .../Eav/Model/AttributeDataFactory.php | 6 +- app/code/Magento/Eav/Model/Config.php | 4 +- .../Model/EavCustomAttributeTypeLocator.php | 6 +- .../Eav/Model/Entity/AbstractEntity.php | 62 +- .../Magento/Eav/Model/Entity/Attribute.php | 2 +- .../Attribute/Backend/AbstractBackend.php | 18 +- .../Entity/Attribute/Backend/ArrayBackend.php | 2 +- .../Attribute/Backend/BackendInterface.php | 14 +- .../Entity/Attribute/Backend/Datetime.php | 2 +- .../Entity/Attribute/Backend/Increment.php | 2 +- .../Entity/Attribute/Backend/Serialized.php | 10 +- .../Model/Entity/Attribute/Backend/Store.php | 2 +- .../Entity/Attribute/Backend/Time/Updated.php | 2 +- .../Attribute/Frontend/AbstractFrontend.php | 4 +- .../Entity/Attribute/Frontend/Datetime.php | 4 +- .../Entity/Collection/AbstractCollection.php | 6 +- .../VersionControl/AbstractCollection.php | 2 +- .../Entity/Increment/AbstractIncrement.php | 2 +- .../Entity/VersionControl/AbstractEntity.php | 2 +- .../Model/Entity/VersionControl/Metadata.php | 4 +- .../Eav/Model/Resource/Entity/Store.php | 2 +- .../Eav/Model/Validator/Attribute/Data.php | 2 +- .../Magento/Eav/Test/Unit/Helper/DataTest.php | 4 +- .../Model/Attribute/Data/AbstractDataTest.php | 2 +- .../Model/Attribute/Data/MultilineTest.php | 2 +- .../Unit/Model/Attribute/Data/TextTest.php | 2 +- .../Eav/Test/Unit/Model/ConfigTest.php | 6 +- .../EavCustomAttributeTypeLocatorTest.php | 10 +- .../Unit/Model/Entity/AbstractEntityTest.php | 2 +- .../Entity/Attribute/Backend/AbstractTest.php | 2 +- .../Entity/Attribute/Backend/ArrayTest.php | 2 +- .../Attribute/Frontend/DatetimeTest.php | 4 +- .../Collection/AbstractCollectionStub.php | 4 +- .../Collection/AbstractCollectionTest.php | 2 +- .../VersionControl/AbstractCollectionStub.php | 4 +- .../VersionControl/AbstractEntityTest.php | 2 +- .../Magento/Eav/Test/Unit/Model/FormTest.php | 8 +- .../Model/Resource/Entity/AttributeTest.php | 4 +- .../Model/Validator/Attribute/BackendTest.php | 4 +- .../Model/Validator/Attribute/DataTest.php | 16 +- .../Template/Grid/Renderer/Action.php | 6 +- .../Template/Grid/Renderer/Sender.php | 4 +- .../Adminhtml/Template/Grid/Renderer/Type.php | 4 +- .../Magento/Email/Model/AbstractTemplate.php | 8 +- .../Magento/Email/Model/Template/Filter.php | 4 +- .../Template/Grid/Renderer/ActionTest.php | 4 +- .../Template/Grid/Renderer/SenderTest.php | 8 +- .../Template/Grid/Renderer/TypeTest.php | 6 +- .../Block/Adminhtml/Template/PreviewTest.php | 2 +- .../Test/Unit/Model/Template/FilterTest.php | 4 +- .../Email/Test/Unit/Model/TemplateTest.php | 6 +- app/code/Magento/Fedex/Model/Carrier.php | 30 +- .../Rma/Edit/Tab/General/Shippingmethod.php | 4 +- .../Fedex/Test/Unit/Model/CarrierTest.php | 12 +- .../GiftMessage/Block/Message/Inline.php | 2 +- .../Message/Multishipping/Plugin/ItemsBox.php | 4 +- .../Magento/GiftMessage/Helper/Message.php | 16 +- .../Magento/GiftMessage/Model/Observer.php | 2 +- app/code/Magento/GiftMessage/Model/Save.php | 8 +- .../Test/Unit/Helper/MessageTest.php | 2 +- app/code/Magento/GiftMessage/etc/fieldset.xml | 2 +- .../Config/Backend/AbstractConversion.php | 6 +- .../GoogleAdwords/Model/Validator/Factory.php | 6 +- .../Test/Unit/Model/Validator/FactoryTest.php | 6 +- .../GoogleOptimizer/Block/Code/Category.php | 2 +- .../GoogleOptimizer/Block/Code/Product.php | 2 +- .../Model/Observer/Category/Delete.php | 2 +- .../Model/Observer/CmsPage/Delete.php | 2 +- .../Model/Observer/Product/Delete.php | 2 +- .../Block/Adminhtml/Order/Create/Sidebar.php | 4 +- .../Block/Cart/Item/Renderer/Grouped.php | 2 +- .../Block/Stockqty/Type/Grouped.php | 2 +- .../Model/Product/Type/Grouped.php | 14 +- .../Product/Quote/Plugin/Initializer.php | 4 +- .../Adminhtml/Order/Create/SidebarTest.php | 2 +- .../Composite/Fieldset/GroupedTest.php | 2 +- .../ListAssociatedProductsTest.php | 2 +- .../Block/Product/View/Type/GroupedTest.php | 2 +- .../Unit/Model/Product/Type/GroupedTest.php | 18 +- .../Block/Adminhtml/Export/Filter.php | 4 +- .../Grid/Column/Renderer/Download.php | 4 +- .../ImportExport/Model/AbstractModel.php | 2 +- .../Model/Import/AbstractEntity.php | 6 +- .../Model/Import/Entity/AbstractEav.php | 4 +- .../Model/Import/Entity/AbstractEntity.php | 6 +- .../Model/Resource/Import/Data.php | 13 +- .../Block/Adminhtml/Export/FilterTest.php | 2 +- .../Grid/Column/Renderer/DownloadTest.php | 2 +- .../Model/Import/Entity/EavAbstractTest.php | 4 +- .../Unit/Model/Import/EntityAbstractTest.php | 2 +- .../CollectionByPagesIteratorTest.php | 2 +- .../Grid/Column/Renderer/Scheduled.php | 4 +- .../Backend/Grid/Column/Renderer/Status.php | 4 +- .../Backend/Grid/Column/Renderer/Updated.php | 4 +- .../Magento/Indexer/Model/Action/Base.php | 2 +- .../Magento/Indexer/Model/CacheContext.php | 2 +- app/code/Magento/Indexer/Model/Indexer.php | 2 +- .../Grid/Column/Renderer/ScheduledTest.php | 5 +- .../Grid/Column/Renderer/StatusTest.php | 8 +- .../Grid/Column/Renderer/UpdatedTest.php | 2 +- .../Widget/Grid/Column/Renderer/Button.php | 20 +- .../Grid/Column/Renderer/Button/Delete.php | 14 +- .../Grid/Column/Renderer/Button/Edit.php | 14 +- .../Widget/Grid/Column/Renderer/Link.php | 12 +- .../Grid/Column/Renderer/Link/Activate.php | 4 +- .../Widget/Grid/Column/Renderer/Name.php | 4 +- .../Grid/Column/Renderer/ButtonTest.php | 2 +- .../Widget/Grid/Column/Renderer/LinkTest.php | 2 +- .../Controller/Adminhtml/IntegrationTest.php | 4 +- .../Test/Unit/Model/ManagerTest.php | 4 +- .../Integration/Test/Unit/Oauth/OauthTest.php | 6 +- .../Adminhtml/Online/Grid/Renderer/Ip.php | 4 +- .../Adminhtml/Online/Grid/Renderer/Type.php | 4 +- .../Adminhtml/Online/Grid/Renderer/Url.php | 4 +- .../Magento/Log/Model/Resource/Visitor.php | 20 +- .../Visitor/Online/Grid/Row/UrlGenerator.php | 2 +- .../Log/Test/Unit/Model/VisitorTest.php | 8 +- .../Unit/Model/Resource/Db/AbstractTest.php | 2 +- .../Block/Checkout/Addresses.php | 8 +- .../Multishipping/Block/Checkout/Overview.php | 8 +- .../Multishipping/Block/Checkout/Shipping.php | 12 +- .../Model/Checkout/Type/Multishipping.php | 2 +- .../Checkout/Type/Multishipping/State.php | 12 +- .../Problem/Grid/Renderer/Checkbox.php | 4 +- .../Adminhtml/Queue/Grid/Renderer/Action.php | 4 +- .../Subscriber/Grid/Renderer/Checkbox.php | 4 +- .../Block/Adminhtml/Template/Grid.php | 2 +- .../Template/Grid/Renderer/Action.php | 4 +- .../Template/Grid/Renderer/Sender.php | 4 +- .../OfflinePayments/Model/Purchaseorder.php | 6 +- .../Test/Unit/Model/PurchaseorderTest.php | 2 +- .../Model/Carrier/Flatrate.php | 4 +- .../Model/Carrier/Freeshipping.php | 4 +- .../OfflineShipping/Model/Carrier/Pickup.php | 4 +- .../Model/Carrier/Tablerate.php | 4 +- .../Model/Resource/Carrier/Tablerate.php | 4 +- .../Magento/OfflineShipping/etc/fieldset.xml | 2 +- .../PageCache/Controller/Block/Esi.php | 2 +- .../PageCache/Controller/Block/Render.php | 4 +- .../PageCache/Model/Layout/LayoutPlugin.php | 2 +- .../Model/Observer/FlushCacheByTags.php | 2 +- .../Observer/InvalidateCacheIfChanged.php | 2 +- .../Test/Unit/Block/Controller/StubBlock.php | 2 +- .../Observer/InvalidateCacheIfChangedTest.php | 9 +- .../ProcessLayoutRenderElementTest.php | 4 +- .../Payment/Block/ConfigurableInfo.php | 8 +- app/code/Magento/Payment/Block/Info.php | 10 +- app/code/Magento/Payment/Block/Info/Cc.php | 4 +- app/code/Magento/Payment/Model/Cart.php | 4 +- .../Payment/Model/Cart/SalesModel/Order.php | 2 +- .../Payment/Model/Cart/SalesModel/Quote.php | 2 +- .../Cart/SalesModel/SalesModelInterface.php | 2 +- .../Payment/Model/Method/AbstractMethod.php | 18 +- .../Magento/Payment/Model/Method/Adapter.php | 2 +- app/code/Magento/Payment/Model/Method/Cc.php | 6 +- .../Model/Method/Online/GatewayInterface.php | 6 +- .../Magento/Payment/Model/MethodInterface.php | 14 +- .../Magento/Payment/Model/Paygate/Result.php | 2 +- .../Block/Adminhtml/Transparent/FormTest.php | 2 +- .../Payment/Test/Unit/Block/FormTest.php | 4 +- .../Payment/Test/Unit/Block/InfoTest.php | 4 +- .../Test/Unit/Block/Transparent/FormTest.php | 2 +- .../Unit/Model/Cart/SalesModel/OrderTest.php | 12 +- .../Unit/Model/Cart/SalesModel/QuoteTest.php | 2 +- .../Payment/Test/Unit/Model/CartTest.php | 15 +- .../Paypal/Block/Billing/Agreements.php | 2 +- .../Magento/Paypal/Block/Express/Review.php | 6 +- .../Magento/Paypal/Block/Payment/Info.php | 4 +- .../Block/Payment/Info/Billing/Agreement.php | 6 +- .../Magento/Paypal/Model/Api/AbstractApi.php | 24 +- app/code/Magento/Paypal/Model/Api/Nvp.php | 20 +- app/code/Magento/Paypal/Model/Config.php | 4 +- .../Paypal/Model/Config/Rules/Reader.php | 2 +- app/code/Magento/Paypal/Model/Direct.php | 12 +- app/code/Magento/Paypal/Model/Express.php | 22 +- .../Magento/Paypal/Model/Express/Checkout.php | 17 +- .../Paypal/Model/Express/Checkout/Quote.php | 2 +- app/code/Magento/Paypal/Model/Hostedpro.php | 2 +- .../Paypal/Model/Hostedpro/Request.php | 10 +- app/code/Magento/Paypal/Model/Info.php | 10 +- .../Magento/Paypal/Model/Method/Agreement.php | 10 +- app/code/Magento/Paypal/Model/Payflow/Pro.php | 8 +- .../Magento/Paypal/Model/Payflow/Request.php | 2 +- .../Paypal/Model/Payflow/Service/Gateway.php | 10 +- .../Payflow/Service/Request/SecureToken.php | 2 +- .../Handler/CreditCardValidationHandler.php | 4 +- .../Service/Response/Handler/FraudHandler.php | 4 +- .../Response/Handler/HandlerComposite.php | 4 +- .../Response/Handler/HandlerInterface.php | 4 +- .../Payflow/Service/Response/Transaction.php | 4 +- .../Response/Validator/AVSResponse.php | 4 +- .../Service/Response/Validator/CVV2Match.php | 18 +- .../Response/Validator/ResponseValidator.php | 4 +- .../Response/Validator/SecureToken.php | 7 +- .../Service/Response/ValidatorInterface.php | 4 +- .../Paypal/Model/Payflow/Transparent.php | 2 +- app/code/Magento/Paypal/Model/Payflowlink.php | 6 +- app/code/Magento/Paypal/Model/Payflowpro.php | 40 +- .../Method/Billing/AbstractAgreement.php | 2 +- app/code/Magento/Paypal/Model/Pro.php | 24 +- .../Test/Unit/Block/Express/ReviewTest.php | 4 +- .../Controller/Express/PlaceOrderTest.php | 2 +- .../Transparent/RequestSecureTokenTest.php | 2 +- .../Controller/Transparent/ResponseTest.php | 4 +- .../BillingAgreementConfigProviderTest.php | 4 +- .../Paypal/Test/Unit/Model/CartTest.php | 26 +- .../Unit/Model/Express/Checkout/QuoteTest.php | 4 +- .../Test/Unit/Model/Express/CheckoutTest.php | 4 +- .../Test/Unit/Model/Hostedpro/RequestTest.php | 8 +- .../Paypal/Test/Unit/Model/InfoTest.php | 6 +- ...RestrictAdminBillingAgreementUsageTest.php | 4 +- .../Paypal/Test/Unit/Model/ObserverTest.php | 6 +- .../Model/Payflow/Service/GatewayTest.php | 6 +- .../Service/Request/SecureTokenTest.php | 6 +- .../CreditCardValidationHandlerTest.php | 4 +- .../Response/Handler/FraudHandlerTest.php | 4 +- .../Response/Handler/HandlerCompositeTest.php | 2 +- .../Service/Response/TransactionTest.php | 6 +- .../Response/Validator/AVSResponseTest.php | 18 +- .../Response/Validator/CVV2MatchTest.php | 16 +- .../Validator/ResponseValidatorTest.php | 14 +- .../Response/Validator/SecureTokenTest.php | 16 +- .../Unit/Model/Payflow/TransparentTest.php | 18 +- .../Test/Unit/Model/PayflowlinkTest.php | 4 +- .../Paypal/Test/Unit/Model/PayflowproTest.php | 10 +- .../Persistent/Model/Observer/Session.php | 6 +- .../Model/Observer/UpdateCustomerCookies.php | 2 +- app/code/Magento/Persistent/Model/Session.php | 5 +- .../Observer/DisableGuestCheckoutTest.php | 2 +- .../Observer/PreventExpressCheckoutTest.php | 2 +- .../Observer/UpdateCustomerCookiesTest.php | 2 +- .../Controller/Add/TestObserver.php | 4 +- .../Frontend/Quote/Address/VatValidator.php | 4 +- .../Quote/Model/Observer/Webapi/Submit.php | 2 +- app/code/Magento/Quote/Model/Quote.php | 28 +- .../Magento/Quote/Model/Quote/Address.php | 4 +- .../Quote/Model/Quote/Address/RateRequest.php | 2 +- .../Address/RateResult/AbstractResult.php | 2 +- .../Quote/Model/Quote/Address/ToOrder.php | 2 +- .../Model/Quote/Address/ToOrderAddress.php | 2 +- .../Quote/Model/Quote/Address/Total.php | 2 +- app/code/Magento/Quote/Model/Quote/Item.php | 14 +- .../Quote/Model/Quote/Item/AbstractItem.php | 2 +- .../Quote/Model/Quote/Item/Processor.php | 8 +- .../Quote/Model/Quote/Item/ToOrderItem.php | 2 +- .../Quote/Model/Quote/Item/Updater.php | 6 +- .../Magento/Quote/Model/Quote/Payment.php | 2 +- .../Model/Quote/Payment/ToOrderPayment.php | 2 +- .../Quote/Address/Attribute/Backend/Child.php | 2 +- .../Address/Attribute/Backend/Region.php | 2 +- .../Quote/Address/Rate/Collection.php | 2 +- .../Quote/Address/VatValidatorTest.php | 4 +- .../Unit/Model/Observer/Webapi/SubmitTest.php | 4 +- .../Quote/Address/ToOrderAddressTest.php | 4 +- .../Unit/Model/Quote/Address/ToOrderTest.php | 4 +- .../Unit/Model/Quote/Item/ProcessorTest.php | 4 +- .../Unit/Model/Quote/Item/ToOrderItemTest.php | 4 +- .../Unit/Model/Quote/Item/UpdaterTest.php | 4 +- .../Quote/Test/Unit/Model/Quote/ItemTest.php | 4 +- .../Quote/Payment/ToOrderPaymentTest.php | 4 +- .../Quote/Test/Unit/Model/QuoteTest.php | 12 +- app/code/Magento/Quote/etc/fieldset.xml | 2 +- .../Reports/Block/Adminhtml/Filter/Form.php | 2 +- .../Block/Adminhtml/Grid/AbstractGrid.php | 6 +- .../Grid/Column/Renderer/Blanknumber.php | 4 +- .../Grid/Column/Renderer/Currency.php | 4 +- .../Grid/Column/Renderer/Customer.php | 4 +- .../Grid/Column/Renderer/Product.php | 4 +- .../Product/Downloads/Renderer/Purchases.php | 4 +- .../Block/Adminhtml/Product/Viewed/Grid.php | 2 +- .../Block/Adminhtml/Sales/Coupons/Grid.php | 2 +- .../Sales/Grid/Column/Renderer/Date.php | 4 +- .../Adminhtml/Shopcart/Abandoned/Grid.php | 2 +- .../Block/Adminhtml/Shopcart/Product/Grid.php | 2 +- .../Magento/Reports/Block/Product/Viewed.php | 2 +- .../Adminhtml/Report/AbstractReport.php | 4 +- app/code/Magento/Reports/Model/Config.php | 2 +- app/code/Magento/Reports/Model/Item.php | 2 +- .../Model/Resource/Customer/Collection.php | 4 +- .../Model/Resource/Order/Collection.php | 2 +- .../Model/Resource/Product/Collection.php | 2 +- .../Resource/Product/Index/AbstractIndex.php | 4 +- .../Model/Resource/Refresh/Collection.php | 2 +- .../Model/Resource/Report/Collection.php | 2 +- .../Sales/Grid/Column/Renderer/DateTest.php | 4 +- .../Report/Customer/AccountsTest.php | 6 +- .../Adminhtml/Report/Customer/OrdersTest.php | 6 +- .../Adminhtml/Report/Customer/TotalsTest.php | 6 +- .../Report/Product/DownloadsTest.php | 6 +- .../Adminhtml/Report/Product/LowstockTest.php | 6 +- .../Adminhtml/Report/Product/SoldTest.php | 6 +- .../Adminhtml/Report/Product/ViewedTest.php | 6 +- .../Model/Resource/Report/CollectionTest.php | 2 +- .../Magento/Review/Block/Adminhtml/Grid.php | 2 +- .../Block/Adminhtml/Grid/Renderer/Type.php | 4 +- .../Review/Block/Adminhtml/Product/Grid.php | 2 +- .../Magento/Review/Block/Product/View.php | 4 +- .../Adminhtml/Product/JsonProductInfo.php | 4 +- .../Magento/Review/Model/Resource/Review.php | 6 +- app/code/Magento/Review/Model/Review.php | 4 +- .../Test/Unit/Block/Adminhtml/MainTest.php | 2 +- .../Test/Unit/Block/Customer/RecentTest.php | 2 +- .../Review/Test/Unit/Block/FormTest.php | 2 +- .../Review/Summary/CollectionTest.php | 2 +- .../Review/Test/Unit/Model/ReviewTest.php | 2 +- app/code/Magento/Rule/Model/AbstractModel.php | 8 +- .../Rule/Model/Action/AbstractAction.php | 2 +- .../Model/Condition/AbstractCondition.php | 2 +- .../Condition/Product/AbstractProduct.php | 2 +- .../Condition/Product/AbstractProductTest.php | 12 +- .../Block/Adminhtml/Items/AbstractItems.php | 20 +- .../Block/Adminhtml/Order/AbstractOrder.php | 2 +- .../Adminhtml/Order/Create/Giftmessage.php | 4 +- .../Order/Create/Giftmessage/Form.php | 6 +- .../Create/Search/Grid/Renderer/Price.php | 4 +- .../Create/Search/Grid/Renderer/Product.php | 4 +- .../Order/Create/Search/Grid/Renderer/Qty.php | 6 +- .../Block/Adminhtml/Order/Create/Sidebar.php | 2 +- .../Order/Create/Sidebar/AbstractSidebar.php | 12 +- .../Adminhtml/Order/Create/Sidebar/Cart.php | 2 +- .../Order/Create/Sidebar/Compared.php | 2 +- .../Order/Create/Sidebar/Pcompared.php | 2 +- .../Order/Create/Sidebar/Pviewed.php | 2 +- .../Order/Create/Sidebar/Reorder.php | 2 +- .../Order/Create/Sidebar/Wishlist.php | 2 +- .../Block/Adminhtml/Order/Create/Totals.php | 2 +- .../Order/Creditmemo/Create/Adjustments.php | 6 +- .../Adminhtml/Order/Creditmemo/Totals.php | 4 +- .../Sales/Block/Adminhtml/Order/Totals.php | 6 +- .../Block/Adminhtml/Order/Totals/Item.php | 2 +- .../Adminhtml/Order/View/Giftmessage.php | 6 +- .../View/Items/Renderer/DefaultRenderer.php | 4 +- .../Adminhtml/Reorder/Renderer/Action.php | 6 +- .../Config/Form/Fieldset/Order/Statuses.php | 6 +- .../Magento/Sales/Block/Adminhtml/Totals.php | 10 +- .../Adminhtml/Transactions/Detail/Grid.php | 2 +- .../Sales/Block/Items/AbstractItems.php | 8 +- .../Sales/Block/Order/Creditmemo/Totals.php | 4 +- .../Order/Item/Renderer/DefaultRenderer.php | 10 +- app/code/Magento/Sales/Block/Order/Totals.php | 20 +- .../Controller/Adminhtml/Order/Create.php | 2 +- .../Adminhtml/Order/Create/AddConfigured.php | 2 +- .../Order/Create/ConfigureProductToAdd.php | 2 +- .../Order/Create/ConfigureQuoteItems.php | 2 +- .../Adminhtml/Order/CreditmemoLoader.php | 4 +- .../Adminhtml/Order/VoidPayment.php | 3 +- app/code/Magento/Sales/Helper/Admin.php | 4 +- .../Magento/Sales/Model/AdminOrder/Create.php | 34 +- .../AdminOrder/Product/Quote/Initializer.php | 4 +- .../Magento/Sales/Model/Convert/Order.php | 8 +- app/code/Magento/Sales/Model/Order.php | 8 +- .../Magento/Sales/Model/Order/Address.php | 2 +- .../Sales/Model/Order/Customer/Management.php | 6 +- .../Model/Order/Grid/Row/UrlGenerator.php | 2 +- .../Order/Invoice/Grid/Row/UrlGenerator.php | 2 +- app/code/Magento/Sales/Model/Order/Item.php | 4 +- .../Magento/Sales/Model/Order/Payment.php | 6 +- .../Sales/Model/Order/Pdf/AbstractPdf.php | 14 +- .../Sales/Model/Order/Pdf/Creditmemo.php | 4 +- .../Magento/Sales/Model/Order/Pdf/Invoice.php | 4 +- .../Model/Order/Pdf/Items/AbstractItems.php | 8 +- .../Items/Creditmemo/DefaultCreditmemo.php | 6 +- .../Pdf/Items/Invoice/DefaultInvoice.php | 6 +- .../Pdf/Items/Shipment/DefaultShipment.php | 6 +- .../Sales/Model/Order/Pdf/Shipment.php | 4 +- .../Model/Order/Pdf/Total/DefaultTotal.php | 2 +- .../Sales/Model/Order/Shipment/Track.php | 2 +- app/code/Magento/Sales/Model/Order/Total.php | 2 +- .../Sales/Model/Order/Total/AbstractTotal.php | 2 +- .../Sales/Model/Resource/EntityAbstract.php | 2 +- .../Sales/Model/Resource/Order/Address.php | 2 +- .../Order/Attribute/Backend/Billing.php | 4 +- .../Order/Attribute/Backend/Child.php | 2 +- .../Order/Attribute/Backend/Shipping.php | 4 +- .../Sales/Model/Resource/Order/Creditmemo.php | 2 +- .../Creditmemo/Attribute/Backend/Child.php | 2 +- .../Sales/Model/Resource/Order/Invoice.php | 2 +- .../Order/Invoice/Attribute/Backend/Child.php | 2 +- .../Order/Invoice/Attribute/Backend/Item.php | 2 +- .../Order/Invoice/Attribute/Backend/Order.php | 2 +- .../Model/Resource/Order/Invoice/Item.php | 2 +- .../Sales/Model/Resource/Order/Item.php | 2 +- .../Sales/Model/Resource/Order/Payment.php | 2 +- .../Sales/Model/Resource/Order/Shipment.php | 2 +- .../Shipment/Attribute/Backend/Child.php | 2 +- .../Model/Resource/Order/Shipment/Item.php | 2 +- .../Sales/Model/Resource/Sale/Collection.php | 8 +- .../Magento/Sales/Model/Rss/OrderStatus.php | 6 +- .../Sales/Model/Service/OrderService.php | 2 +- .../Magento/Sales/Model/Status/ListStatus.php | 2 +- .../Adminhtml/Order/Create/Items/GridTest.php | 2 +- .../Create/Search/Grid/Renderer/QtyTest.php | 2 +- .../Create/Sidebar/AbstractSidebarTest.php | 2 +- .../Adminhtml/Order/View/GiftmessageTest.php | 4 +- .../Block/Adminhtml/Order/View/InfoTest.php | 2 +- .../Sales/Test/Unit/Helper/AdminTest.php | 4 +- .../Test/Unit/Model/AdminOrder/CreateTest.php | 4 +- .../Product/Quote/InitializerTest.php | 4 +- .../Test/Unit/Model/Order/ConfigTest.php | 8 +- .../Order/Creditmemo/Total/ShippingTest.php | 6 +- .../Model/Order/Creditmemo/Total/TaxTest.php | 2 +- .../Model/Order/Customer/ManagementTest.php | 2 +- .../Model/Order/Grid/Row/UrlGeneratorTest.php | 2 +- .../Invoice/Grid/Row/UrlGeneratorTest.php | 2 +- .../Unit/Model/Order/Pdf/AbstractTest.php | 2 +- .../Unit/Model/Order/Shipment/TrackTest.php | 2 +- app/code/Magento/Sales/etc/fieldset.xml | 2 +- .../Tab/Coupons/Grid/Column/Renderer/Used.php | 4 +- .../Adminhtml/Promo/Quote/Edit/Tab/Main.php | 4 +- .../Controller/Adminhtml/Promo/Quote/Save.php | 2 +- .../SalesRule/Model/Coupon/Codegenerator.php | 2 +- .../SalesRule/Model/Resource/Coupon/Usage.php | 4 +- .../Magento/SalesRule/Model/Resource/Rule.php | 6 +- app/code/Magento/SalesRule/Model/Rule.php | 2 +- .../Model/Rule/Condition/Combine.php | 2 +- app/code/Magento/SalesRule/Model/Utility.php | 6 +- .../Test/Unit/Model/Quote/DiscountTest.php | 2 +- .../Rule/Action/Discount/CartFixedTest.php | 2 +- .../SalesRule/Test/Unit/Model/UtilityTest.php | 6 +- app/code/Magento/SalesRule/etc/fieldset.xml | 2 +- app/code/Magento/Search/Block/Term.php | 2 +- app/code/Magento/Search/Helper/Data.php | 4 +- .../Search/Model/Autocomplete/Item.php | 2 +- .../Magento/Search/Model/QueryFactory.php | 2 +- .../Search/Test/Unit/Helper/DataTest.php | 4 +- .../Test/Unit/Model/QueryFactoryTest.php | 4 +- app/code/Magento/SendFriend/Block/Send.php | 10 +- .../Magento/SendFriend/Model/SendFriend.php | 16 +- .../Block/Adminhtml/Order/Packaging.php | 12 +- .../Adminhtml/Order/Shipment/CreateLabel.php | 2 +- .../Adminhtml/Order/Shipment/Save.php | 2 +- .../Adminhtml/Order/ShipmentLoader.php | 4 +- .../Model/Carrier/AbstractCarrier.php | 40 +- .../Carrier/AbstractCarrierInterface.php | 36 +- .../Model/Carrier/AbstractCarrierOnline.php | 32 +- app/code/Magento/Shipping/Model/Config.php | 2 +- app/code/Magento/Shipping/Model/Info.php | 2 +- .../Shipping/Model/Order/Pdf/Packaging.php | 10 +- .../Shipping/Model/Shipment/Request.php | 2 +- .../Model/Shipment/ReturnShipment.php | 2 +- app/code/Magento/Shipping/Model/Shipping.php | 4 +- .../Shipping/Model/Shipping/Labels.php | 4 +- .../Model/Tracking/Result/AbstractResult.php | 2 +- .../Block/Adminhtml/Order/TrackingTest.php | 2 +- .../Order/Shipment/NewActionTest.php | 6 +- .../templates/order/packaging/packed.phtml | 6 +- .../Block/Adminhtml/Grid/Renderer/Action.php | 4 +- .../Block/Adminhtml/Grid/Renderer/Link.php | 4 +- .../Block/Adminhtml/Grid/Renderer/Time.php | 4 +- .../Model/Resource/Catalog/Category.php | 4 +- .../Model/Resource/Catalog/Product.php | 14 +- .../Sitemap/Model/Resource/Cms/Page.php | 4 +- app/code/Magento/Sitemap/Model/Sitemap.php | 8 +- .../Sitemap/Test/Unit/Model/SitemapTest.php | 14 +- .../Magento/Store/Model/App/Emulation.php | 6 +- app/code/Magento/Store/Model/Group.php | 2 +- app/code/Magento/Store/Model/Store.php | 4 +- app/code/Magento/Store/Model/System/Store.php | 2 +- app/code/Magento/Store/Model/Website.php | 2 +- .../Model/Config/Reader/DefaultReaderTest.php | 4 +- .../Unit/Model/Config/Reader/StoreTest.php | 6 +- .../Unit/Model/Config/Reader/WebsiteTest.php | 4 +- .../Adminhtml/Rate/Grid/Renderer/Data.php | 4 +- .../Magento/Tax/Block/Sales/Order/Tax.php | 18 +- app/code/Magento/Tax/Helper/Data.php | 2 +- app/code/Magento/Tax/Model/Calculation.php | 28 +- .../Model/Calculation/AbstractCalculator.php | 8 +- app/code/Magento/Tax/Model/Rate/Source.php | 2 +- .../Tax/Model/Resource/Calculation.php | 10 +- .../Resource/Sales/Order/Tax/Collection.php | 2 +- .../Sales/Total/Quote/CommonTaxCollector.php | 2 +- .../Tax/Model/TaxClass/AbstractType.php | 2 +- .../Magento/Tax/Model/TaxRateCollection.php | 4 +- .../Magento/Tax/Model/TaxRuleCollection.php | 4 +- .../Magento/Tax/Test/Unit/Helper/DataTest.php | 2 +- .../RowBaseAndTotalBaseCalculatorTestCase.php | 2 +- .../Calculation/UnitBaseCalculatorTest.php | 2 +- .../Tax/Test/Unit/Model/ObserverTest.php | 2 +- .../Test/Unit/Model/TaxCalculationTest.php | 4 +- app/code/Magento/Tax/etc/fieldset.xml | 2 +- .../Adminhtml/Rate/Grid/Renderer/Country.php | 4 +- .../Controller/Adminhtml/Rate/ExportPost.php | 2 +- .../Block/Adminhtml/Wysiwyg/Files/Content.php | 2 +- app/code/Magento/Theme/Block/Html/Footer.php | 2 +- app/code/Magento/Theme/Block/Html/Topmenu.php | 4 +- .../Console/Command/ThemeUninstallCommand.php | 6 +- app/code/Magento/Theme/Model/Design.php | 2 +- .../Magento/Theme/Model/Layout/Config.php | 6 +- .../Magento/Theme/Model/Theme/Collection.php | 6 +- .../Unit/Model/Config/CustomizationTest.php | 12 +- .../Theme/Test/Unit/Model/ConfigTest.php | 4 +- .../Test/Unit/Model/Layout/ConfigTest.php | 4 +- .../Unit/Model/Layout/Source/LayoutTest.php | 4 +- .../Unit/Model/Theme/Domain/VirtualTest.php | 2 +- .../Test/Unit/Model/Theme/ValidationTest.php | 4 +- .../Test/Unit/Model/ThemeValidatorTest.php | 6 +- .../Translation/Model/Inline/Parser.php | 6 +- .../Translation/Model/Resource/String.php | 276 -- app/code/Magento/Translation/Model/String.php | 50 - .../Magento/Translation/etc/adminhtml/di.xml | 2 +- .../Ui/Component/AbstractComponent.php | 4 +- .../Magento/Ui/Component/Control/Item.php | 4 +- .../Ui/Controller/Adminhtml/Bookmark/Save.php | 3 + app/code/Magento/Ui/Model/Bookmark.php | 6 +- .../Magento/Ui/Model/Resource/Bookmark.php | 2 +- .../Xhtml/Compiler/Element/Content.php | 14 +- .../Xhtml/Compiler/Element/Form.php | 14 +- .../Xhtml/Compiler/Element/Render.php | 14 +- .../Unit/Component/Control/ActionPoolTest.php | 2 +- app/code/Magento/Ui/etc/di.xml | 2 +- app/code/Magento/Ups/Model/Carrier.php | 32 +- .../UrlRewrite/Block/Catalog/Product/Grid.php | 2 +- .../UrlRewrite/Block/Cms/Page/Grid.php | 2 +- app/code/Magento/UrlRewrite/etc/config.xml | 6 +- .../Controller/Adminhtml/User/Validate.php | 2 +- app/code/Magento/User/Model/Resource/User.php | 4 +- app/code/Magento/User/Model/User.php | 12 +- .../User/Model/UserValidationRules.php | 20 +- .../Magento/User/Test/Unit/Model/UserTest.php | 2 +- .../Unit/Model/UserValidationRulesTest.php | 4 +- .../Tab/General/Shipping/Packaging/Plugin.php | 8 +- app/code/Magento/Usps/Model/Carrier.php | 44 +- .../Adminhtml/System/Variable/Validate.php | 2 +- .../Variable/Model/Resource/Variable.php | 2 +- .../Variable/Model/Variable/Config.php | 2 +- .../Test/Unit/Model/Variable/ConfigTest.php | 2 +- .../Controller/Soap/Request/HandlerTest.php | 2 +- .../Test/Unit/Model/Plugin/ManagerTest.php | 4 +- .../Magento/Weee/Block/Renderer/Weee/Tax.php | 2 +- .../Magento/Weee/Block/Sales/Order/Totals.php | 2 +- app/code/Magento/Weee/Helper/Data.php | 18 +- app/code/Magento/Weee/Model/Tax.php | 12 +- .../Weee/Model/Total/Observer/Webapi/Item.php | 2 +- .../Weee/Pricing/Render/Adjustment.php | 12 +- .../Weee/Test/Unit/Helper/DataTest.php | 2 +- .../Weee/Test/Unit/Model/ObserverTest.php | 6 +- .../Model/Total/Observer/Webapi/ItemTest.php | 2 +- .../Unit/Model/Total/Quote/WeeeTaxTest.php | 22 +- .../Test/Unit/Model/Total/Quote/WeeeTest.php | 24 +- .../Unit/Pricing/Render/AdjustmentTest.php | 12 +- app/code/Magento/Weee/etc/fieldset.xml | 2 +- .../Widget/Block/Adminhtml/Widget/Chooser.php | 6 +- .../Widget/Instance/Edit/Tab/Properties.php | 2 +- .../Widget/Block/Adminhtml/Widget/Options.php | 4 +- .../Magento/Widget/Block/BlockInterface.php | 2 +- .../Adminhtml/Widget/Instance/Validate.php | 2 +- .../Magento/Widget/Model/Template/Filter.php | 4 +- app/code/Magento/Widget/Model/Widget.php | 20 +- .../Magento/Widget/Model/Widget/Config.php | 4 +- .../Widget/Test/Unit/Model/WidgetTest.php | 10 +- .../Magento/Wishlist/Controller/Index/Add.php | 5 +- .../Wishlist/Controller/Index/Configure.php | 2 +- .../Controller/Index/UpdateItemOptions.php | 2 +- app/code/Magento/Wishlist/Model/Item.php | 24 +- app/code/Magento/Wishlist/Model/Wishlist.php | 24 +- .../Test/Unit/Controller/Index/CartTest.php | 6 +- .../Index/UpdateItemOptionsTest.php | 4 +- .../Wishlist/Test/Unit/Model/ItemTest.php | 2 +- .../Wishlist/Test/Unit/Model/ObserverTest.php | 4 +- .../Wishlist/Test/Unit/Model/WishlistTest.php | 8 +- app/etc/di.xml | 28 +- composer.json | 5 +- composer.lock | 197 +- .../_files/Magento/TestModuleMSC/etc/di.xml | 2 +- .../api-functional/framework/bootstrap.php | 1 + .../Api/ProductOptionRepositoryTest.php | 18 +- .../Catalog/Api/CategoryManagementTest.php | 3 + .../Customer/Api/GroupRepositoryTest.php | 2 + .../Api/ProductRepositoryTest.php | 17 +- .../lib/Magento/Mtf/ObjectManagerFactory.php | 4 +- .../Generate/Repository/TableCollection.php | 2 +- dev/tests/integration/framework/bootstrap.php | 1 + .../Magento/Test/ObjectManagerTest.php | 10 +- .../Backend/Block/System/Store/DeleteTest.php | 2 +- .../Backend/Model/Locale/ResolverTest.php | 2 +- .../Magento/Backend/Model/ObserverTest.php | 8 +- .../Backend/Model/Session/QuoteTest.php | 2 +- .../Product/Attribute/Set/Toolbar/AddTest.php | 2 +- .../Adminhtml/Product/AttributeTest.php | 4 +- .../Magento/Catalog/Helper/CategoryTest.php | 2 +- .../Magento/Catalog/Helper/DataTest.php | 24 +- .../Catalog/Helper/Product/CompositeTest.php | 4 +- .../Magento/Catalog/Helper/ProductTest.php | 4 +- .../Catalog/Model/Layer/CategoryTest.php | 2 +- .../Filter/Price/AlgorithmAdvancedTest.php | 4 +- .../Attribute/Backend/TierpriceTest.php | 6 +- .../Option/Type/File/ValidatorFileTest.php | 12 +- .../Model/Product/Type/AbstractTypeTest.php | 34 +- .../Catalog/Model/Product/Type/PriceTest.php | 2 +- .../Catalog/Model/Product/TypeTest.php | 4 +- .../Catalog/Model/ProductExternalTest.php | 6 +- .../Catalog/Model/ProductGettersTest.php | 4 +- .../Magento/Catalog/Model/ProductTest.php | 4 +- .../Magento/CatalogSearch/Block/TermTest.php | 2 +- .../Checkout/_files/product_bundle.php | 2 +- .../_files/product_with_custom_option.php | 2 +- .../_files/quote_with_bundle_product.php | 2 +- .../quote_with_downloadable_product.php | 2 +- .../_files/quote_with_simple_product.php | 2 +- ..._with_simple_product_and_custom_option.php | 2 +- .../Magento/Cms/Model/Wysiwyg/ConfigTest.php | 2 +- .../Cms/Model/Wysiwyg/Images/StorageTest.php | 2 +- .../Type/Configurable/AttributeTest.php | 4 +- .../Model/Product/Type/ConfigurableTest.php | 16 +- .../quote_with_configurable_product.php | 2 +- .../Block/Adminhtml/Edit/Tab/CartTest.php | 2 +- .../Block/Adminhtml/Edit/Tab/OrdersTest.php | 2 +- .../Adminhtml/Edit/Tab/View/CartTest.php | 2 +- .../Adminhtml/Edit/Tab/View/OrdersTest.php | 2 +- .../Controller/Adminhtml/GroupTest.php | 2 +- .../Edit/Tab/Downloadable/LinksTest.php | 4 +- .../Edit/Tab/Downloadable/SamplesTest.php | 4 +- .../_files/testFromClone/composer.json | 3 +- .../testFromCreateProject/composer.lock | 6 - .../_files/testSkeleton/composer.lock | 6 - .../Data/Argument/Interpreter/StringTest.php | 83 - .../Object/Copy/Config/ReaderTest.php | 65 - .../Copy/Config/_files/expectedArray.php | 14 - .../Object/Copy/Config/_files/fieldset.xml | 24 - .../Config/_files/partialFieldsetFirst.xml | 21 - .../Config/_files/partialFieldsetSecond.xml | 22 - .../Magento/Framework/Object/CopyTest.php | 58 - .../Adapter/Mysql/Builder/Query/MatchTest.php | 8 +- .../Session/SaveHandler/DbTableTest.php | 2 +- .../Framework/TranslateCachingTest.php | 4 +- .../Framework/ValidatorFactoryTest.php | 2 +- .../Framework/View/Element/TemplateTest.php | 2 +- .../Model/Product/Type/GroupedTest.php | 2 +- .../Model/Import/EntityAbstractTest.php | 2 +- .../Payment/Form/Billing/AgreementTest.php | 2 +- .../Paypal/Model/Express/CheckoutTest.php | 4 +- .../Magento/Paypal/Model/PayflowproTest.php | 2 +- .../Magento/Paypal/Model/VoidTest.php | 4 +- .../Magento/Quote/Model/QuoteTest.php | 2 +- .../Adminhtml/Sales/Coupons/GridTest.php | 2 +- .../Adminhtml/Sales/Invoiced/GridTest.php | 2 +- .../Adminhtml/Sales/Refunded/GridTest.php | 2 +- .../Block/Adminhtml/Sales/Sales/GridTest.php | 4 +- .../Adminhtml/Sales/Shipping/GridTest.php | 2 +- .../Block/Adminhtml/Sales/Tax/GridTest.php | 2 +- .../Reports/_files/viewed_products.php | 4 +- .../Block/Adminhtml/Items/AbstractTest.php | 2 +- .../Order/Create/Giftmessage/FormTest.php | 2 +- .../Report/Filter/Form/CouponTest.php | 2 +- .../Sales/_files/quote_with_bundle.php | 2 +- .../Promo/Quote/Edit/Tab/MainTest.php | 2 +- .../Php/Tokenizer/_files/objectsCode.php.txt | 2 +- .../Tax/Model/Resource/CalculationTest.php | 2 +- .../Magento/Tax/Model/TaxCalculationTest.php | 4 +- .../Modular/FieldsetConfigFilesTest.php | 4 +- .../Magento/Theme/Model/ObserverTest.php | 2 +- .../Translation/Model/InlineParserTest.php | 2 +- .../Magento/Translation/Model/StringTest.php | 6 +- .../Translation/_files/db_translate.php | 4 +- .../_files/db_translate_admin_store.php | 4 +- .../Block/Catalog/Category/TreeTest.php | 2 +- .../Block/Catalog/Product/GridTest.php | 2 +- .../UrlRewrite/Block/Cms/Page/GridTest.php | 2 +- .../UrlRewrite/Block/Edit/FormTest.php | 12 +- .../testsuite/Magento/Weee/Model/TaxTest.php | 2 +- .../Widget/Instance/Edit/Tab/MainTest.php | 2 +- .../Widget/Model/Widget/ConfigTest.php | 4 +- .../Customer/Wishlist/Item/OptionsTest.php | 4 +- .../Magento/Wishlist/_files/wishlist.php | 2 +- .../Wishlist/_files/wishlist_shared.php | 2 +- .../CodingStandard/Tool/CodeMessDetector.php | 8 +- .../Tool/CodeMessDetectorTest.php | 13 +- .../Test/Integrity/Di/CompilerTest.php | 4 +- .../Model/Fieldset/FieldsetConfigTest.php | 10 +- .../Core/Model/Fieldset/_files/fieldset.xml | 2 +- .../Model/Fieldset/_files/fieldset_file.xml | 2 +- .../Fieldset/_files/invalid_fieldset.xml | 2 +- .../Integrity/_files/blacklist/reference.txt | 4 +- .../Test/Legacy/_files/obsolete_classes.php | 26 +- .../Test/Legacy/_files/obsolete_methods.php | 24 +- .../Legacy/_files/obsolete_namespaces.php | 5 +- .../Legacy/_files/obsolete_properties.php | 10 +- .../Php/_files/phpcpd/blacklist/common.txt | 1 - .../Test/Unit/Acl/Db/Adapter/FactoryTest.php | 2 +- .../Magento/Framework/App/Cache/TypeList.php | 2 +- .../Framework/App/Config/ScopePool.php | 4 +- .../Framework/App/ObjectManagerFactory.php | 4 +- .../App/Test/Unit/Cache/TypeListTest.php | 4 +- .../App/Test/Unit/PageCache/KernelTest.php | 4 +- .../App/Test/Unit/ScopeResolverPoolTest.php | 2 +- .../Unit/Generator/EntityAbstractTest.php | 4 +- .../Framework/Controller/Noroute/Index.php | 4 +- .../Test/Unit/Controller/NorouteTest.php | 2 +- .../Magento/Framework/Convert/Object.php | 144 - .../Convert/Test/Unit/ObjectTest.php | 18 +- .../Magento/Framework/DB/AbstractMapper.php | 2 +- .../Framework/DB/Adapter/Pdo/Mysql.php | 6 +- .../Magento/Framework/DB/Logger/Null.php | 37 - .../Framework/DB/Statement/Parameter.php | 10 +- .../DB/Test/Unit/Adapter/Pdo/MysqlTest.php | 2 +- .../DB/Test/Unit/Logger/FileTest.php | 2 +- .../Framework/Data/AbstractCriteria.php | 4 +- .../Framework/Data/AbstractSearchResult.php | 16 +- .../Data/Argument/Interpreter/Object.php | 43 - .../Data/Argument/Interpreter/String.php | 50 - .../Magento/Framework/Data/Collection.php | 36 +- .../Framework/Data/Collection/AbstractDb.php | 10 +- .../Data/Collection/EntityFactory.php | 2 +- .../Framework/Data/Collection/Filesystem.php | 2 +- .../Magento/Framework/Data/DataArray.php | 2 +- .../Framework/Data/Form/AbstractForm.php | 2 +- .../Framework/Data/Form/Element/Editor.php | 4 +- .../Framework/Data/Form/Element/Radios.php | 2 +- .../Magento/Framework/Data/ObjectFactory.php | 2 +- .../Magento/Framework/Data/Schema.php | 2 +- .../Framework/Data/SearchResultInterface.php | 2 +- .../Framework/Data/SearchResultProcessor.php | 10 +- .../Data/SearchResultProcessorInterface.php | 8 +- .../Data/Test/Unit/AbstractCriteriaTest.php | 2 +- .../Test/Unit/AbstractSearchResultTest.php | 4 +- .../Data/Test/Unit/Collection/DbTest.php | 8 +- .../Data/Test/Unit/CollectionTest.php | 22 +- .../Unit/Form/Element/AbstractElementTest.php | 2 +- .../Test/Unit/Form/Element/ButtonTest.php | 2 +- .../Test/Unit/Form/Element/CheckboxTest.php | 2 +- .../Test/Unit/Form/Element/ColumnTest.php | 2 +- .../Form/Element/EditablemultiselectTest.php | 2 +- .../Test/Unit/Form/Element/EditorTest.php | 8 +- .../Data/Test/Unit/Form/Element/FileTest.php | 2 +- .../Test/Unit/Form/Element/HiddenTest.php | 2 +- .../Data/Test/Unit/Form/Element/ImageTest.php | 2 +- .../Data/Test/Unit/Form/Element/LinkTest.php | 2 +- .../Unit/Form/Element/MultiselectTest.php | 2 +- .../Data/Test/Unit/Form/Element/NoteTest.php | 2 +- .../Test/Unit/Form/Element/ObscureTest.php | 2 +- .../Test/Unit/Form/Element/PasswordTest.php | 2 +- .../Data/Test/Unit/Form/Element/RadioTest.php | 2 +- .../Data/Test/Unit/Form/Element/ResetTest.php | 2 +- .../Test/Unit/Form/Element/SubmitTest.php | 2 +- .../Data/Test/Unit/Form/Element/TextTest.php | 2 +- .../Test/Unit/Form/Element/TextareaTest.php | 2 +- .../Data/Test/Unit/Helper/PostHelperTest.php | 4 +- .../Test/Unit/SearchResultProcessorTest.php | 24 +- .../Magento/Framework/Data/Tree/Node.php | 2 +- lib/internal/Magento/Framework/Event.php | 2 +- .../Magento/Framework/Event/Observer.php | 10 +- .../Magento/Framework/Filesystem/Io/Sftp.php | 1 - .../Magento/Framework/Filter/Factory.php | 2 +- .../Magento/Framework/Filter/Object.php | 66 - .../Magento/Framework/Filter/Object/Grid.php | 26 - .../Magento/Framework/Filter/Template.php | 8 +- .../Framework/Filter/Template/Simple.php | 2 +- .../Filter/Test/Unit/Object/GridTest.php | 12 +- .../Filter/Test/Unit/TemplateTest.php | 6 +- .../Filter/Test/Unit/TruncateTest.php | 4 +- .../Magento/Framework/Filter/Translit.php | 2 +- .../Magento/Framework/Filter/Truncate.php | 6 +- .../Magento/Framework/HTTP/Header.php | 6 +- .../Framework/HTTP/Test/Unit/HeaderTest.php | 4 +- .../Framework/Locale/Bundle/DataBundle.php | 28 +- .../Magento/Framework/Locale/Currency.php | 2 +- .../Locale/Test/Unit/TranslatedListsTest.php | 12 +- .../Framework/Locale/TranslatedLists.php | 5 +- .../Magento/Framework/Model/AbstractModel.php | 4 +- .../Model/Resource/AbstractResource.php | 12 +- .../Model/Resource/Db/AbstractDb.php | 12 +- .../Resource/Db/VersionControl/Collection.php | 2 +- .../Resource/Db/VersionControl/Metadata.php | 4 +- .../Resource/Db/VersionControl/Snapshot.php | 8 +- .../Framework/Model/Resource/Iterator.php | 2 +- .../Model/Resource/Type/Db/Pdo/Mysql.php | 6 +- .../Test/Unit/AbstractExtensibleModelTest.php | 6 +- .../Model/Test/Unit/AbstractModelTest.php | 10 +- .../Db/Collection/AbstractCollectionTest.php | 14 +- .../Unit/Resource/Type/Db/Pdo/MysqlTest.php | 4 +- lib/internal/Magento/Framework/Module/Dir.php | 4 +- .../Magento/Framework/Module/PackageInfo.php | 10 +- .../Framework/Module/Test/Unit/DirTest.php | 4 +- .../Module/Test/Unit/PackageInfoTest.php | 2 +- lib/internal/Magento/Framework/Mview/View.php | 2 +- lib/internal/Magento/Framework/Object.php | 541 --- .../Magento/Framework/Object/Cache.php | 476 --- .../Magento/Framework/Object/Copy.php | 186 - .../Magento/Framework/Object/Copy/Config.php | 49 - .../Object/Copy/Config/Converter.php | 87 - .../Framework/Object/Copy/Config/Data.php | 12 - .../Object/Copy/Config/Data/Proxy.php | 124 - .../Framework/Object/Copy/Config/Reader.php | 55 - .../Object/Copy/Config/SchemaLocator.php | 60 - .../Magento/Framework/Object/Factory.php | 20 - .../Framework/Object/IdentityInterface.php | 21 - .../Object/KeyValueObjectInterface.php | 43 - .../Magento/Framework/Object/Mapper.php | 132 - .../Magento/Framework/Object/README.md | 4 - .../Framework/Object/Test/Unit/CacheTest.php | 143 - .../Test/Unit/Copy/Config/ConverterTest.php | 32 - .../Unit/Copy/Config/SchemaLocatorTest.php | 54 - .../Test/Unit/Copy/Config/_files/fieldset.xml | 24 - .../Copy/Config/_files/fieldset_config.php | 14 - .../Object/Test/Unit/Copy/ConfigTest.php | 65 - .../Framework/Object/Test/Unit/CopyTest.php | 218 - .../Framework/Object/Test/Unit/MapperTest.php | 83 - .../Magento/Framework/Object/etc/fieldset.xsd | 69 - .../Framework/Object/etc/fieldset_file.xsd | 69 - .../Test/Unit/Helper/CompositeTest.php | 8 +- .../Test/Unit/Adjustment/FactoryTest.php | 2 +- .../Test/Unit/AttributeTypeResolverTest.php | 8 +- .../Search/Adapter/Mysql/Filter/Builder.php | 7 +- .../Framework/Search/Adapter/Mysql/Mapper.php | 2 +- .../Adapter/Mysql/Query/Builder/Match.php | 6 +- .../Framework/Search/Request/Filter/Bool.php | 105 - .../Framework/Search/Request/Mapper.php | 4 +- .../Framework/Search/Request/Query/Bool.php | 128 - .../Unit/Adapter/Mysql/Filter/BuilderTest.php | 10 +- .../Test/Unit/Adapter/Mysql/MapperTest.php | 6 +- .../Adapter/Mysql/Query/Builder/MatchTest.php | 4 +- .../Mysql/Query/QueryContainerTest.php | 15 +- .../Search/Test/Unit/Request/MapperTest.php | 10 +- .../Magento/Framework/Session/Config.php | 6 +- .../Framework/Session/SessionManager.php | 7 +- .../Magento/Framework/Session/Storage.php | 2 +- .../Framework/Setup/Test/Unit/ListsTest.php | 6 - .../Simplexml/Config/Cache/AbstractCache.php | 2 +- .../Magento/Framework/Stdlib/ArrayUtils.php | 6 +- .../Magento/Framework/Stdlib/String.php | 215 - .../Stdlib/Test/Unit/ArrayUtilsTest.php | 14 +- .../Unit/Cookie/PublicCookieMetadataTest.php | 10 +- .../Cookie/SensitiveCookieMetadataTest.php | 10 +- .../Framework/Stdlib/Test/Unit/StringTest.php | 125 - .../Framework/Test/Unit/ObjectTest.php | 52 +- .../Framework/Test/Unit/TranslateTest.php | 6 +- .../Test/Unit/ValidatorFactoryTest.php | 2 +- .../Framework/Test/Unit/ValidatorTest.php | 4 +- lib/internal/Magento/Framework/Url.php | 2 +- .../Framework/Url/QueryParamsResolver.php | 2 +- .../Url/QueryParamsResolverInterface.php | 2 +- .../Framework/Url/RouteParamsResolver.php | 2 +- .../Url/Test/Unit/Helper/DataTest.php | 2 +- .../Framework/Validator/Constraint.php | 2 +- .../Validator/Constraint/Property.php | 4 +- .../Framework/Validator/Entity/Properties.php | 6 +- .../Magento/Framework/Validator/Float.php | 12 - .../Magento/Framework/Validator/Int.php | 12 - .../Magento/Framework/Validator/Object.php | 84 - .../Validator/Test/Unit/ConfigTest.php | 8 +- .../Test/Unit/Constraint/PropertyTest.php | 2 +- .../Test/Unit/Entity/PropertiesTest.php | 2 +- .../Validator/Test/Unit/ObjectTest.php | 10 +- .../Validator/Test/Unit/Test/Int.php | 14 - .../Validator/Test/Unit/Test/True.php | 26 - .../positive/module_a/validation.xml | 6 +- .../Magento/Framework/View/Asset/Bundle.php | 3 +- .../Framework/View/Design/Theme/Validator.php | 4 +- .../Framework/View/Element/AbstractBlock.php | 2 +- .../Framework/View/Element/Messages.php | 4 +- .../Framework/View/Element/Template.php | 4 +- .../Element/UiComponent/ContentType/Xml.php | 4 +- .../View/Element/UiComponentFactory.php | 4 +- .../Magento/Framework/View/Layout.php | 4 +- .../Layout/Argument/Interpreter/Object.php | 56 - .../Framework/View/Layout/PageType/Config.php | 4 +- .../Framework/View/Page/Config/Renderer.php | 6 +- .../View/TemplateEngine/Xhtml/Compiler.php | 8 +- .../Xhtml/Compiler/Attribute.php | 6 +- .../Xhtml/Compiler/AttributeInterface.php | 6 +- .../TemplateEngine/Xhtml/Compiler/Cdata.php | 6 +- .../Xhtml/Compiler/CdataInterface.php | 6 +- .../TemplateEngine/Xhtml/Compiler/Comment.php | 6 +- .../Xhtml/Compiler/CommentInterface.php | 6 +- .../Compiler/Directive/CallableMethod.php | 6 +- .../Compiler/Directive/DirectiveInterface.php | 6 +- .../Xhtml/Compiler/Directive/Variable.php | 6 +- .../Compiler/Element/ElementInterface.php | 13 +- .../TemplateEngine/Xhtml/Compiler/Text.php | 6 +- .../Xhtml/Compiler/TextInterface.php | 6 +- .../Xhtml/CompilerInterface.php | 4 +- .../View/Test/Unit/Element/TemplateTest.php | 2 +- .../Argument/Interpreter/ObjectTest.php | 6 +- .../Test/Unit/Layout/Reader/FactoryTest.php | 4 +- .../Test/Unit/Page/Config/RendererTest.php | 4 +- .../View/Test/Unit/TemplateEngine/PhpTest.php | 2 +- .../Magento/Framework/Webapi/Rest/Request.php | 7 +- .../Webapi/Rest/Response/Renderer/Xml.php | 4 +- .../Webapi/Test/Unit/Rest/RequestTest.php | 2 +- .../Unit/Rest/Response/Renderer/XmlTest.php | 4 +- .../Rest/Response/RendererFactoryTest.php | 4 +- lib/internal/phpseclib/Crypt/AES.php | 479 --- lib/internal/phpseclib/Crypt/DES.php | 945 ----- lib/internal/phpseclib/Crypt/Hash.php | 816 ---- lib/internal/phpseclib/Crypt/RC4.php | 493 --- lib/internal/phpseclib/Crypt/RSA.php | 2119 ---------- lib/internal/phpseclib/Crypt/Random.php | 129 - lib/internal/phpseclib/Crypt/Rijndael.php | 1242 ------ lib/internal/phpseclib/Crypt/TripleDES.php | 690 ---- lib/internal/phpseclib/Math/BigInteger.php | 3545 ----------------- lib/internal/phpseclib/Net/SFTP.php | 1461 ------- lib/internal/phpseclib/Net/SSH1.php | 1159 ------ lib/internal/phpseclib/Net/SSH2.php | 2302 ----------- .../PHP/Compat/Function/array_fill.php | 41 - .../PHP/Compat/Function/bcpowmod.php | 66 - .../PHP/Compat/Function/str_split.php | 59 - setup/config/di.config.php | 2 +- .../Command/AdminUserCreateCommand.php | 4 +- .../Setup/Controller/DatabaseCheck.php | 3 +- .../src/Magento/Setup/Controller/Install.php | 23 +- .../src/Magento/Setup/Controller/Modules.php | 10 +- .../Setup/Module/ConnectionFactory.php | 4 +- .../Unit/Controller/DatabaseCheckTest.php | 60 - .../Test/Unit/Controller/InstallTest.php | 3 +- .../Test/Unit/Controller/ModulesTest.php | 9 - .../Setup/Test/Unit/Model/WebLoggerTest.php | 10 +- .../I18n/Parser/Adapter/Php/TokenizerTest.php | 2 +- .../Adapter/Php/_files/objectsCode.php.txt | 2 +- 1353 files changed, 3950 insertions(+), 23612 deletions(-) delete mode 100644 app/code/Magento/Backend/Model/Resource/Translate/String.php delete mode 100644 app/code/Magento/Translation/Model/Resource/String.php delete mode 100644 app/code/Magento/Translation/Model/String.php delete mode 100644 dev/tests/integration/testsuite/Magento/Framework/Data/Argument/Interpreter/StringTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Framework/Object/Copy/Config/ReaderTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Framework/Object/Copy/Config/_files/expectedArray.php delete mode 100644 dev/tests/integration/testsuite/Magento/Framework/Object/Copy/Config/_files/fieldset.xml delete mode 100644 dev/tests/integration/testsuite/Magento/Framework/Object/Copy/Config/_files/partialFieldsetFirst.xml delete mode 100644 dev/tests/integration/testsuite/Magento/Framework/Object/Copy/Config/_files/partialFieldsetSecond.xml delete mode 100644 dev/tests/integration/testsuite/Magento/Framework/Object/CopyTest.php delete mode 100644 lib/internal/Magento/Framework/Convert/Object.php delete mode 100644 lib/internal/Magento/Framework/DB/Logger/Null.php delete mode 100644 lib/internal/Magento/Framework/Data/Argument/Interpreter/Object.php delete mode 100644 lib/internal/Magento/Framework/Data/Argument/Interpreter/String.php delete mode 100644 lib/internal/Magento/Framework/Filter/Object.php delete mode 100644 lib/internal/Magento/Framework/Filter/Object/Grid.php delete mode 100644 lib/internal/Magento/Framework/Object.php delete mode 100644 lib/internal/Magento/Framework/Object/Cache.php delete mode 100644 lib/internal/Magento/Framework/Object/Copy.php delete mode 100644 lib/internal/Magento/Framework/Object/Copy/Config.php delete mode 100644 lib/internal/Magento/Framework/Object/Copy/Config/Converter.php delete mode 100644 lib/internal/Magento/Framework/Object/Copy/Config/Data.php delete mode 100644 lib/internal/Magento/Framework/Object/Copy/Config/Data/Proxy.php delete mode 100644 lib/internal/Magento/Framework/Object/Copy/Config/Reader.php delete mode 100644 lib/internal/Magento/Framework/Object/Copy/Config/SchemaLocator.php delete mode 100644 lib/internal/Magento/Framework/Object/Factory.php delete mode 100644 lib/internal/Magento/Framework/Object/IdentityInterface.php delete mode 100644 lib/internal/Magento/Framework/Object/KeyValueObjectInterface.php delete mode 100644 lib/internal/Magento/Framework/Object/Mapper.php delete mode 100644 lib/internal/Magento/Framework/Object/README.md delete mode 100644 lib/internal/Magento/Framework/Object/Test/Unit/CacheTest.php delete mode 100644 lib/internal/Magento/Framework/Object/Test/Unit/Copy/Config/ConverterTest.php delete mode 100644 lib/internal/Magento/Framework/Object/Test/Unit/Copy/Config/SchemaLocatorTest.php delete mode 100644 lib/internal/Magento/Framework/Object/Test/Unit/Copy/Config/_files/fieldset.xml delete mode 100644 lib/internal/Magento/Framework/Object/Test/Unit/Copy/Config/_files/fieldset_config.php delete mode 100644 lib/internal/Magento/Framework/Object/Test/Unit/Copy/ConfigTest.php delete mode 100644 lib/internal/Magento/Framework/Object/Test/Unit/CopyTest.php delete mode 100644 lib/internal/Magento/Framework/Object/Test/Unit/MapperTest.php delete mode 100644 lib/internal/Magento/Framework/Object/etc/fieldset.xsd delete mode 100644 lib/internal/Magento/Framework/Object/etc/fieldset_file.xsd delete mode 100644 lib/internal/Magento/Framework/Search/Request/Filter/Bool.php delete mode 100644 lib/internal/Magento/Framework/Search/Request/Query/Bool.php delete mode 100644 lib/internal/Magento/Framework/Stdlib/String.php delete mode 100644 lib/internal/Magento/Framework/Stdlib/Test/Unit/StringTest.php delete mode 100644 lib/internal/Magento/Framework/Validator/Float.php delete mode 100644 lib/internal/Magento/Framework/Validator/Int.php delete mode 100644 lib/internal/Magento/Framework/Validator/Object.php delete mode 100644 lib/internal/Magento/Framework/Validator/Test/Unit/Test/Int.php delete mode 100644 lib/internal/Magento/Framework/Validator/Test/Unit/Test/True.php delete mode 100644 lib/internal/Magento/Framework/View/Layout/Argument/Interpreter/Object.php delete mode 100644 lib/internal/phpseclib/Crypt/AES.php delete mode 100644 lib/internal/phpseclib/Crypt/DES.php delete mode 100644 lib/internal/phpseclib/Crypt/Hash.php delete mode 100644 lib/internal/phpseclib/Crypt/RC4.php delete mode 100644 lib/internal/phpseclib/Crypt/RSA.php delete mode 100644 lib/internal/phpseclib/Crypt/Random.php delete mode 100644 lib/internal/phpseclib/Crypt/Rijndael.php delete mode 100644 lib/internal/phpseclib/Crypt/TripleDES.php delete mode 100644 lib/internal/phpseclib/Math/BigInteger.php delete mode 100644 lib/internal/phpseclib/Net/SFTP.php delete mode 100644 lib/internal/phpseclib/Net/SSH1.php delete mode 100644 lib/internal/phpseclib/Net/SSH2.php delete mode 100644 lib/internal/phpseclib/PHP/Compat/Function/array_fill.php delete mode 100644 lib/internal/phpseclib/PHP/Compat/Function/bcpowmod.php delete mode 100644 lib/internal/phpseclib/PHP/Compat/Function/str_split.php delete mode 100644 setup/src/Magento/Setup/Test/Unit/Controller/DatabaseCheckTest.php diff --git a/.php_cs b/.php_cs index 7f5e43f9d4f..9c9aeb442fe 100644 --- a/.php_cs +++ b/.php_cs @@ -19,7 +19,6 @@ $finder = Symfony\CS\Finder\DefaultFinder::create() ->exclude('lib/internal/Credis') ->exclude('lib/internal/Less') ->exclude('lib/internal/LinLibertineFont') - ->exclude('lib/internal/phpseclib') ->exclude('pub/media') ->exclude('pub/static') ->exclude('setup/vendor') diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php index 0b623434277..836f6159573 100644 --- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php +++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php @@ -34,10 +34,10 @@ class Actions extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstrac /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $readDetailsHtml = $row->getUrl() ? '<a class="action-details" target="_blank" href="' . $row->getUrl() . '">' . __( 'Read Details' diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php index 6bd75655b5b..d136a4170ad 100644 --- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php +++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Notice.php @@ -12,10 +12,10 @@ class Notice extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstract /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { return '<span class="grid-row-title">' . $row->getTitle() . diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php index 878d545bf8c..0bf6d9a06fc 100644 --- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php +++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Severity.php @@ -33,10 +33,10 @@ class Severity extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $class = ''; $value = ''; diff --git a/app/code/Magento/Authorization/Model/Resource/Rules.php b/app/code/Magento/Authorization/Model/Resource/Rules.php index e298055e8fc..59d6366424c 100644 --- a/app/code/Magento/Authorization/Model/Resource/Rules.php +++ b/app/code/Magento/Authorization/Model/Resource/Rules.php @@ -99,7 +99,7 @@ class Rules extends \Magento\Framework\Model\Resource\Db\AbstractDb // If all was selected save it only and nothing else. if ($postedResources === [$this->_rootResource->getId()]) { - $insertData = $this->_prepareDataForTable(new \Magento\Framework\Object($row), $this->getMainTable()); + $insertData = $this->_prepareDataForTable(new \Magento\Framework\DataObject($row), $this->getMainTable()); $adapter->insert($this->getMainTable(), $insertData); } else { @@ -109,7 +109,7 @@ class Rules extends \Magento\Framework\Model\Resource\Db\AbstractDb $row['permission'] = in_array($resourceId, $postedResources) ? 'allow' : 'deny'; $row['resource_id'] = $resourceId; - $insertData = $this->_prepareDataForTable(new \Magento\Framework\Object($row), $this->getMainTable()); + $insertData = $this->_prepareDataForTable(new \Magento\Framework\DataObject($row), $this->getMainTable()); $adapter->insert($this->getMainTable(), $insertData); } } diff --git a/app/code/Magento/Authorizenet/Controller/Directpost/Payment/Place.php b/app/code/Magento/Authorizenet/Controller/Directpost/Payment/Place.php index 64c63ca4a11..2cb3ea54210 100644 --- a/app/code/Magento/Authorizenet/Controller/Directpost/Payment/Place.php +++ b/app/code/Magento/Authorizenet/Controller/Directpost/Payment/Place.php @@ -11,7 +11,7 @@ use Magento\Checkout\Model\Type\Onepage; use Magento\Framework\App\Action\Context; use Magento\Framework\App\Response\Http; use Magento\Framework\Json\Helper\Data as JsonHelper; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\Registry; use Magento\Payment\Model\IframeConfigProvider; use Magento\Quote\Api\CartManagementInterface; @@ -113,7 +113,7 @@ class Place extends Payment */ protected function placeCheckoutOrder() { - $result = new Object(); + $result = new DataObject(); $response = $this->getResponse(); try { $this->cartManagement->placeOrder($this->_getCheckout()->getQuote()->getId()); diff --git a/app/code/Magento/Authorizenet/Helper/Data.php b/app/code/Magento/Authorizenet/Helper/Data.php index ae9e7b55ffb..dd7054a4d43 100644 --- a/app/code/Magento/Authorizenet/Helper/Data.php +++ b/app/code/Magento/Authorizenet/Helper/Data.php @@ -188,7 +188,7 @@ class Data extends AbstractHelper * @param \Magento\Payment\Model\InfoInterface $payment * @param string $requestType * @param string $lastTransactionId - * @param \Magento\Framework\Object $card + * @param \Magento\Framework\DataObject $card * @param bool|float $amount * @param bool|string $exception * @param bool|string $additionalMessage diff --git a/app/code/Magento/Authorizenet/Model/Authorizenet.php b/app/code/Magento/Authorizenet/Model/Authorizenet.php index a10f6ef75a2..745d3b04812 100644 --- a/app/code/Magento/Authorizenet/Model/Authorizenet.php +++ b/app/code/Magento/Authorizenet/Model/Authorizenet.php @@ -194,13 +194,13 @@ abstract class Authorizenet extends \Magento\Payment\Model\Method\Cc * Fetch fraud details * * @param string $transactionId - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject * @throws \Magento\Framework\Exception\LocalizedException */ public function fetchTransactionFraudDetails($transactionId) { $responseXmlDocument = $this->getTransactionDetails($transactionId); - $response = new \Magento\Framework\Object(); + $response = new \Magento\Framework\DataObject(); if (empty($responseXmlDocument->transaction->FDSFilters->FDSFilter)) { return $response; @@ -257,14 +257,14 @@ abstract class Authorizenet extends \Magento\Payment\Model\Method\Cc /** * Prepare request to gateway * - * @param \Magento\Framework\Object|\Magento\Payment\Model\InfoInterface $payment + * @param \Magento\Framework\DataObject|\Magento\Payment\Model\InfoInterface $payment * @return \Magento\Authorizenet\Model\Request * @link http://www.authorize.net/support/AIM_guide.pdf * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - protected function buildRequest(\Magento\Framework\Object $payment) + protected function buildRequest(\Magento\Framework\DataObject $payment) { /** @var \Magento\Sales\Model\Order $order */ $order = $payment->getOrder(); @@ -435,7 +435,7 @@ abstract class Authorizenet extends \Magento\Payment\Model\Method\Cc * This function returns full transaction details for a specified transaction ID. * * @param string $transactionId - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject * @throws \Magento\Framework\Exception\LocalizedException * @link http://www.authorize.net/support/ReportingGuide_XML.pdf * @link http://developer.authorize.net/api/transaction_details/ @@ -444,7 +444,7 @@ abstract class Authorizenet extends \Magento\Payment\Model\Method\Cc { $responseXmlDocument = $this->getTransactionDetails($transactionId); - $response = new \Magento\Framework\Object(); + $response = new \Magento\Framework\DataObject(); $response->setXResponseCode((string)$responseXmlDocument->transaction->responseCode) ->setXResponseReasonCode((string)$responseXmlDocument->transaction->responseReasonCode) ->setTransactionStatus((string)$responseXmlDocument->transaction->transactionStatus); diff --git a/app/code/Magento/Authorizenet/Model/Directpost.php b/app/code/Magento/Authorizenet/Model/Directpost.php index 0cad66109e7..41fac85a43d 100644 --- a/app/code/Magento/Authorizenet/Model/Directpost.php +++ b/app/code/Magento/Authorizenet/Model/Directpost.php @@ -205,7 +205,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet implements Tra /** * Send authorize request to gateway * - * @param \Magento\Framework\Object|\Magento\Payment\Model\InfoInterface $payment + * @param \Magento\Framework\DataObject|\Magento\Payment\Model\InfoInterface $payment * @param float $amount * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) @@ -218,7 +218,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet implements Tra /** * Send capture request to gateway * - * @param \Magento\Framework\Object|\Magento\Payment\Model\InfoInterface $payment + * @param \Magento\Framework\DataObject|\Magento\Payment\Model\InfoInterface $payment * @param float $amount * @return $this * @throws \Magento\Framework\Exception\LocalizedException @@ -298,7 +298,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet implements Tra /** * Void the payment through gateway * - * @param \Magento\Framework\Object|\Magento\Payment\Model\InfoInterface $payment + * @param \Magento\Framework\DataObject|\Magento\Payment\Model\InfoInterface $payment * @return $this * @throws \Magento\Framework\Exception\LocalizedException */ @@ -342,7 +342,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet implements Tra * Refund the amount * Need to decode last 4 digits for request. * - * @param \Magento\Framework\Object|\Magento\Payment\Model\InfoInterface $payment + * @param \Magento\Framework\DataObject|\Magento\Payment\Model\InfoInterface $payment * @param float $amount * @return $this * @throws \Exception @@ -364,12 +364,12 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet implements Tra /** * Refund the amount with transaction id * - * @param \Magento\Framework\Object $payment + * @param \Magento\Framework\DataObject $payment * @param float $amount * @return $this * @throws \Magento\Framework\Exception\LocalizedException */ - protected function processRefund(\Magento\Framework\Object $payment, $amount) + protected function processRefund(\Magento\Framework\DataObject $payment, $amount) { if ($amount <= 0) { throw new \Magento\Framework\Exception\LocalizedException(__('Invalid amount for refund.')); @@ -450,7 +450,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet implements Tra * Instantiate state and set it to state object * * @param string $paymentAction - * @param \Magento\Framework\Object $stateObject + * @param \Magento\Framework\DataObject $stateObject * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -580,10 +580,10 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet implements Tra /** * Fill payment with credit card data from response from Authorize.net. * - * @param \Magento\Framework\Object $payment + * @param \Magento\Framework\DataObject $payment * @return void */ - protected function fillPaymentByResponse(\Magento\Framework\Object $payment) + protected function fillPaymentByResponse(\Magento\Framework\DataObject $payment) { $response = $this->getResponse(); $payment->setTransactionId($response->getXTransId()) @@ -870,13 +870,13 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet implements Tra /** * @param \Magento\Sales\Model\Order\Payment $payment - * @param \Magento\Framework\Object $response + * @param \Magento\Framework\DataObject $response * @param string $transactionId * @return $this */ protected function addStatusCommentOnUpdate( \Magento\Sales\Model\Order\Payment $payment, - \Magento\Framework\Object $response, + \Magento\Framework\DataObject $response, $transactionId ) { if ($payment->getIsTransactionApproved()) { diff --git a/app/code/Magento/Authorizenet/Model/Request.php b/app/code/Magento/Authorizenet/Model/Request.php index df2be82cbe1..e188dd4d372 100644 --- a/app/code/Magento/Authorizenet/Model/Request.php +++ b/app/code/Magento/Authorizenet/Model/Request.php @@ -5,11 +5,11 @@ */ namespace Magento\Authorizenet\Model; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Request object */ -class Request extends Object +class Request extends DataObject { } diff --git a/app/code/Magento/Authorizenet/Model/Response.php b/app/code/Magento/Authorizenet/Model/Response.php index d2247516361..0c122e9ab83 100644 --- a/app/code/Magento/Authorizenet/Model/Response.php +++ b/app/code/Magento/Authorizenet/Model/Response.php @@ -5,11 +5,11 @@ */ namespace Magento\Authorizenet\Model; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Response object */ -class Response extends Object +class Response extends DataObject { } diff --git a/app/code/Magento/Authorizenet/Test/Unit/Controller/Directpost/Payment/PlaceTest.php b/app/code/Magento/Authorizenet/Test/Unit/Controller/Directpost/Payment/PlaceTest.php index af25f301b31..517b9e41f7d 100644 --- a/app/code/Magento/Authorizenet/Test/Unit/Controller/Directpost/Payment/PlaceTest.php +++ b/app/code/Magento/Authorizenet/Test/Unit/Controller/Directpost/Payment/PlaceTest.php @@ -251,7 +251,7 @@ class PlaceTest extends \PHPUnit_Framework_TestCase */ public function textExecuteDataProvider() { - $objectSuccess = new \Magento\Framework\Object(); + $objectSuccess = new \Magento\Framework\DataObject(); $objectSuccess->setData('success', true); return [ @@ -277,7 +277,7 @@ class PlaceTest extends \PHPUnit_Framework_TestCase */ public function textExecuteFailedPlaceOrderDataProvider() { - $objectFailed = new \Magento\Framework\Object(); + $objectFailed = new \Magento\Framework\DataObject(); $objectFailed->setData('error', true); $objectFailed->setData('error_messages', __('Cannot place order.')); diff --git a/app/code/Magento/Authorizenet/Test/Unit/Helper/DataTest.php b/app/code/Magento/Authorizenet/Test/Unit/Helper/DataTest.php index b444dfb68c0..c42db46e70a 100644 --- a/app/code/Magento/Authorizenet/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/Authorizenet/Test/Unit/Helper/DataTest.php @@ -62,7 +62,7 @@ class DataTest extends \PHPUnit_Framework_TestCase $payment->expects($this->any()) ->method('getOrder') ->will($this->returnValue($order)); - $card = new \Magento\Framework\Object(['cc_last_4' => self::LAST4]); + $card = new \Magento\Framework\DataObject(['cc_last_4' => self::LAST4]); $message = $this->dataHelper->getTransactionMessage( $payment, $type, diff --git a/app/code/Magento/Authorizenet/Test/Unit/Model/Directpost/ObserverTest.php b/app/code/Magento/Authorizenet/Test/Unit/Model/Directpost/ObserverTest.php index 3640a46c577..4230c2a2f42 100644 --- a/app/code/Magento/Authorizenet/Test/Unit/Model/Directpost/ObserverTest.php +++ b/app/code/Magento/Authorizenet/Test/Unit/Model/Directpost/ObserverTest.php @@ -53,7 +53,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase protected $actionMock; /** - * @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject */ protected $resultMock; @@ -85,7 +85,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->actionMock = $this->getMockBuilder('Magento\Checkout\Controller\Onepage\SaveOrder') ->disableOriginalConstructor() ->getMock(); - $this->resultMock = $this->getMockBuilder('Magento\Framework\Object') + $this->resultMock = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Backend/Block/Dashboard/Searches/Renderer/Searchquery.php b/app/code/Magento/Backend/Block/Dashboard/Searches/Renderer/Searchquery.php index cfb4538ff72..46bfdd1129f 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Searches/Renderer/Searchquery.php +++ b/app/code/Magento/Backend/Block/Dashboard/Searches/Renderer/Searchquery.php @@ -13,18 +13,18 @@ class Searchquery extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abs /** * String helper * - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $stringHelper; /** * @param \Magento\Backend\Block\Context $context - * @param \Magento\Framework\Stdlib\String $stringHelper + * @param \Magento\Framework\Stdlib\StringUtils $stringHelper * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, - \Magento\Framework\Stdlib\String $stringHelper, + \Magento\Framework\Stdlib\StringUtils $stringHelper, array $data = [] ) { $this->stringHelper = $stringHelper; @@ -34,10 +34,10 @@ class Searchquery extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abs /** * Renders a column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $value = $row->getData($this->getColumn()->getIndex()); if ($this->stringHelper->strlen($value) > 30) { diff --git a/app/code/Magento/Backend/Block/Media/Uploader.php b/app/code/Magento/Backend/Block/Media/Uploader.php index 8db7bcf7ef2..089295ecc8d 100644 --- a/app/code/Magento/Backend/Block/Media/Uploader.php +++ b/app/code/Magento/Backend/Block/Media/Uploader.php @@ -11,7 +11,7 @@ namespace Magento\Backend\Block\Media; class Uploader extends \Magento\Backend\Block\Widget { /** - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $_config; @@ -111,12 +111,12 @@ class Uploader extends \Magento\Backend\Block\Widget /** * Retrieve config object * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getConfig() { if (null === $this->_config) { - $this->_config = new \Magento\Framework\Object(); + $this->_config = new \Magento\Framework\DataObject(); } return $this->_config; diff --git a/app/code/Magento/Backend/Block/System/Store/Grid/Render/Group.php b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Group.php index 79354f37247..ca13a598b10 100644 --- a/app/code/Magento/Backend/Block/System/Store/Grid/Render/Group.php +++ b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Group.php @@ -15,7 +15,7 @@ class Group extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractR /** * {@inheritdoc} */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { if (!$row->getData($this->getColumn()->getIndex())) { return null; diff --git a/app/code/Magento/Backend/Block/System/Store/Grid/Render/Store.php b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Store.php index 5a5f54be718..728cb8040b4 100644 --- a/app/code/Magento/Backend/Block/System/Store/Grid/Render/Store.php +++ b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Store.php @@ -15,7 +15,7 @@ class Store extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractR /** * {@inheritdoc} */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { if (!$row->getData($this->getColumn()->getIndex())) { return null; diff --git a/app/code/Magento/Backend/Block/System/Store/Grid/Render/Website.php b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Website.php index 11c7c051e82..01c1bc00a22 100644 --- a/app/code/Magento/Backend/Block/System/Store/Grid/Render/Website.php +++ b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Website.php @@ -15,7 +15,7 @@ class Website extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstrac /** * {@inheritdoc} */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { return '<a title="' . __( 'Edit Web Site' diff --git a/app/code/Magento/Backend/Block/Widget/Button/Item.php b/app/code/Magento/Backend/Block/Widget/Button/Item.php index 525d75f289c..a500f836312 100644 --- a/app/code/Magento/Backend/Block/Widget/Button/Item.php +++ b/app/code/Magento/Backend/Block/Widget/Button/Item.php @@ -14,7 +14,7 @@ namespace Magento\Backend\Block\Widget\Button; * @method int getSortOrder * @method string getTitle */ -class Item extends \Magento\Framework\Object +class Item extends \Magento\Framework\DataObject { /** * Object delete flag diff --git a/app/code/Magento/Backend/Block/Widget/Form/Container.php b/app/code/Magento/Backend/Block/Widget/Form/Container.php index 73e18d3c7c1..dec19073bac 100644 --- a/app/code/Magento/Backend/Block/Widget/Form/Container.php +++ b/app/code/Magento/Backend/Block/Widget/Form/Container.php @@ -222,7 +222,7 @@ class Container extends \Magento\Backend\Block\Widget\Container /** * Set data object and pass it to form * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function setDataObject($object) diff --git a/app/code/Magento/Backend/Block/Widget/Form/Element.php b/app/code/Magento/Backend/Block/Widget/Form/Element.php index 1dd4f945a14..04f84ba9cbf 100644 --- a/app/code/Magento/Backend/Block/Widget/Form/Element.php +++ b/app/code/Magento/Backend/Block/Widget/Form/Element.php @@ -25,7 +25,7 @@ class Element extends \Magento\Backend\Block\Template protected $_form; /** - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $_formBlock; @@ -55,7 +55,7 @@ class Element extends \Magento\Backend\Block\Template } /** - * @param \Magento\Framework\Object $formBlock + * @param \Magento\Framework\DataObject $formBlock * @return $this */ public function setFormBlock($formBlock) diff --git a/app/code/Magento/Backend/Block/Widget/Grid.php b/app/code/Magento/Backend/Block/Widget/Grid.php index b95a5af2763..ee8b36cdea8 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid.php +++ b/app/code/Magento/Backend/Block/Widget/Grid.php @@ -114,7 +114,7 @@ class Grid extends \Magento\Backend\Block\Widget /** * Totals * - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $_varTotals; @@ -789,10 +789,10 @@ class Grid extends \Magento\Backend\Block\Widget /** * Set totals * - * @param \Magento\Framework\Object $totals + * @param \Magento\Framework\DataObject $totals * @return void */ - public function setTotals(\Magento\Framework\Object $totals) + public function setTotals(\Magento\Framework\DataObject $totals) { $this->_varTotals = $totals; } @@ -800,7 +800,7 @@ class Grid extends \Magento\Backend\Block\Widget /** * Retrieve totals * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getTotals() { diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column.php b/app/code/Magento/Backend/Block/Widget/Grid/Column.php index 666544b8f68..7d69e31341c 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column.php @@ -268,10 +268,10 @@ class Column extends \Magento\Backend\Block\Widget /** * Retrieve row column field value for display * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function getRowField(\Magento\Framework\Object $row) + public function getRowField(\Magento\Framework\DataObject $row) { $renderedValue = $this->getRenderer()->render($row); if ($this->getHtmlDecorators()) { @@ -296,10 +296,10 @@ class Column extends \Magento\Backend\Block\Widget /** * Retrieve row column field value for export * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function getRowFieldExport(\Magento\Framework\Object $row) + public function getRowFieldExport(\Magento\Framework\DataObject $row) { $renderedValue = $this->getRenderer()->renderExport($row); diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php index a906d70f095..0c28782435d 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php @@ -6,7 +6,7 @@ namespace Magento\Backend\Block\Widget\Grid\Column\Renderer; use Magento\Backend\Block\Widget\Grid\Column; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Backend grid item abstract renderer @@ -48,7 +48,7 @@ abstract class AbstractRenderer extends \Magento\Backend\Block\AbstractBlock imp * @param Object $row * @return string */ - public function render(Object $row) + public function render(DataObject $row) { if ($this->getColumn()->getEditable()) { $value = $this->_getValue($row); @@ -65,7 +65,7 @@ abstract class AbstractRenderer extends \Magento\Backend\Block\AbstractBlock imp * @param Object $row * @return string */ - public function renderExport(Object $row) + public function renderExport(DataObject $row) { return $this->render($row); } @@ -74,7 +74,7 @@ abstract class AbstractRenderer extends \Magento\Backend\Block\AbstractBlock imp * @param Object $row * @return mixed */ - protected function _getValue(Object $row) + protected function _getValue(DataObject $row) { if ($getter = $this->getColumn()->getGetter()) { if (is_string($getter)) { @@ -91,7 +91,7 @@ abstract class AbstractRenderer extends \Magento\Backend\Block\AbstractBlock imp * @param Object $row * @return string */ - public function _getInputValueElement(Object $row) + public function _getInputValueElement(DataObject $row) { return '<input type="text" class="input-text ' . $this->getColumn()->getValidateClass() . @@ -107,7 +107,7 @@ abstract class AbstractRenderer extends \Magento\Backend\Block\AbstractBlock imp * @param Object $row * @return mixed */ - protected function _getInputValue(Object $row) + protected function _getInputValue(DataObject $row) { return $this->_getValue($row); } diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Action.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Action.php index 6bbbf0b5284..c05981d93b3 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Action.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Action.php @@ -37,10 +37,10 @@ class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Text /** * Renders column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $actions = $this->getColumn()->getActions(); if (empty($actions) || !is_array($actions)) { @@ -72,12 +72,12 @@ class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Text * Render single action as dropdown option html * * @param array $action - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - protected function _toOptionHtml($action, \Magento\Framework\Object $row) + protected function _toOptionHtml($action, \Magento\Framework\DataObject $row) { - $actionAttributes = new \Magento\Framework\Object(); + $actionAttributes = new \Magento\Framework\DataObject(); $actionCaption = ''; $this->_transformActionData($action, $actionCaption, $row); @@ -91,12 +91,12 @@ class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Text * Render single action as link html * * @param array $action - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - protected function _toLinkHtml($action, \Magento\Framework\Object $row) + protected function _toLinkHtml($action, \Magento\Framework\DataObject $row) { - $actionAttributes = new \Magento\Framework\Object(); + $actionAttributes = new \Magento\Framework\DataObject(); $actionCaption = ''; $this->_transformActionData($action, $actionCaption, $row); @@ -117,12 +117,12 @@ class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Text * * @param array &$action * @param string &$actionCaption - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return $this * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.UnusedLocalVariable) */ - protected function _transformActionData(&$action, &$actionCaption, \Magento\Framework\Object $row) + protected function _transformActionData(&$action, &$actionCaption, \Magento\Framework\DataObject $row) { foreach ($action as $attribute => $value) { if (isset($action[$attribute]) && !is_array($action[$attribute])) { diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Button.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Button.php index c1c72e6ab22..7dfd2bd363e 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Button.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Button.php @@ -10,10 +10,10 @@ class Button extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstract /** * Render grid row * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $buttonType = $this->getColumn()->getButtonType(); $buttonClass = $this->getColumn()->getButtonClass(); diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Checkbox.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Checkbox.php index 867dfc9f56e..9b4224271d5 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Checkbox.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Checkbox.php @@ -68,12 +68,12 @@ class Checkbox extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $values = $this->_getValues(); $value = $row->getData($this->getColumn()->getIndex()); diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Concat.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Concat.php index 58f43a1c0e1..250e3d57af0 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Concat.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Concat.php @@ -16,10 +16,10 @@ class Concat extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstract /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $dataArr = []; $column = $this->getColumn(); diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Country.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Country.php index d3cbb60bbbe..2da39a122cd 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Country.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Country.php @@ -34,10 +34,10 @@ class Country extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstrac /** * Render country grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { if ($data = $row->getData($this->getColumn()->getIndex())) { $name = $this->localeLists->getCountryTranslation($data); diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Currency.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Currency.php index f0454dd37a9..cf22a2a2b6f 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Currency.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Currency.php @@ -23,7 +23,7 @@ class Currency extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra /** * Currency objects cache * - * @var \Magento\Framework\Object[] + * @var \Magento\Framework\DataObject[] */ protected static $_currencies = []; @@ -79,10 +79,10 @@ class Currency extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { if ($data = (string)$this->_getValue($row)) { $currency_code = $this->_getCurrencyCode($row); @@ -98,7 +98,7 @@ class Currency extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra /** * Returns currency code, false on error * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ protected function _getCurrencyCode($row) @@ -116,7 +116,7 @@ class Currency extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra /** * Get rate for current row, 1 by default * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return float|int */ protected function _getRate($row) diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Date.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Date.php index 10ffb059953..99c6c0f8e79 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Date.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Date.php @@ -57,10 +57,10 @@ class Date extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRe /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { if ($data = $row->getData($this->getColumn()->getIndex())) { $format = $this->_getFormat(); diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Datetime.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Datetime.php index 674041d975e..195f62cd0fe 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Datetime.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Datetime.php @@ -14,10 +14,10 @@ class Datetime extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $format = $this->getColumn()->getFormat(); if ($data = $this->_getValue($row)) { diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/DraggableHandle.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/DraggableHandle.php index 8dadca8045c..7c8b9eccebe 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/DraggableHandle.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/DraggableHandle.php @@ -10,10 +10,10 @@ class DraggableHandle extends \Magento\Backend\Block\Widget\Grid\Column\Renderer /** * Render grid row * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { return '<span class="' . $this->getColumn()->getInlineCss() . diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Input.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Input.php index fc3b0cbb9a6..e94670a407c 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Input.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Input.php @@ -21,10 +21,10 @@ class Input extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractR /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $html = '<input type="text" '; $html .= 'name="' . $this->getColumn()->getId() . '" '; diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Ip.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Ip.php index c1b112f2963..2b3cdb728d3 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Ip.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Ip.php @@ -16,10 +16,10 @@ class Ip extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRend /** * Render the grid cell value * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { return long2ip($row->getData($this->getColumn()->getIndex())); } diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Longtext.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Longtext.php index 4f685031cd1..e26e1702642 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Longtext.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Longtext.php @@ -16,10 +16,10 @@ class Longtext extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra * Text will be truncated as specified in string_limit, truncate or 250 by default * Also it can be html-escaped and nl2br() * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $truncateLength = 250; // stringLength() is for legacy purposes diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Massaction.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Massaction.php index 529b3f4e0dd..43d10a654ec 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Massaction.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Massaction.php @@ -43,10 +43,10 @@ class Massaction extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Chec /** * Returns HTML of the object * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { if ($this->getColumn()->getGrid()->getMassactionIdFieldOnlyIndexValue()) { $this->setNoObjectId(true); diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Number.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Number.php index f3e22234473..ee9f972dbde 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Number.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Number.php @@ -20,10 +20,10 @@ class Number extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstract /** * Returns value of the row * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return mixed|string */ - protected function _getValue(\Magento\Framework\Object $row) + protected function _getValue(\Magento\Framework\DataObject $row) { $data = parent::_getValue($row); if ($data !== null) { diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Options.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Options.php index 2ed159642da..1c25cf7b866 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Options.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Options.php @@ -25,11 +25,11 @@ class Options extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Text /** * Render a grid cell as options * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string|void * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $options = $this->_getOptions(); diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Price.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Price.php index 07aa265424f..76b657343e9 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Price.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Price.php @@ -18,7 +18,7 @@ class Price extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractR /** * Currency objects cache * - * @var \Magento\Framework\Object[] + * @var \Magento\Framework\DataObject[] */ protected static $_currencies = []; @@ -44,10 +44,10 @@ class Price extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractR /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { if ($data = $this->_getValue($row)) { $currencyCode = $this->_getCurrencyCode($row); @@ -67,7 +67,7 @@ class Price extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractR /** * Returns currency code for the row, false on error * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string|false */ protected function _getCurrencyCode($row) @@ -84,7 +84,7 @@ class Price extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractR /** * Returns rate for the row, 1 by default * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return float|int */ protected function _getRate($row) diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Radio.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Radio.php index f84c7e020de..6a26161cdae 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Radio.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Radio.php @@ -68,10 +68,10 @@ class Radio extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractR /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $values = $this->_getValues(); $value = $row->getData($this->getColumn()->getIndex()); diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/RendererInterface.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/RendererInterface.php index 5d8e5723954..4a1ae17ea70 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/RendererInterface.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/RendererInterface.php @@ -36,9 +36,9 @@ interface RendererInterface /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string * @api */ - public function render(\Magento\Framework\Object $row); + public function render(\Magento\Framework\DataObject $row); } diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Select.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Select.php index faa369e4f8f..f9d53d39796 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Select.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Select.php @@ -45,10 +45,10 @@ class Select extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstract /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $name = $this->getColumn()->getName() ? $this->getColumn()->getName() : $this->getColumn()->getId(); $html = '<select name="' . $this->escapeHtml($name) . '" ' . $this->getColumn()->getValidateClass() . '>'; diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Store.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Store.php index 4b155d71458..07d937ed880 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Store.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Store.php @@ -82,12 +82,12 @@ class Store extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractR /** * Render row store views * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return \Magento\Framework\Phrase|string * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $out = ''; $skipAllStoresLabel = $this->_getShowAllStoresLabelFlag(); @@ -134,11 +134,11 @@ class Store extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractR /** * Render row store views for export * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return \Magento\Framework\Phrase|string * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - public function renderExport(\Magento\Framework\Object $row) + public function renderExport(\Magento\Framework\DataObject $row) { $out = ''; $skipAllStoresLabel = $this->_getShowAllStoresLabelFlag(); diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Text.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Text.php index 4d71bc8dc58..be6a8c238b6 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Text.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Text.php @@ -23,10 +23,10 @@ class Text extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRe /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return mixed */ - public function _getValue(\Magento\Framework\Object $row) + public function _getValue(\Magento\Framework\DataObject $row) { $format = $this->getColumn()->getFormat() ? $this->getColumn()->getFormat() : null; $defaultValue = $this->getColumn()->getDefault(); diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Wrapline.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Wrapline.php index 567a2bdf76d..44f35ec5fc3 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Wrapline.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Wrapline.php @@ -20,18 +20,18 @@ class Wrapline extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra /** * Magento string lib * - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; /** * @param \Magento\Backend\Block\Context $context - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, array $data = [] ) { $this->string = $string; @@ -41,10 +41,10 @@ class Wrapline extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $line = parent::_getValue($row); $wrappedLine = ''; diff --git a/app/code/Magento/Backend/Block/Widget/Grid/ColumnSet.php b/app/code/Magento/Backend/Block/Widget/Grid/ColumnSet.php index 6078fff1bcb..e69f391cd5b 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/ColumnSet.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/ColumnSet.php @@ -237,7 +237,7 @@ class ColumnSet extends \Magento\Framework\View\Element\Template /** * Return row url for js event handlers * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return string */ public function getRowUrl($item) @@ -252,7 +252,7 @@ class ColumnSet extends \Magento\Framework\View\Element\Template /** * Get children of specified item * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return array */ public function getMultipleRows($item) @@ -263,7 +263,7 @@ class ColumnSet extends \Magento\Framework\View\Element\Template /** * Has children of specified item * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return bool */ public function hasMultipleRows($item) @@ -287,7 +287,7 @@ class ColumnSet extends \Magento\Framework\View\Element\Template /** * Check whether subtotal should be rendered * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return boolean */ public function shouldRenderSubTotal($item) @@ -308,7 +308,7 @@ class ColumnSet extends \Magento\Framework\View\Element\Template /** * Retrieve rowspan number * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @param \Magento\Backend\Block\Widget\Grid\Column $column * @return int|false */ @@ -348,7 +348,7 @@ class ColumnSet extends \Magento\Framework\View\Element\Template /** * Check whether should render empty cell * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @param \Magento\Backend\Block\Widget\Grid\Column $column * @return boolean */ @@ -370,7 +370,7 @@ class ColumnSet extends \Magento\Framework\View\Element\Template /** * Check whether should render cell * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @param \Magento\Backend\Block\Widget\Grid\Column $column * @return boolean */ @@ -563,8 +563,8 @@ class ColumnSet extends \Magento\Framework\View\Element\Template /** * Retrieve subtotal for item * - * @param \Magento\Framework\Object $item - * @return \Magento\Framework\Object + * @param \Magento\Framework\DataObject $item + * @return \Magento\Framework\DataObject */ public function getSubTotals($item) { @@ -576,7 +576,7 @@ class ColumnSet extends \Magento\Framework\View\Element\Template /** * Retrieve subtotal items * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getTotals() { @@ -588,10 +588,10 @@ class ColumnSet extends \Magento\Framework\View\Element\Template /** * Update item with first sub-item data * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return void */ - public function updateItemByFirstMultiRow(\Magento\Framework\Object $item) + public function updateItemByFirstMultiRow(\Magento\Framework\DataObject $item) { $multiRows = $this->getMultipleRows($item); if (is_object($multiRows) && $multiRows instanceof \Magento\Framework\Data\Collection) { diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Export.php b/app/code/Magento/Backend/Block/Widget/Grid/Export.php index b7c803f25bf..b028c742713 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Export.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Export.php @@ -18,7 +18,7 @@ class Export extends \Magento\Backend\Block\Widget implements \Magento\Backend\B /** * Grid export types * - * @var \Magento\Framework\Object[] + * @var \Magento\Framework\DataObject[] */ protected $_exportTypes = []; @@ -100,7 +100,7 @@ class Export extends \Magento\Backend\Block\Widget implements \Magento\Backend\B /** * Retrieve totals * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function _getTotals() { @@ -131,7 +131,7 @@ class Export extends \Magento\Backend\Block\Widget implements \Magento\Backend\B /** * Retrieve grid export types * - * @return \Magento\Framework\Object[]|false + * @return \Magento\Framework\DataObject[]|false */ public function getExportTypes() { @@ -189,7 +189,7 @@ class Export extends \Magento\Backend\Block\Widget implements \Magento\Backend\B */ public function addExportType($url, $label) { - $this->_exportTypes[] = new \Magento\Framework\Object( + $this->_exportTypes[] = new \Magento\Framework\DataObject( ['url' => $this->getUrl($url, ['_current' => true]), 'label' => $label] ); return $this; @@ -279,11 +279,11 @@ class Export extends \Magento\Backend\Block\Widget implements \Magento\Backend\B /** * Write item data to csv export file * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @param \Magento\Framework\Filesystem\File\WriteInterface $stream * @return void */ - protected function _exportCsvItem(\Magento\Framework\Object $item, \Magento\Framework\Filesystem\File\WriteInterface $stream) + protected function _exportCsvItem(\Magento\Framework\DataObject $item, \Magento\Framework\Filesystem\File\WriteInterface $stream) { $row = []; foreach ($this->_getColumns() as $column) { @@ -404,10 +404,10 @@ class Export extends \Magento\Backend\Block\Widget implements \Magento\Backend\B /** * Get a row data of the particular columns * - * @param \Magento\Framework\Object $data + * @param \Magento\Framework\DataObject $data * @return string[] */ - public function getRowRecord(\Magento\Framework\Object $data) + public function getRowRecord(\Magento\Framework\DataObject $data) { $row = []; foreach ($this->_getColumns() as $column) { @@ -510,13 +510,13 @@ class Export extends \Magento\Backend\Block\Widget implements \Magento\Backend\B } $collection = $this->_collectionFactory->create(); - /** @var $item \Magento\Framework\Object */ + /** @var $item \Magento\Framework\DataObject */ foreach ($baseCollection as $item) { if ($item->getIsEmpty()) { continue; } if ($item->hasChildren() && count($item->getChildren()) > 0) { - /** @var $subItem \Magento\Framework\Object */ + /** @var $subItem \Magento\Framework\DataObject */ foreach ($item->getChildren() as $subItem) { $tmpItem = clone $item; $tmpItem->unsChildren(); diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Extended.php b/app/code/Magento/Backend/Block/Widget/Grid/Extended.php index e19827a61b6..3c48878fcd0 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Extended.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Extended.php @@ -48,7 +48,7 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba /** * Grid export types * - * @var \Magento\Framework\Object[] + * @var \Magento\Framework\DataObject[] */ protected $_exportTypes = []; @@ -151,7 +151,7 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba /** * SubTotals * - * @var \Magento\Framework\Object[] + * @var \Magento\Framework\DataObject[] */ protected $_subtotals = []; @@ -266,7 +266,7 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba */ public function addExportType($url, $label) { - $this->_exportTypes[] = new \Magento\Framework\Object( + $this->_exportTypes[] = new \Magento\Framework\DataObject( ['url' => $this->getUrl($url, ['_current' => true]), 'label' => $label] ); return $this; @@ -276,7 +276,7 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba * Add column to grid * * @param string $columnId - * @param array|\Magento\Framework\Object $column + * @param array|\Magento\Framework\DataObject $column * @return $this * @throws \Exception */ @@ -321,7 +321,7 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba * Add column to grid after specified column. * * @param string $columnId - * @param array|\Magento\Framework\Object $column + * @param array|\Magento\Framework\DataObject $column * @param string $after * @return $this */ @@ -613,7 +613,7 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba /** * Check whether should render cell * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @param \Magento\Backend\Block\Widget\Grid\Column $column * @return boolean */ @@ -653,7 +653,7 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba /** * Return row url for js event handlers * - * @param \Magento\Catalog\Model\Product|\Magento\Framework\Object $item + * @param \Magento\Catalog\Model\Product|\Magento\Framework\DataObject $item * @return string */ public function getRowUrl($item) @@ -665,7 +665,7 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba /** * Get children of specified item * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return array */ public function getMultipleRows($item) @@ -689,7 +689,7 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba /** * Check whether subtotal should be rendered * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return boolean */ public function shouldRenderSubTotal($item) @@ -700,7 +700,7 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba /** * Retrieve rowspan number * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @param \Magento\Backend\Block\Widget\Grid\Column $column * @return int|false */ @@ -734,7 +734,7 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba /** * Check whether should render empty cell * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @param \Magento\Backend\Block\Widget\Grid\Column $column * @return boolean */ @@ -756,8 +756,8 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba /** * Retrieve subtotal item * - * @param \Magento\Framework\Object $item - * @return \Magento\Framework\Object|string + * @param \Magento\Framework\DataObject $item + * @return \Magento\Framework\DataObject|string */ public function getSubTotalItem($item) { @@ -975,12 +975,12 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba /** * Write item data to csv export file * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @param \Magento\Framework\Filesystem\File\WriteInterface $stream * @return void */ protected function _exportCsvItem( - \Magento\Framework\Object $item, + \Magento\Framework\DataObject $item, \Magento\Framework\Filesystem\File\WriteInterface $stream ) { $row = []; @@ -1116,10 +1116,10 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba /** * Get a row data of the particular columns * - * @param \Magento\Framework\Object $data + * @param \Magento\Framework\DataObject $data * @return string[] */ - public function getRowRecord(\Magento\Framework\Object $data) + public function getRowRecord(\Magento\Framework\DataObject $data) { $row = []; foreach ($this->getColumns() as $column) { @@ -1220,7 +1220,7 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba /** * Retrieve grid export types * - * @return \Magento\Framework\Object[]|false + * @return \Magento\Framework\DataObject[]|false */ public function getExportTypes() { @@ -1274,7 +1274,7 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba /** * Set subtotal items * - * @param \Magento\Framework\Object[] $items + * @param \Magento\Framework\DataObject[] $items * @return $this */ public function setSubTotals(array $items) @@ -1286,7 +1286,7 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba /** * Retrieve subtotal items * - * @return \Magento\Framework\Object[] + * @return \Magento\Framework\DataObject[] */ public function getSubTotals() { diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php index c390ade5c14..fadc3d6f3d1 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php @@ -77,16 +77,16 @@ abstract class AbstractMassaction extends \Magento\Backend\Block\Widget * ); * * @param string $itemId - * @param array|\Magento\Framework\Object $item + * @param array|\Magento\Framework\DataObject $item * @return $this */ public function addItem($itemId, $item) { if (is_array($item)) { - $item = new \Magento\Framework\Object($item); + $item = new \Magento\Framework\DataObject($item); } - if ($item instanceof \Magento\Framework\Object) { + if ($item instanceof \Magento\Framework\DataObject) { $item->setId($itemId); $item->setUrl($this->getUrl($item->getUrl())); $this->_items[$itemId] = $item; diff --git a/app/code/Magento/Backend/Block/Widget/Tabs.php b/app/code/Magento/Backend/Block/Widget/Tabs.php index 638044ff530..e7b21aa01ab 100644 --- a/app/code/Magento/Backend/Block/Widget/Tabs.php +++ b/app/code/Magento/Backend/Block/Widget/Tabs.php @@ -90,7 +90,7 @@ class Tabs extends \Magento\Backend\Block\Widget * Add new tab after another * * @param string $tabId new tab Id - * @param array|\Magento\Framework\Object $tab + * @param array|\Magento\Framework\DataObject $tab * @param string $afterTabId * @return void */ @@ -104,7 +104,7 @@ class Tabs extends \Magento\Backend\Block\Widget * Add new tab * * @param string $tabId - * @param array|\Magento\Framework\Object|string $tab + * @param array|\Magento\Framework\DataObject|string $tab * @return $this * @throws \Exception * @SuppressWarnings(PHPMD.CyclomaticComplexity) @@ -112,8 +112,8 @@ class Tabs extends \Magento\Backend\Block\Widget public function addTab($tabId, $tab) { if (is_array($tab)) { - $this->_tabs[$tabId] = new \Magento\Framework\Object($tab); - } elseif ($tab instanceof \Magento\Framework\Object) { + $this->_tabs[$tabId] = new \Magento\Framework\DataObject($tab); + } elseif ($tab instanceof \Magento\Framework\DataObject) { $this->_tabs[$tabId] = $tab; if (!$this->_tabs[$tabId]->hasTabId()) { $this->_tabs[$tabId]->setTabId($tabId); @@ -277,7 +277,7 @@ class Tabs extends \Magento\Backend\Block\Widget } /** - * @param \Magento\Framework\Object|TabInterface $tab + * @param \Magento\Framework\DataObject|TabInterface $tab * @param bool $withPrefix * @return string */ @@ -290,7 +290,7 @@ class Tabs extends \Magento\Backend\Block\Widget } /** - * @param \Magento\Framework\Object|TabInterface $tab + * @param \Magento\Framework\DataObject|TabInterface $tab * @return bool */ public function canShowTab($tab) @@ -302,7 +302,7 @@ class Tabs extends \Magento\Backend\Block\Widget } /** - * @param \Magento\Framework\Object|TabInterface $tab + * @param \Magento\Framework\DataObject|TabInterface $tab * @return bool * @SuppressWarnings(PHPMD.BooleanGetMethodName) */ @@ -315,7 +315,7 @@ class Tabs extends \Magento\Backend\Block\Widget } /** - * @param \Magento\Framework\Object|TabInterface $tab + * @param \Magento\Framework\DataObject|TabInterface $tab * @return string */ public function getTabUrl($tab) @@ -333,7 +333,7 @@ class Tabs extends \Magento\Backend\Block\Widget } /** - * @param \Magento\Framework\Object|TabInterface $tab + * @param \Magento\Framework\DataObject|TabInterface $tab * @return string */ public function getTabTitle($tab) @@ -345,7 +345,7 @@ class Tabs extends \Magento\Backend\Block\Widget } /** - * @param \Magento\Framework\Object|TabInterface $tab + * @param \Magento\Framework\DataObject|TabInterface $tab * @return string */ public function getTabClass($tab) @@ -360,7 +360,7 @@ class Tabs extends \Magento\Backend\Block\Widget } /** - * @param \Magento\Framework\Object|TabInterface $tab + * @param \Magento\Framework\DataObject|TabInterface $tab * @return string */ public function getTabLabel($tab) @@ -372,7 +372,7 @@ class Tabs extends \Magento\Backend\Block\Widget } /** - * @param \Magento\Framework\Object|TabInterface $tab + * @param \Magento\Framework\DataObject|TabInterface $tab * @return string */ public function getTabContent($tab) @@ -455,7 +455,7 @@ class Tabs extends \Magento\Backend\Block\Widget */ public function setTabData($tab, $key, $value) { - if (isset($this->_tabs[$tab]) && $this->_tabs[$tab] instanceof \Magento\Framework\Object) { + if (isset($this->_tabs[$tab]) && $this->_tabs[$tab] instanceof \Magento\Framework\DataObject) { if ($key == 'url') { $value = $this->getUrl($value, ['_current' => true, '_use_rewrite' => true]); } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Dashboard/Tunnel.php b/app/code/Magento/Backend/Controller/Adminhtml/Dashboard/Tunnel.php index 0e452496d1a..9e61ae3bc68 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Dashboard/Tunnel.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Dashboard/Tunnel.php @@ -48,7 +48,11 @@ class Tunnel extends \Magento\Backend\Controller\Adminhtml\Dashboard $helper = $this->_objectManager->get('Magento\Backend\Helper\Dashboard\Data'); $newHash = $helper->getChartDataHash($gaData); if ($newHash == $gaHash) { - $params = json_decode(base64_decode(urldecode($gaData)), true); + $params = null; + $paramsJson = base64_decode(urldecode($gaData)); + if ($paramsJson) { + $params = json_decode($paramsJson, true); + } if ($params) { try { /** @var $httpClient \Magento\Framework\HTTP\ZendClient */ diff --git a/app/code/Magento/Backend/Helper/Dashboard/AbstractDashboard.php b/app/code/Magento/Backend/Helper/Dashboard/AbstractDashboard.php index a1c7dc36171..be7e5c68342 100644 --- a/app/code/Magento/Backend/Helper/Dashboard/AbstractDashboard.php +++ b/app/code/Magento/Backend/Helper/Dashboard/AbstractDashboard.php @@ -72,7 +72,7 @@ abstract class AbstractDashboard extends \Magento\Framework\App\Helper\AbstractH } else { $result[] = null; } - } elseif ($item instanceof \Magento\Framework\Object) { + } elseif ($item instanceof \Magento\Framework\DataObject) { $result[] = $item->getData($index); } else { $result[] = null; diff --git a/app/code/Magento/Backend/Model/Resource/Translate/String.php b/app/code/Magento/Backend/Model/Resource/Translate/String.php deleted file mode 100644 index 2048ca00083..00000000000 --- a/app/code/Magento/Backend/Model/Resource/Translate/String.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Backend\Model\Resource\Translate; - -/** - * Backend string translate resource model - */ -class String extends \Magento\Translation\Model\Resource\String -{ - /** - * Get current store id - * Use always default scope for store id - * - * @return int - */ - protected function _getStoreId() - { - return \Magento\Store\Model\Store::DEFAULT_STORE_ID; - } -} diff --git a/app/code/Magento/Backend/Model/Search/Customer.php b/app/code/Magento/Backend/Model/Search/Customer.php index 7b16b1c8944..02811dca843 100644 --- a/app/code/Magento/Backend/Model/Search/Customer.php +++ b/app/code/Magento/Backend/Model/Search/Customer.php @@ -20,7 +20,7 @@ namespace Magento\Backend\Model\Search; * @method Customer setResults(array $results) * @method array getResults() */ -class Customer extends \Magento\Framework\Object +class Customer extends \Magento\Framework\DataObject { /** * Adminhtml data diff --git a/app/code/Magento/Backend/Model/Search/Order.php b/app/code/Magento/Backend/Model/Search/Order.php index 314b6a375ee..678d98138dc 100644 --- a/app/code/Magento/Backend/Model/Search/Order.php +++ b/app/code/Magento/Backend/Model/Search/Order.php @@ -10,7 +10,7 @@ namespace Magento\Backend\Model\Search; * * @author Magento Core Team <core@magentocommerce.com> */ -class Order extends \Magento\Framework\Object +class Order extends \Magento\Framework\DataObject { /** * Adminhtml data diff --git a/app/code/Magento/Backend/Model/Session/AdminConfig.php b/app/code/Magento/Backend/Model/Session/AdminConfig.php index 532a7f0446c..c3fa55ed8d0 100644 --- a/app/code/Magento/Backend/Model/Session/AdminConfig.php +++ b/app/code/Magento/Backend/Model/Session/AdminConfig.php @@ -42,7 +42,7 @@ class AdminConfig extends Config /** * @param \Magento\Framework\ValidatorFactory $validatorFactory * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - * @param \Magento\Framework\Stdlib\String $stringHelper + * @param \Magento\Framework\Stdlib\StringUtils $stringHelper * @param \Magento\Framework\App\RequestInterface $request * @param Filesystem $filesystem * @param DeploymentConfig $deploymentConfig @@ -57,7 +57,7 @@ class AdminConfig extends Config public function __construct( \Magento\Framework\ValidatorFactory $validatorFactory, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, - \Magento\Framework\Stdlib\String $stringHelper, + \Magento\Framework\Stdlib\StringUtils $stringHelper, \Magento\Framework\App\RequestInterface $request, Filesystem $filesystem, DeploymentConfig $deploymentConfig, diff --git a/app/code/Magento/Backend/Model/Widget/Grid/AbstractTotals.php b/app/code/Magento/Backend/Model/Widget/Grid/AbstractTotals.php index 3022ef69650..79bb5e09740 100644 --- a/app/code/Magento/Backend/Model/Widget/Grid/AbstractTotals.php +++ b/app/code/Magento/Backend/Model/Widget/Grid/AbstractTotals.php @@ -31,7 +31,7 @@ abstract class AbstractTotals implements \Magento\Backend\Model\Widget\Grid\Tota /** * Factory model * - * @var \Magento\Framework\Object\Factory + * @var \Magento\Framework\DataObject\Factory */ protected $_factory; @@ -43,10 +43,10 @@ abstract class AbstractTotals implements \Magento\Backend\Model\Widget\Grid\Tota protected $_parser; /** - * @param \Magento\Framework\Object\Factory $factory + * @param \Magento\Framework\DataObject\Factory $factory * @param \Magento\Backend\Model\Widget\Grid\Parser $parser */ - public function __construct(\Magento\Framework\Object\Factory $factory, \Magento\Backend\Model\Widget\Grid\Parser $parser) + public function __construct(\Magento\Framework\DataObject\Factory $factory, \Magento\Backend\Model\Widget\Grid\Parser $parser) { $this->_factory = $factory; $this->_parser = $parser; @@ -223,7 +223,7 @@ abstract class AbstractTotals implements \Magento\Backend\Model\Widget\Grid\Tota * Count totals for all columns set * * @param \Magento\Framework\Data\Collection $collection - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function countTotals($collection) { @@ -237,7 +237,7 @@ abstract class AbstractTotals implements \Magento\Backend\Model\Widget\Grid\Tota /** * Get totals as object * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getTotals() { diff --git a/app/code/Magento/Backend/Model/Widget/Grid/Row/GeneratorInterface.php b/app/code/Magento/Backend/Model/Widget/Grid/Row/GeneratorInterface.php index 7f1834f54d3..9fcdbbd52e0 100644 --- a/app/code/Magento/Backend/Model/Widget/Grid/Row/GeneratorInterface.php +++ b/app/code/Magento/Backend/Model/Widget/Grid/Row/GeneratorInterface.php @@ -10,7 +10,7 @@ namespace Magento\Backend\Model\Widget\Grid\Row; interface GeneratorInterface { /** - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return string * @api */ diff --git a/app/code/Magento/Backend/Model/Widget/Grid/Row/UrlGenerator.php b/app/code/Magento/Backend/Model/Widget/Grid/Row/UrlGenerator.php index 2e4b0d25831..721b90049b2 100644 --- a/app/code/Magento/Backend/Model/Widget/Grid/Row/UrlGenerator.php +++ b/app/code/Magento/Backend/Model/Widget/Grid/Row/UrlGenerator.php @@ -53,7 +53,7 @@ class UrlGenerator implements \Magento\Backend\Model\Widget\Grid\Row\GeneratorIn /** * Create url for passed item using passed url model * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return string */ public function getUrl($item) @@ -68,7 +68,7 @@ class UrlGenerator implements \Magento\Backend\Model\Widget\Grid\Row\GeneratorIn /** * Convert template params array and merge with preselected params * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return array */ protected function _prepareParameters($item) diff --git a/app/code/Magento/Backend/Model/Widget/Grid/Row/UrlGeneratorId.php b/app/code/Magento/Backend/Model/Widget/Grid/Row/UrlGeneratorId.php index 095e5f5f7c1..75cce84ad55 100644 --- a/app/code/Magento/Backend/Model/Widget/Grid/Row/UrlGeneratorId.php +++ b/app/code/Magento/Backend/Model/Widget/Grid/Row/UrlGeneratorId.php @@ -12,7 +12,7 @@ class UrlGeneratorId implements \Magento\Backend\Model\Widget\Grid\Row\Generator /** * Create url for passed item using passed url model * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return string */ public function getUrl($item) diff --git a/app/code/Magento/Backend/Model/Widget/Grid/TotalsInterface.php b/app/code/Magento/Backend/Model/Widget/Grid/TotalsInterface.php index b7ec0d6a034..f61fc1203eb 100644 --- a/app/code/Magento/Backend/Model/Widget/Grid/TotalsInterface.php +++ b/app/code/Magento/Backend/Model/Widget/Grid/TotalsInterface.php @@ -12,7 +12,7 @@ interface TotalsInterface * * @abstract * @param \Magento\Framework\Data\Collection $collection - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject * @api */ public function countTotals($collection); diff --git a/app/code/Magento/Backend/Test/Unit/Block/Widget/Form/ContainerTest.php b/app/code/Magento/Backend/Test/Unit/Block/Widget/Form/ContainerTest.php index cadf62b2d2c..8c6cffa5ebb 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/Widget/Form/ContainerTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/Widget/Form/ContainerTest.php @@ -9,8 +9,8 @@ class ContainerTest extends \PHPUnit_Framework_TestCase { public function testSetDataObject() { - $form = new \Magento\Framework\Object(); - $dataObject = new \Magento\Framework\Object(); + $form = new \Magento\Framework\DataObject(); + $dataObject = new \Magento\Framework\DataObject(); // _prepateLayout() is blocked, because it is used by block to instantly add 'form' child $block = $this->getMock( diff --git a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/ConcatTest.php b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/ConcatTest.php index 204827b91c6..1c7f3766eaf 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/ConcatTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/ConcatTest.php @@ -5,7 +5,7 @@ */ namespace Magento\Backend\Test\Unit\Block\Widget\Grid\Column\Renderer; -use Magento\Framework\Object; +use Magento\Framework\DataObject; class ConcatTest extends \PHPUnit_Framework_TestCase { @@ -38,7 +38,7 @@ class ConcatTest extends \PHPUnit_Framework_TestCase */ public function testRender($method, $getters) { - $object = new Object(['test' => 'a', 'best' => 'b']); + $object = new DataObject(['test' => 'a', 'best' => 'b']); $column = $this->getMockBuilder('Magento\Backend\Block\Widget\Grid\Column') ->disableOriginalConstructor() ->setMethods([$method, 'getSeparator']) diff --git a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/CurrencyTest.php b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/CurrencyTest.php index 9f7571c5cb1..c140b90f6ba 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/CurrencyTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/CurrencyTest.php @@ -43,7 +43,7 @@ class CurrencyTest extends \PHPUnit_Framework_TestCase protected $_currencyMock; /** - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $_row; @@ -80,7 +80,7 @@ class CurrencyTest extends \PHPUnit_Framework_TestCase ); $currencyFactoryMock->expects($this->any())->method('create')->will($this->returnValue($this->_currencyMock)); - $this->_row = new \Magento\Framework\Object(['columnIndex' => '10']); + $this->_row = new \Magento\Framework\DataObject(['columnIndex' => '10']); $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->_blockCurrency = $helper->getObject( diff --git a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/Radio/ExtendedTest.php b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/Radio/ExtendedTest.php index bcfaf7b78f8..8078ce92ab2 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/Radio/ExtendedTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/Radio/ExtendedTest.php @@ -41,7 +41,7 @@ class ExtendedTest extends \PHPUnit_Framework_TestCase '', false ); - $this->_object = new \Magento\Backend\Block\Widget\Grid\Column\Renderer\Radio\Extended($context, $this->_converter); + $this->_object = new Extended($context, $this->_converter); $this->_object->setColumn($this->_column); } @@ -57,7 +57,7 @@ class ExtendedTest extends \PHPUnit_Framework_TestCase $this->_column->expects($this->once())->method('getIndex')->will($this->returnValue('label')); $this->_column->expects($this->once())->method('getHtmlName')->will($this->returnValue('test[]')); $this->_converter->expects($this->never())->method('toFlatArray'); - $this->assertEquals($expectedResult, $this->_object->render(new \Magento\Framework\Object($rowData))); + $this->assertEquals($expectedResult, $this->_object->render(new \Magento\Framework\DataObject($rowData))); } public function renderDataProvider() diff --git a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/RadioTest.php b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/RadioTest.php index a37eef4f5c4..08701de20db 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/RadioTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/RadioTest.php @@ -66,7 +66,7 @@ class RadioTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValue($selectedFlatArray) ); - $this->assertEquals($expectedResult, $this->_object->render(new \Magento\Framework\Object($rowData))); + $this->assertEquals($expectedResult, $this->_object->render(new \Magento\Framework\DataObject($rowData))); } public function renderDataProvider() diff --git a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/ColumnSetTest.php b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/ColumnSetTest.php index 3a0ddb466ce..d13c96b15c7 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/ColumnSetTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/ColumnSetTest.php @@ -135,7 +135,7 @@ class ColumnSetTest extends \PHPUnit_Framework_TestCase { $generatorClass = 'Magento\Backend\Model\Widget\Grid\Row\UrlGenerator'; - $itemMock = $this->getMock('Magento\Framework\Object', [], [], '', false); + $itemMock = $this->getMock('Magento\Framework\DataObject', [], [], '', false); $rowUrlGenerator = $this->getMock( 'Magento\Backend\Model\Widget\Grid\Row\UrlGenerator', @@ -190,13 +190,13 @@ class ColumnSetTest extends \PHPUnit_Framework_TestCase public function testItemHasMultipleRows() { - $item = new \Magento\Framework\Object(); + $item = new \Magento\Framework\DataObject(); // prepare sub-collection $subCollection = new \Magento\Framework\Data\Collection( $this->getMock('Magento\Framework\Data\Collection\EntityFactory', [], [], '', false) ); - $subCollection->addItem(new \Magento\Framework\Object(['test4' => '1', 'test5' => '2'])); - $subCollection->addItem(new \Magento\Framework\Object(['test4' => '2', 'test5' => '2'])); + $subCollection->addItem(new \Magento\Framework\DataObject(['test4' => '1', 'test5' => '2'])); + $subCollection->addItem(new \Magento\Framework\DataObject(['test4' => '2', 'test5' => '2'])); $item->setChildren($subCollection); $this->assertTrue($this->_block->hasMultipleRows($item)); @@ -233,24 +233,24 @@ class ColumnSetTest extends \PHPUnit_Framework_TestCase public function testShouldRenderSubtotalWithFlagFalse() { $this->_block->setCountSubTotals(false); - $this->assertFalse($this->_block->shouldRenderSubTotal(new \Magento\Framework\Object())); + $this->assertFalse($this->_block->shouldRenderSubTotal(new \Magento\Framework\DataObject())); } public function testShouldRenderSubtotalWithEmptySubData() { $this->_block->setCountSubTotals(true); - $this->assertFalse($this->_block->shouldRenderSubTotal(new \Magento\Framework\Object())); + $this->assertFalse($this->_block->shouldRenderSubTotal(new \Magento\Framework\DataObject())); } public function testShouldRenderSubtotalWithNotEmptySubData() { - $item = new \Magento\Framework\Object(); + $item = new \Magento\Framework\DataObject(); // prepare sub-collection $subCollection = new \Magento\Framework\Data\Collection( $this->getMock('Magento\Framework\Data\Collection\EntityFactory', [], [], '', false) ); - $subCollection->addItem(new \Magento\Framework\Object(['test4' => '1', 'test5' => '2'])); - $subCollection->addItem(new \Magento\Framework\Object(['test4' => '2', 'test5' => '2'])); + $subCollection->addItem(new \Magento\Framework\DataObject(['test4' => '1', 'test5' => '2'])); + $subCollection->addItem(new \Magento\Framework\DataObject(['test4' => '2', 'test5' => '2'])); $item->setChildren($subCollection); $this->_block->setCountSubTotals(true); @@ -259,16 +259,16 @@ class ColumnSetTest extends \PHPUnit_Framework_TestCase public function testUpdateItemByFirstMultiRow() { - $item = new \Magento\Framework\Object(['test1' => '1']); + $item = new \Magento\Framework\DataObject(['test1' => '1']); // prepare sub-collection $subCollection = new \Magento\Framework\Data\Collection( $this->getMock('Magento\Framework\Data\Collection\EntityFactory', [], [], '', false) ); - $subCollection->addItem(new \Magento\Framework\Object(['test4' => '1', 'test5' => '2'])); - $subCollection->addItem(new \Magento\Framework\Object(['test4' => '2', 'test5' => '2'])); + $subCollection->addItem(new \Magento\Framework\DataObject(['test4' => '1', 'test5' => '2'])); + $subCollection->addItem(new \Magento\Framework\DataObject(['test4' => '2', 'test5' => '2'])); $item->setChildren($subCollection); - $expectedItem = new \Magento\Framework\Object(['test1' => '1']); + $expectedItem = new \Magento\Framework\DataObject(['test1' => '1']); $expectedItem->addData(['test4' => '1', 'test5' => '2']); $expectedItem->setChildren($subCollection); @@ -282,8 +282,8 @@ class ColumnSetTest extends \PHPUnit_Framework_TestCase $subCollection = new \Magento\Framework\Data\Collection( $this->getMock('Magento\Framework\Data\Collection\EntityFactory', [], [], '', false) ); - $subCollection->addItem(new \Magento\Framework\Object(['column' => '1'])); - $subCollection->addItem(new \Magento\Framework\Object(['column' => '1'])); + $subCollection->addItem(new \Magento\Framework\DataObject(['column' => '1'])); + $subCollection->addItem(new \Magento\Framework\DataObject(['column' => '1'])); $this->_subtotalsMock->expects( $this->once() @@ -292,14 +292,14 @@ class ColumnSetTest extends \PHPUnit_Framework_TestCase )->with( $subCollection )->will( - $this->returnValue(new \Magento\Framework\Object(['column' => '2'])) + $this->returnValue(new \Magento\Framework\DataObject(['column' => '2'])) ); // prepare item - $item = new \Magento\Framework\Object(['test1' => '1']); + $item = new \Magento\Framework\DataObject(['test1' => '1']); $item->setChildren($subCollection); - $this->assertEquals(new \Magento\Framework\Object(['column' => '2']), $this->_block->getSubTotals($item)); + $this->assertEquals(new \Magento\Framework\DataObject(['column' => '2']), $this->_block->getSubTotals($item)); } public function testGetTotals() @@ -314,11 +314,11 @@ class ColumnSetTest extends \PHPUnit_Framework_TestCase )->with( $collection )->will( - $this->returnValue(new \Magento\Framework\Object(['test1' => '3', 'test2' => '2'])) + $this->returnValue(new \Magento\Framework\DataObject(['test1' => '3', 'test2' => '2'])) ); $this->assertEquals( - new \Magento\Framework\Object(['test1' => '3', 'test2' => '2']), $this->_block->getTotals() + new \Magento\Framework\DataObject(['test1' => '3', 'test2' => '2']), $this->_block->getTotals() ); } @@ -348,9 +348,9 @@ class ColumnSetTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\Framework\Data\Collection\EntityFactory', [], [], '', false) ); $items = [ - new \Magento\Framework\Object(['test1' => '1', 'test2' => '2']), - new \Magento\Framework\Object(['test1' => '1', 'test2' => '2']), - new \Magento\Framework\Object(['test1' => '1', 'test2' => '2']), + new \Magento\Framework\DataObject(['test1' => '1', 'test2' => '2']), + new \Magento\Framework\DataObject(['test1' => '1', 'test2' => '2']), + new \Magento\Framework\DataObject(['test1' => '1', 'test2' => '2']), ]; foreach ($items as $item) { $collection->addItem($item); diff --git a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/MassactionTest.php b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/MassactionTest.php index 044fb4570a0..1ea0f1c93f3 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/MassactionTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/MassactionTest.php @@ -123,7 +123,7 @@ class MassactionTest extends \PHPUnit_Framework_TestCase /** * @param $itemId * @param $item - * @param $expectedItem \Magento\Framework\Object + * @param $expectedItem \Magento\Framework\DataObject * @dataProvider itemsDataProvider */ public function testItemsProcessing($itemId, $item, $expectedItem) @@ -146,7 +146,7 @@ class MassactionTest extends \PHPUnit_Framework_TestCase $this->assertEquals(1, $this->_block->getCount()); $actualItem = $this->_block->getItem($itemId); - $this->assertInstanceOf('Magento\Framework\Object', $actualItem); + $this->assertInstanceOf('Magento\Framework\DataObject', $actualItem); $this->assertEquals($expectedItem->getData(), $actualItem->getData()); $this->_block->removeItem($itemId); @@ -160,7 +160,7 @@ class MassactionTest extends \PHPUnit_Framework_TestCase [ 'test_id1', ["label" => "Test Item One", "url" => "*/*/test1"], - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ "label" => "Test Item One", "url" => "http://localhost/index.php/backend/admin/test/test1", @@ -170,8 +170,8 @@ class MassactionTest extends \PHPUnit_Framework_TestCase ], [ 'test_id2', - new \Magento\Framework\Object(["label" => "Test Item Two", "url" => "*/*/test2"]), - new \Magento\Framework\Object( + new \Magento\Framework\DataObject(["label" => "Test Item Two", "url" => "*/*/test2"]), + new \Magento\Framework\DataObject( [ "label" => "Test Item Two", "url" => "http://localhost/index.php/backend/admin/test/test2", diff --git a/app/code/Magento/Backend/Test/Unit/Model/Locale/ManagerTest.php b/app/code/Magento/Backend/Test/Unit/Model/Locale/ManagerTest.php index a624a526d5d..20cbd53ab07 100644 --- a/app/code/Magento/Backend/Test/Unit/Model/Locale/ManagerTest.php +++ b/app/code/Magento/Backend/Test/Unit/Model/Locale/ManagerTest.php @@ -41,7 +41,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase false ); - $userMock = new \Magento\Framework\Object(); + $userMock = new \Magento\Framework\DataObject(); $this->_authSession->expects($this->any())->method('getUser')->will($this->returnValue($userMock)); diff --git a/app/code/Magento/Backend/Test/Unit/Model/Widget/Grid/AbstractTotalsTest.php b/app/code/Magento/Backend/Test/Unit/Model/Widget/Grid/AbstractTotalsTest.php index dc40a4664bb..7a9090a889c 100644 --- a/app/code/Magento/Backend/Test/Unit/Model/Widget/Grid/AbstractTotalsTest.php +++ b/app/code/Magento/Backend/Test/Unit/Model/Widget/Grid/AbstractTotalsTest.php @@ -66,7 +66,7 @@ class AbstractTotalsTest extends \PHPUnit_Framework_TestCase $collection = new \Magento\Framework\Data\Collection( $this->getMock('Magento\Framework\Data\Collection\EntityFactory', [], [], '', false) ); - $items = [new \Magento\Framework\Object(['test1' => '1', 'test2' => '2'])]; + $items = [new \Magento\Framework\DataObject(['test1' => '1', 'test2' => '2'])]; foreach ($items as $item) { $collection->addItem($item); } @@ -143,7 +143,7 @@ class AbstractTotalsTest extends \PHPUnit_Framework_TestCase protected function _prepareFactoryMock() { $this->_factoryMock = $this->getMock( - 'Magento\Framework\Object\Factory', + 'Magento\Framework\DataObject\Factory', ['create'], [], '', @@ -163,7 +163,7 @@ class AbstractTotalsTest extends \PHPUnit_Framework_TestCase 'test6' => 1, 'test7' => 0, ], - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'test1' => 2, 'test2' => 2, @@ -175,7 +175,7 @@ class AbstractTotalsTest extends \PHPUnit_Framework_TestCase ] ), ], - [[], new \Magento\Framework\Object()], + [[], new \Magento\Framework\DataObject()], ]; $this->_factoryMock->expects($this->any())->method('create')->will($this->returnValueMap($createValueMap)); } @@ -197,7 +197,7 @@ class AbstractTotalsTest extends \PHPUnit_Framework_TestCase public function testCountTotals() { - $expected = new \Magento\Framework\Object( + $expected = new \Magento\Framework\DataObject( ['test1' => 2, 'test2' => 2, 'test3' => 4, 'test4' => 0, 'test5' => 4, 'test6' => 1, 'test7' => 0] ); $this->assertEquals($expected, $this->_model->countTotals($this->_getTestCollection())); @@ -208,7 +208,7 @@ class AbstractTotalsTest extends \PHPUnit_Framework_TestCase $this->_model->countTotals($this->_getTestCollection()); $this->_model->reset(); - $this->assertEquals(new \Magento\Framework\Object(), $this->_model->getTotals()); + $this->assertEquals(new \Magento\Framework\DataObject(), $this->_model->getTotals()); $this->assertNotEmpty($this->_model->getColumns()); } @@ -217,7 +217,7 @@ class AbstractTotalsTest extends \PHPUnit_Framework_TestCase $this->_model->countTotals($this->_getTestCollection()); $this->_model->reset(true); - $this->assertEquals(new \Magento\Framework\Object(), $this->_model->getTotals()); + $this->assertEquals(new \Magento\Framework\DataObject(), $this->_model->getTotals()); $this->assertEmpty($this->_model->getColumns()); } } diff --git a/app/code/Magento/Backend/Test/Unit/Model/Widget/Grid/Row/UrlGeneratorTest.php b/app/code/Magento/Backend/Test/Unit/Model/Widget/Grid/Row/UrlGeneratorTest.php index c32cf13f8df..0f9d30a5b71 100644 --- a/app/code/Magento/Backend/Test/Unit/Model/Widget/Grid/Row/UrlGeneratorTest.php +++ b/app/code/Magento/Backend/Test/Unit/Model/Widget/Grid/Row/UrlGeneratorTest.php @@ -12,7 +12,7 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase $itemId = 3; $urlPath = 'mng/item/edit'; - $itemMock = $this->getMock('Magento\Framework\Object', ['getItemId'], [], '', false); + $itemMock = $this->getMock('Magento\Framework\DataObject', ['getItemId'], [], '', false); $itemMock->expects($this->once())->method('getItemId')->will($this->returnValue($itemId)); $urlModelMock = $this->getMock( diff --git a/app/code/Magento/Backend/Test/Unit/Model/Widget/Grid/SubTotalsTest.php b/app/code/Magento/Backend/Test/Unit/Model/Widget/Grid/SubTotalsTest.php index 25309a6da7e..675b36a7e63 100644 --- a/app/code/Magento/Backend/Test/Unit/Model/Widget/Grid/SubTotalsTest.php +++ b/app/code/Magento/Backend/Test/Unit/Model/Widget/Grid/SubTotalsTest.php @@ -35,7 +35,7 @@ class SubTotalsTest extends \PHPUnit_Framework_TestCase ); $this->_factoryMock = $this->getMock( - 'Magento\Framework\Object\Factory', + 'Magento\Framework\DataObject\Factory', ['create'], [], '', @@ -50,7 +50,7 @@ class SubTotalsTest extends \PHPUnit_Framework_TestCase )->with( ['sub_test1' => 3, 'sub_test2' => 2] )->will( - $this->returnValue(new \Magento\Framework\Object(['sub_test1' => 3, 'sub_test2' => 2])) + $this->returnValue(new \Magento\Framework\DataObject(['sub_test1' => 3, 'sub_test2' => 2])) ); $arguments = ['factory' => $this->_factoryMock, 'parser' => $this->_parserMock]; @@ -73,7 +73,7 @@ class SubTotalsTest extends \PHPUnit_Framework_TestCase public function testCountTotals() { - $expected = new \Magento\Framework\Object(['sub_test1' => 3, 'sub_test2' => 2]); + $expected = new \Magento\Framework\DataObject(['sub_test1' => 3, 'sub_test2' => 2]); $this->assertEquals($expected, $this->_model->countTotals($this->_getTestCollection())); } @@ -88,9 +88,9 @@ class SubTotalsTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\Framework\Data\Collection\EntityFactory', [], [], '', false) ); $items = [ - new \Magento\Framework\Object(['sub_test1' => '1', 'sub_test2' => '2']), - new \Magento\Framework\Object(['sub_test1' => '1', 'sub_test2' => '2']), - new \Magento\Framework\Object(['sub_test1' => '1', 'sub_test2' => '2']), + new \Magento\Framework\DataObject(['sub_test1' => '1', 'sub_test2' => '2']), + new \Magento\Framework\DataObject(['sub_test1' => '1', 'sub_test2' => '2']), + new \Magento\Framework\DataObject(['sub_test1' => '1', 'sub_test2' => '2']), ]; foreach ($items as $item) { $collection->addItem($item); diff --git a/app/code/Magento/Backend/Test/Unit/Model/Widget/Grid/TotalsTest.php b/app/code/Magento/Backend/Test/Unit/Model/Widget/Grid/TotalsTest.php index 6f762069b1b..46ae53033b5 100644 --- a/app/code/Magento/Backend/Test/Unit/Model/Widget/Grid/TotalsTest.php +++ b/app/code/Magento/Backend/Test/Unit/Model/Widget/Grid/TotalsTest.php @@ -36,7 +36,7 @@ class TotalsTest extends \PHPUnit_Framework_TestCase ); $this->_factoryMock = $this->getMock( - 'Magento\Framework\Object\Factory', + 'Magento\Framework\DataObject\Factory', ['create'], [], '', @@ -46,8 +46,8 @@ class TotalsTest extends \PHPUnit_Framework_TestCase ); $createValueMap = [ - [['test1' => 3, 'test2' => 2], new \Magento\Framework\Object(['test1' => 3, 'test2' => 2])], - [['test4' => 9, 'test5' => 2], new \Magento\Framework\Object(['test4' => 9, 'test5' => 2])], + [['test1' => 3, 'test2' => 2], new \Magento\Framework\DataObject(['test1' => 3, 'test2' => 2])], + [['test4' => 9, 'test5' => 2], new \Magento\Framework\DataObject(['test4' => 9, 'test5' => 2])], ]; $this->_factoryMock->expects($this->any())->method('create')->will($this->returnValueMap($createValueMap)); @@ -76,15 +76,15 @@ class TotalsTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\Framework\Data\Collection\EntityFactory', [], [], '', false) ); $items = [ - new \Magento\Framework\Object(['test1' => '1', 'test2' => '2']), - new \Magento\Framework\Object(['test1' => '1', 'test2' => '2']), - new \Magento\Framework\Object(['test1' => '1', 'test2' => '2']), + new \Magento\Framework\DataObject(['test1' => '1', 'test2' => '2']), + new \Magento\Framework\DataObject(['test1' => '1', 'test2' => '2']), + new \Magento\Framework\DataObject(['test1' => '1', 'test2' => '2']), ]; foreach ($items as $item) { $collection->addItem($item); } - $expected = new \Magento\Framework\Object(['test1' => 3, 'test2' => 2]); + $expected = new \Magento\Framework\DataObject(['test1' => 3, 'test2' => 2]); $this->assertEquals($expected, $this->_model->countTotals($collection)); } @@ -99,19 +99,19 @@ class TotalsTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\Framework\Data\Collection\EntityFactory', [], [], '', false) ); $items = [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ - 'children' => new \Magento\Framework\Object(['test4' => '1', 'test5' => '2']), + 'children' => new \Magento\Framework\DataObject(['test4' => '1', 'test5' => '2']), ] ), - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ - 'children' => new \Magento\Framework\Object(['test4' => '1', 'test5' => '2']), + 'children' => new \Magento\Framework\DataObject(['test4' => '1', 'test5' => '2']), ] ), - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ - 'children' => new \Magento\Framework\Object(['test4' => '1', 'test5' => '2']), + 'children' => new \Magento\Framework\DataObject(['test4' => '1', 'test5' => '2']), ] ), ]; @@ -120,12 +120,12 @@ class TotalsTest extends \PHPUnit_Framework_TestCase $subCollection = new \Magento\Framework\Data\Collection( $this->getMock('Magento\Framework\Data\Collection\EntityFactory', [], [], '', false) ); - $subCollection->addItem(new \Magento\Framework\Object(['test4' => '1', 'test5' => '2'])); - $subCollection->addItem(new \Magento\Framework\Object(['test4' => '2', 'test5' => '2'])); + $subCollection->addItem(new \Magento\Framework\DataObject(['test4' => '1', 'test5' => '2'])); + $subCollection->addItem(new \Magento\Framework\DataObject(['test4' => '2', 'test5' => '2'])); $item->setChildren($subCollection); $collection->addItem($item); } - $expected = new \Magento\Framework\Object(['test4' => 9, 'test5' => 2]); + $expected = new \Magento\Framework\DataObject(['test4' => 9, 'test5' => 2]); $this->assertEquals($expected, $this->_model->countTotals($collection)); } } diff --git a/app/code/Magento/Backup/Block/Adminhtml/Grid/Column/Renderer/Download.php b/app/code/Magento/Backup/Block/Adminhtml/Grid/Column/Renderer/Download.php index 443abd960e6..b7f7e3207ec 100644 --- a/app/code/Magento/Backup/Block/Adminhtml/Grid/Column/Renderer/Download.php +++ b/app/code/Magento/Backup/Block/Adminhtml/Grid/Column/Renderer/Download.php @@ -16,10 +16,10 @@ class Download extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Text /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return mixed */ - public function _getValue(\Magento\Framework\Object $row) + public function _getValue(\Magento\Framework\DataObject $row) { $url7zip = __( 'The archive can be uncompressed with <a href="%1">%2</a> on Windows systems.', diff --git a/app/code/Magento/Backup/Controller/Adminhtml/Index/Create.php b/app/code/Magento/Backup/Controller/Adminhtml/Index/Create.php index abe181923ca..abfd789889b 100644 --- a/app/code/Magento/Backup/Controller/Adminhtml/Index/Create.php +++ b/app/code/Magento/Backup/Controller/Adminhtml/Index/Create.php @@ -23,7 +23,7 @@ class Create extends \Magento\Backup\Controller\Adminhtml\Index return $this->_redirect('*/*/index'); } - $response = new \Magento\Framework\Object(); + $response = new \Magento\Framework\DataObject(); /** * @var \Magento\Backup\Helper\Data $helper diff --git a/app/code/Magento/Backup/Controller/Adminhtml/Index/MassDelete.php b/app/code/Magento/Backup/Controller/Adminhtml/Index/MassDelete.php index 9980008a84c..b0c1af3a1f4 100644 --- a/app/code/Magento/Backup/Controller/Adminhtml/Index/MassDelete.php +++ b/app/code/Magento/Backup/Controller/Adminhtml/Index/MassDelete.php @@ -21,7 +21,7 @@ class MassDelete extends \Magento\Backup\Controller\Adminhtml\Index return $this->_redirect('backup/*/index'); } - $resultData = new \Magento\Framework\Object(); + $resultData = new \Magento\Framework\DataObject(); $resultData->setIsSuccess(false); $resultData->setDeleteResult([]); $this->_coreRegistry->register('backup_manager', $resultData); diff --git a/app/code/Magento/Backup/Controller/Adminhtml/Index/Rollback.php b/app/code/Magento/Backup/Controller/Adminhtml/Index/Rollback.php index ccc74f6d9ef..b2e8de61ed3 100644 --- a/app/code/Magento/Backup/Controller/Adminhtml/Index/Rollback.php +++ b/app/code/Magento/Backup/Controller/Adminhtml/Index/Rollback.php @@ -30,7 +30,7 @@ class Rollback extends \Magento\Backup\Controller\Adminhtml\Index } $helper = $this->_objectManager->get('Magento\Backup\Helper\Data'); - $response = new \Magento\Framework\Object(); + $response = new \Magento\Framework\DataObject(); try { /* @var $backup \Magento\Backup\Model\Backup */ diff --git a/app/code/Magento/Backup/Helper/Data.php b/app/code/Magento/Backup/Helper/Data.php index cc70c3eb28b..7448f7e520c 100644 --- a/app/code/Magento/Backup/Helper/Data.php +++ b/app/code/Magento/Backup/Helper/Data.php @@ -252,7 +252,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper * Extracts information from backup's filename * * @param string $filename - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function extractDataFromFilename($filename) { @@ -278,7 +278,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper $name = substr($name, 1); } - $result = new \Magento\Framework\Object(); + $result = new \Magento\Framework\DataObject(); $result->addData(['name' => $name, 'type' => $type, 'time' => $time]); return $result; diff --git a/app/code/Magento/Backup/Model/Backup.php b/app/code/Magento/Backup/Model/Backup.php index 0994b903703..2ef1cf98334 100644 --- a/app/code/Magento/Backup/Model/Backup.php +++ b/app/code/Magento/Backup/Model/Backup.php @@ -16,7 +16,7 @@ use Magento\Framework\Filesystem\DriverPool; * @method string getTime() * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Backup extends \Magento\Framework\Object implements \Magento\Framework\Backup\Db\BackupInterface +class Backup extends \Magento\Framework\DataObject implements \Magento\Framework\Backup\Db\BackupInterface { /** * Compress rate diff --git a/app/code/Magento/Backup/Model/Resource/Db.php b/app/code/Magento/Backup/Model/Resource/Db.php index 848d0371731..c625a171392 100644 --- a/app/code/Magento/Backup/Model/Resource/Db.php +++ b/app/code/Magento/Backup/Model/Resource/Db.php @@ -116,14 +116,14 @@ class Db * Retrieve table status * * @param string $tableName - * @return \Magento\Framework\Object|bool + * @return \Magento\Framework\DataObject|bool */ public function getTableStatus($tableName) { $row = $this->_write->showTableStatus($tableName); if ($row) { - $statusObject = new \Magento\Framework\Object(); + $statusObject = new \Magento\Framework\DataObject(); foreach ($row as $field => $value) { $statusObject->setData(strtolower($field), $value); } diff --git a/app/code/Magento/Backup/Test/Unit/Model/BackupFactoryTest.php b/app/code/Magento/Backup/Test/Unit/Model/BackupFactoryTest.php index 806869e0941..d88afc4163e 100644 --- a/app/code/Magento/Backup/Test/Unit/Model/BackupFactoryTest.php +++ b/app/code/Magento/Backup/Test/Unit/Model/BackupFactoryTest.php @@ -47,7 +47,7 @@ class BackupFactoryTest extends \PHPUnit_Framework_TestCase )->method( 'getIterator' )->will( - $this->returnValue(new \ArrayIterator([new \Magento\Framework\Object($this->_data)])) + $this->returnValue(new \ArrayIterator([new \Magento\Framework\DataObject($this->_data)])) ); $this->_backupModel = $this->getMock('Magento\Backup\Model\Backup', [], [], '', false); diff --git a/app/code/Magento/Braintree/Block/Adminhtml/Form/Field/Countrycreditcard.php b/app/code/Magento/Braintree/Block/Adminhtml/Form/Field/Countrycreditcard.php index bebc335a3a6..b22dd5c97b8 100644 --- a/app/code/Magento/Braintree/Block/Adminhtml/Form/Field/Countrycreditcard.php +++ b/app/code/Magento/Braintree/Block/Adminhtml/Form/Field/Countrycreditcard.php @@ -78,10 +78,10 @@ class Countrycreditcard extends \Magento\Config\Block\System\Config\Form\Field\F /** * Prepare existing row data object * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return void */ - protected function _prepareArrayRow(\Magento\Framework\Object $row) + protected function _prepareArrayRow(\Magento\Framework\DataObject $row) { $country = $row->getCountryId(); $options = []; diff --git a/app/code/Magento/Braintree/Block/Info.php b/app/code/Magento/Braintree/Block/Info.php index f83bdc3808e..80e3ddf06c5 100644 --- a/app/code/Magento/Braintree/Block/Info.php +++ b/app/code/Magento/Braintree/Block/Info.php @@ -48,7 +48,7 @@ class Info extends \Magento\Payment\Block\Info * Prepare information specific to current payment method * * @param null | array $transport - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function _prepareSpecificInformation($transport = null) { diff --git a/app/code/Magento/Braintree/Block/Info/PayPal.php b/app/code/Magento/Braintree/Block/Info/PayPal.php index 535c66276c5..519981e6348 100644 --- a/app/code/Magento/Braintree/Block/Info/PayPal.php +++ b/app/code/Magento/Braintree/Block/Info/PayPal.php @@ -42,7 +42,7 @@ class PayPal extends \Magento\Payment\Block\Info * Prepare information specific to current payment method * * @param null | array $transport - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function _prepareSpecificInformation($transport = null) { diff --git a/app/code/Magento/Braintree/Controller/PayPal/Review.php b/app/code/Magento/Braintree/Controller/PayPal/Review.php index 28e7ff84ec5..5fb6732bed5 100644 --- a/app/code/Magento/Braintree/Controller/PayPal/Review.php +++ b/app/code/Magento/Braintree/Controller/PayPal/Review.php @@ -61,7 +61,9 @@ class Review extends \Magento\Braintree\Controller\PayPal { $paymentMethodNonce = $this->getRequest()->getParam('payment_method_nonce'); $details = $this->getRequest()->getParam('details'); - $details = $this->jsonHelper->jsonDecode($details); + if (!empty($details)) { + $details = $this->jsonHelper->jsonDecode($details); + } try { $this->initCheckout(); diff --git a/app/code/Magento/Braintree/Model/Observer.php b/app/code/Magento/Braintree/Model/Observer.php index 64c4398695b..49813ac505e 100644 --- a/app/code/Magento/Braintree/Model/Observer.php +++ b/app/code/Magento/Braintree/Model/Observer.php @@ -70,10 +70,10 @@ class Observer /** * If it's configured to capture on shipment - do this * - * @param \Magento\Framework\Object $observer + * @param \Magento\Framework\DataObject $observer * @return $this */ - public function processBraintreePayment(\Magento\Framework\Object $observer) + public function processBraintreePayment(\Magento\Framework\DataObject $observer) { $shipment = $observer->getEvent()->getShipment(); $order = $shipment->getOrder(); @@ -117,10 +117,10 @@ class Observer /** * Delete Braintree customer when Magento customer is deleted * - * @param \Magento\Framework\Object $observer + * @param \Magento\Framework\DataObject $observer * @return $this */ - public function deleteBraintreeCustomer(\Magento\Framework\Object $observer) + public function deleteBraintreeCustomer(\Magento\Framework\DataObject $observer) { if (!$this->config->isActive()) { return $this; diff --git a/app/code/Magento/Braintree/Model/PaymentMethod.php b/app/code/Magento/Braintree/Model/PaymentMethod.php index 2fc27a1a7a0..048ac2b2c0f 100644 --- a/app/code/Magento/Braintree/Model/PaymentMethod.php +++ b/app/code/Magento/Braintree/Model/PaymentMethod.php @@ -239,7 +239,7 @@ class PaymentMethod extends \Magento\Payment\Model\Method\Cc /** * Assign corresponding data * - * @param \Magento\Framework\Object|mixed $data + * @param \Magento\Framework\DataObject|mixed $data * @return $this */ public function assignData($data) @@ -870,13 +870,13 @@ class PaymentMethod extends \Magento\Payment\Model\Method\Cc /** * Processes successful authorize/clone result * - * @param \Magento\Framework\Object $payment + * @param \Magento\Framework\DataObject $payment * @param \Braintree_Result_Successful $result * @param float $amount - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function processSuccessResult( - \Magento\Framework\Object $payment, + \Magento\Framework\DataObject $payment, \Braintree_Result_Successful $result, $amount ) { diff --git a/app/code/Magento/Braintree/Model/PaymentMethod/PayPal.php b/app/code/Magento/Braintree/Model/PaymentMethod/PayPal.php index d621b76aa59..71d9b5e2219 100644 --- a/app/code/Magento/Braintree/Model/PaymentMethod/PayPal.php +++ b/app/code/Magento/Braintree/Model/PaymentMethod/PayPal.php @@ -144,7 +144,7 @@ class PayPal extends \Magento\Braintree\Model\PaymentMethod /** * Assign corresponding data * - * @param \Magento\Framework\Object|mixed $data + * @param \Magento\Framework\DataObject|mixed $data * @return $this */ public function assignData($data) @@ -217,13 +217,13 @@ class PayPal extends \Magento\Braintree\Model\PaymentMethod /** * Processes successful authorize/clone result * - * @param \Magento\Framework\Object $payment + * @param \Magento\Framework\DataObject $payment * @param \Braintree_Result_Successful $result * @param float $amount - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function processSuccessResult( - \Magento\Framework\Object $payment, + \Magento\Framework\DataObject $payment, \Braintree_Result_Successful $result, $amount ) { diff --git a/app/code/Magento/Braintree/Test/Unit/Block/Creditcard/ManagementTest.php b/app/code/Magento/Braintree/Test/Unit/Block/Creditcard/ManagementTest.php index 38ff8b90a18..e232c6b43f0 100644 --- a/app/code/Magento/Braintree/Test/Unit/Block/Creditcard/ManagementTest.php +++ b/app/code/Magento/Braintree/Test/Unit/Block/Creditcard/ManagementTest.php @@ -239,7 +239,7 @@ class ManagementTest extends \PHPUnit_Framework_TestCase ->willReturn(1); $regionCollectionMock->expects($this->once()) ->method('getFirstItem') - ->willReturn(new \Magento\Framework\Object(['id' => $regionId])); + ->willReturn(new \Magento\Framework\DataObject(['id' => $regionId])); $this->assertEquals($regionId, $this->block->getRegionIdByName($regionCode, $countryId)); } @@ -298,7 +298,7 @@ class ManagementTest extends \PHPUnit_Framework_TestCase $lastName = 'Doe'; $customerId = 1003; - $customer = new \Magento\Framework\Object( + $customer = new \Magento\Framework\DataObject( [ 'firstname' => $firstName, 'lastname' => $lastName, diff --git a/app/code/Magento/Braintree/Test/Unit/Block/PayPal/ShortcutTest.php b/app/code/Magento/Braintree/Test/Unit/Block/PayPal/ShortcutTest.php index dccc92403b4..0f137cc65cf 100644 --- a/app/code/Magento/Braintree/Test/Unit/Block/PayPal/ShortcutTest.php +++ b/app/code/Magento/Braintree/Test/Unit/Block/PayPal/ShortcutTest.php @@ -43,7 +43,7 @@ class ShortcutTest extends \PHPUnit_Framework_TestCase protected $urlBuilderMock; /** - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $container; @@ -90,7 +90,7 @@ class ShortcutTest extends \PHPUnit_Framework_TestCase ->method('getUrlBuilder') ->willReturn($this->urlBuilderMock); - $this->container = new \Magento\Framework\Object( + $this->container = new \Magento\Framework\DataObject( [ 'module_name' => 'Magento_Catalog', ] @@ -127,7 +127,7 @@ class ShortcutTest extends \PHPUnit_Framework_TestCase public function testGetAmount() { $amount = 10.5; - $quote = new \Magento\Framework\Object( + $quote = new \Magento\Framework\DataObject( [ 'base_grand_total' => $amount, ] @@ -156,9 +156,9 @@ class ShortcutTest extends \PHPUnit_Framework_TestCase { $currency = 'USD'; - $quote = new \Magento\Framework\Object( + $quote = new \Magento\Framework\DataObject( [ - 'currency' => new \Magento\Framework\Object( + 'currency' => new \Magento\Framework\DataObject( [ 'base_currency_code' => $currency, ] @@ -256,7 +256,7 @@ class ShortcutTest extends \PHPUnit_Framework_TestCase 'Magento\Braintree\Block\PayPal\Shortcut', [ 'data' => [ - 'container' => new \Magento\Framework\Object( + 'container' => new \Magento\Framework\DataObject( [ 'module_name' => 'Magento_Catalog', ] @@ -283,7 +283,7 @@ class ShortcutTest extends \PHPUnit_Framework_TestCase [ 'mathRandom' => $this->mathRandomMock, 'data' => [ - 'container' => new \Magento\Framework\Object( + 'container' => new \Magento\Framework\DataObject( [ 'module_name' => 'Magento_Checkout', ] diff --git a/app/code/Magento/Braintree/Test/Unit/Controller/PayPalTest.php b/app/code/Magento/Braintree/Test/Unit/Controller/PayPalTest.php index d467b230de9..b20831f92fe 100644 --- a/app/code/Magento/Braintree/Test/Unit/Controller/PayPalTest.php +++ b/app/code/Magento/Braintree/Test/Unit/Controller/PayPalTest.php @@ -113,7 +113,7 @@ class PayPalTest extends \PHPUnit_Framework_TestCase public function testDispatchNotActive() { - $resultRedirect = new \Magento\Framework\Object(); + $resultRedirect = new \Magento\Framework\DataObject(); $this->braintreePayPalConfigMock->expects($this->once()) ->method('isActive') ->willReturn(false); @@ -131,7 +131,7 @@ class PayPalTest extends \PHPUnit_Framework_TestCase public function testDispatchButtonNotEnabled() { - $resultRedirect = new \Magento\Framework\Object(); + $resultRedirect = new \Magento\Framework\DataObject(); $this->braintreePayPalConfigMock->expects($this->once()) ->method('isActive') ->willReturn(true); diff --git a/app/code/Magento/Braintree/Test/Unit/Model/ConfigProviderTest.php b/app/code/Magento/Braintree/Test/Unit/Model/ConfigProviderTest.php index 181c86eb914..57d6c61c6bc 100644 --- a/app/code/Magento/Braintree/Test/Unit/Model/ConfigProviderTest.php +++ b/app/code/Magento/Braintree/Test/Unit/Model/ConfigProviderTest.php @@ -200,7 +200,7 @@ class ConfigProviderTest extends \PHPUnit_Framework_TestCase ->getMock(); $quoteMock->expects($this->once()) ->method('getBillingAddress') - ->willReturn(new \Magento\Framework\Object(['country_id' => 'US'])); + ->willReturn(new \Magento\Framework\DataObject(['country_id' => 'US'])); $this->checkoutSessionMock->expects($this->once()) ->method('getQuote') ->willReturn($quoteMock); diff --git a/app/code/Magento/Braintree/Test/Unit/Model/ObserverTest.php b/app/code/Magento/Braintree/Test/Unit/Model/ObserverTest.php index 56376d66a6f..8b90dc550cc 100644 --- a/app/code/Magento/Braintree/Test/Unit/Model/ObserverTest.php +++ b/app/code/Magento/Braintree/Test/Unit/Model/ObserverTest.php @@ -103,13 +103,13 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $shipment1Qty = 2; $shipment3Qty = 3; - $orderItem1 = new \Magento\Framework\Object( + $orderItem1 = new \Magento\Framework\DataObject( ['id' => $orderItem1Id] ); - $orderItem2 = new \Magento\Framework\Object( + $orderItem2 = new \Magento\Framework\DataObject( ['id' => $orderItem2Id] ); - $orderItem3 = new \Magento\Framework\Object( + $orderItem3 = new \Magento\Framework\DataObject( ['id' => $orderItem3Id] ); $orderItems = [$orderItem1, $orderItem2, $orderItem3]; @@ -119,13 +119,13 @@ class ObserverTest extends \PHPUnit_Framework_TestCase //two items shipped $shipmentItems = [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'qty' => $shipment1Qty, 'order_item' => $orderItem1, ] ), - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'qty' => $shipment3Qty, 'order_item' => $orderItem3, @@ -150,7 +150,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase ->getMock(); $orderMock->expects($this->once()) ->method('getPayment') - ->willReturn(new \Magento\Framework\Object(['method' => PaymentMethod::METHOD_CODE])); + ->willReturn(new \Magento\Framework\DataObject(['method' => PaymentMethod::METHOD_CODE])); $orderMock->expects($this->once()) ->method('canInvoice') ->willReturn(true); @@ -207,9 +207,9 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $transactionMock->expects($this->once()) ->method('save'); - $observer = new \Magento\Framework\Object( + $observer = new \Magento\Framework\DataObject( [ - 'event' => new \Magento\Framework\Object( + 'event' => new \Magento\Framework\DataObject( [ 'shipment' => $shipmentMock, ] @@ -235,7 +235,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $index++; } - $paymentObj = new \Magento\Framework\Object( + $paymentObj = new \Magento\Framework\DataObject( [ 'method' => PaymentMethod::METHOD_CODE, ] @@ -250,11 +250,11 @@ class ObserverTest extends \PHPUnit_Framework_TestCase ->method('canInvoice') ->willReturn(true); - $observer = new \Magento\Framework\Object( + $observer = new \Magento\Framework\DataObject( [ - 'event' => new \Magento\Framework\Object( + 'event' => new \Magento\Framework\DataObject( [ - 'shipment' => new \Magento\Framework\Object( + 'shipment' => new \Magento\Framework\DataObject( [ 'order' => $orderMock, ] @@ -302,7 +302,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase ->method('isActive') ->willReturn($isActive); - $customer = new \Magento\Framework\Object( + $customer = new \Magento\Framework\DataObject( [ 'id' => $customerId, 'email' => $customerEmail, @@ -314,9 +314,9 @@ class ObserverTest extends \PHPUnit_Framework_TestCase ->with($customerId, $customerEmail) ->willReturn($braintreeCustoemrId); - $observer = new \Magento\Framework\Object( + $observer = new \Magento\Framework\DataObject( [ - 'event' => new \Magento\Framework\Object( + 'event' => new \Magento\Framework\DataObject( [ 'customer' => $customer, ] @@ -370,7 +370,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $event = new \Magento\Framework\Object( + $event = new \Magento\Framework\DataObject( [ 'is_catalog_product' => false, 'container' => $containerMock, @@ -450,7 +450,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $event = new \Magento\Framework\Object( + $event = new \Magento\Framework\DataObject( [ 'is_catalog_product' => false, 'container' => $containerMock, @@ -483,7 +483,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $event = new \Magento\Framework\Object( + $event = new \Magento\Framework\DataObject( [ 'is_catalog_product' => true, 'container' => $containerMock, diff --git a/app/code/Magento/Braintree/Test/Unit/Model/PaymentMethod/PayPalTest.php b/app/code/Magento/Braintree/Test/Unit/Model/PaymentMethod/PayPalTest.php index a30befe5249..ba30489f639 100644 --- a/app/code/Magento/Braintree/Test/Unit/Model/PaymentMethod/PayPalTest.php +++ b/app/code/Magento/Braintree/Test/Unit/Model/PaymentMethod/PayPalTest.php @@ -235,7 +235,7 @@ class PayPalTest extends \PHPUnit_Framework_TestCase 'payment_method_nonce' => $paymentMethodNonce, 'store_in_vault' => $storeInVault, ]; - $data = new \Magento\Framework\Object($data); + $data = new \Magento\Framework\DataObject($data); $this->model->setInfoInstance($this->infoInstanceMock); //ignore all fields except for payment_method_nonce @@ -256,9 +256,9 @@ class PayPalTest extends \PHPUnit_Framework_TestCase $ccType, $ccToken = null ) { - $quoteObj = new \Magento\Framework\Object( + $quoteObj = new \Magento\Framework\DataObject( [ - 'billing_address' => new \Magento\Framework\Object( + 'billing_address' => new \Magento\Framework\DataObject( [ 'country_id' => $countryId, ] @@ -360,13 +360,13 @@ class PayPalTest extends \PHPUnit_Framework_TestCase } /** - * @param \Magento\Framework\Object $paymentObject + * @param \Magento\Framework\DataObject $paymentObject * @param int $storeId * @return array * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ protected function setupPaymentObject( - \Magento\Framework\Object $paymentObject, + \Magento\Framework\DataObject $paymentObject, $storeId ) { $customerId = '12'; @@ -399,11 +399,11 @@ class PayPalTest extends \PHPUnit_Framework_TestCase 'address_type' => 'billing', ]; - $billingAddress = new \Magento\Framework\Object( + $billingAddress = new \Magento\Framework\DataObject( $addressData ); $addressData['address_type'] = 'shipping'; - $shippingAddress = new \Magento\Framework\Object( + $shippingAddress = new \Magento\Framework\DataObject( $addressData ); diff --git a/app/code/Magento/Braintree/Test/Unit/Model/PaymentMethodTest.php b/app/code/Magento/Braintree/Test/Unit/Model/PaymentMethodTest.php index 6a06df6ba73..49af3b38364 100644 --- a/app/code/Magento/Braintree/Test/Unit/Model/PaymentMethodTest.php +++ b/app/code/Magento/Braintree/Test/Unit/Model/PaymentMethodTest.php @@ -241,7 +241,7 @@ class PaymentMethodTest extends \PHPUnit_Framework_TestCase 'store_in_vault' => $storeInVault, 'device_data' => $deviceData, ]; - $data = new \Magento\Framework\Object($data); + $data = new \Magento\Framework\DataObject($data); $this->model->setInfoInstance($this->infoInstanceMock); $this->configMock->expects($this->once()) ->method('getConfigData') @@ -318,9 +318,9 @@ class PaymentMethodTest extends \PHPUnit_Framework_TestCase $ccType, $ccToken = null ) { - $quoteObj = new \Magento\Framework\Object( + $quoteObj = new \Magento\Framework\DataObject( [ - 'billing_address' => new \Magento\Framework\Object( + 'billing_address' => new \Magento\Framework\DataObject( [ 'country_id' => $countryId, ] @@ -513,13 +513,13 @@ class PaymentMethodTest extends \PHPUnit_Framework_TestCase return $orderMock; } /** - * @param \Magento\Framework\Object $paymentObject + * @param \Magento\Framework\DataObject $paymentObject * @param int $storeId * @return array * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ protected function setupPaymentObject( - \Magento\Framework\Object $paymentObject, + \Magento\Framework\DataObject $paymentObject, $storeId ) { $customerId = '12'; @@ -552,11 +552,11 @@ class PaymentMethodTest extends \PHPUnit_Framework_TestCase 'address_type' => 'billing', ]; - $billingAddress = new \Magento\Framework\Object( + $billingAddress = new \Magento\Framework\DataObject( $addressData ); $addressData['address_type'] = 'shipping'; - $shippingAddress = new \Magento\Framework\Object( + $shippingAddress = new \Magento\Framework\DataObject( $addressData ); diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php b/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php index 51c1995995b..7de371aeaef 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php @@ -33,7 +33,7 @@ class Renderer extends \Magento\Sales\Block\Adminhtml\Items\Renderer\DefaultRend /** * Getting all available children for Invoice, Shipment or CreditMemo item * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return array|null */ public function getChildren($item) diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/Price.php b/app/code/Magento/Bundle/Block/Catalog/Product/Price.php index af88e56748e..b6f3f63479c 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/Price.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/Price.php @@ -21,7 +21,7 @@ class Price extends \Magento\Catalog\Block\Product\Price * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\Math\Random $mathRandom * @param \Magento\Checkout\Helper\Cart $cartHelper * @param \Magento\Tax\Helper\Data $taxData @@ -32,7 +32,7 @@ class Price extends \Magento\Catalog\Block\Product\Price \Magento\Framework\Json\EncoderInterface $jsonEncoder, \Magento\Catalog\Helper\Data $catalogData, \Magento\Framework\Registry $registry, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\Math\Random $mathRandom, \Magento\Checkout\Helper\Cart $cartHelper, \Magento\Tax\Helper\Data $taxData, diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php index 706870380ad..6a71b4d7faf 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php @@ -131,7 +131,7 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView $defaultValues = []; $preConfiguredFlag = $currentProduct->hasPreconfiguredValues(); - /** @var \Magento\Framework\Object|null $preConfiguredValues */ + /** @var \Magento\Framework\DataObject|null $preConfiguredValues */ $preConfiguredValues = $preConfiguredFlag ? $currentProduct->getPreconfiguredValues() : null; $position = 0; @@ -154,7 +154,7 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView } $config = $this->getConfigData($currentProduct, $options); - $configObj = new \Magento\Framework\Object( + $configObj = new \Magento\Framework\DataObject( [ 'config' => $config, ] diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php index 0028de48309..b4896bd61d2 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php @@ -47,7 +47,7 @@ class Option extends \Magento\Bundle\Block\Catalog\Product\Price * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\Math\Random $mathRandom * @param \Magento\Checkout\Helper\Cart $cartHelper * @param \Magento\Tax\Helper\Data $taxData @@ -61,7 +61,7 @@ class Option extends \Magento\Bundle\Block\Catalog\Product\Price \Magento\Framework\Json\EncoderInterface $jsonEncoder, \Magento\Catalog\Helper\Data $catalogData, \Magento\Framework\Registry $registry, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\Math\Random $mathRandom, \Magento\Checkout\Helper\Cart $cartHelper, \Magento\Tax\Helper\Data $taxData, diff --git a/app/code/Magento/Bundle/Block/Sales/Order/Items/Renderer.php b/app/code/Magento/Bundle/Block/Sales/Order/Items/Renderer.php index b24b9ceecfb..e606c45c1f7 100644 --- a/app/code/Magento/Bundle/Block/Sales/Order/Items/Renderer.php +++ b/app/code/Magento/Bundle/Block/Sales/Order/Items/Renderer.php @@ -122,7 +122,7 @@ class Renderer extends \Magento\Sales\Block\Order\Item\Renderer\DefaultRenderer /** * Getting all available children for Invoice, Shipment or CreditMemo item * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return array */ public function getChildren($item) diff --git a/app/code/Magento/Bundle/Model/LinkManagement.php b/app/code/Magento/Bundle/Model/LinkManagement.php index 5d240c0517e..eee6f3b66e4 100644 --- a/app/code/Magento/Bundle/Model/LinkManagement.php +++ b/app/code/Magento/Bundle/Model/LinkManagement.php @@ -84,7 +84,7 @@ class LinkManagement implements \Magento\Bundle\Api\ProductLinkManagementInterfa $childrenList = []; foreach ($this->getOptions($product) as $option) { - if ($optionId !== null && $option->getOptionId() != $optionId) { + if (!$option->getSelections() || ($optionId !== null && $option->getOptionId() != $optionId)) { continue; } /** @var \Magento\Catalog\Model\Product $selection */ diff --git a/app/code/Magento/Bundle/Model/Observer.php b/app/code/Magento/Bundle/Model/Observer.php index 102b3b610ed..32e43f13a26 100644 --- a/app/code/Magento/Bundle/Model/Observer.php +++ b/app/code/Magento/Bundle/Model/Observer.php @@ -65,7 +65,7 @@ class Observer /** * Append bundles in upsell list for current product * - * @param \Magento\Framework\Object $observer + * @param \Magento\Framework\DataObject $observer * @return $this * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) @@ -132,7 +132,7 @@ class Observer foreach ($bundleCollection as $item) { $collection->addItem($item); } - } elseif ($collection instanceof \Magento\Framework\Object) { + } elseif ($collection instanceof \Magento\Framework\DataObject) { $items = $collection->getItems(); foreach ($bundleCollection as $item) { $items[$item->getEntityId()] = $item; @@ -162,7 +162,7 @@ class Observer /** * Setting attribute tab block for bundle * - * @param \Magento\Framework\Object $observer + * @param \Magento\Framework\DataObject $observer * @return $this */ public function setAttributeTabBlock($observer) diff --git a/app/code/Magento/Bundle/Model/OptionRepository.php b/app/code/Magento/Bundle/Model/OptionRepository.php index 78caa83e801..85d81e61b2b 100644 --- a/app/code/Magento/Bundle/Model/OptionRepository.php +++ b/app/code/Magento/Bundle/Model/OptionRepository.php @@ -230,7 +230,7 @@ class OptionRepository implements \Magento\Bundle\Api\ProductOptionRepositoryInt } } /** @var \Magento\Bundle\Api\Data\LinkInterface[] $linksToDelete */ - $linksToDelete = array_udiff($existingLinks, $linksToUpdate, [$this, 'compareLinks']); + $linksToDelete = $this->compareLinks($linksToUpdate, $existingLinks); } foreach ($linksToUpdate as $linkedProduct) { $this->linkManagement->saveChild($product->getSku(), $linkedProduct); @@ -263,21 +263,34 @@ class OptionRepository implements \Magento\Bundle\Api\ProductOptionRepositoryInt } /** - * Compare two links and determine if they are equal + * Computes the difference of arrays * - * @param \Magento\Bundle\Api\Data\LinkInterface $firstLink - * @param \Magento\Bundle\Api\Data\LinkInterface $secondLink - * @return int + * @param array $firstArray of \Magento\Bundle\Api\Data\LinkInterface + * @param array $secondArray of \Magento\Bundle\Api\Data\LinkInterface + * @return array * @SuppressWarnings(PHPMD.UnusedPrivateMethod) */ private function compareLinks( - \Magento\Bundle\Api\Data\LinkInterface $firstLink, - \Magento\Bundle\Api\Data\LinkInterface $secondLink + array $firstArray, + array $secondArray ) { - if ($firstLink->getId() == $secondLink->getId()) { - return 0; - } else { - return 1; + $result = []; + if (count($firstArray) < count($secondArray)) { + $holder = $firstArray; + $firstArray = $secondArray; + $secondArray = $holder; + } + foreach ($firstArray as $obj) { + foreach ($secondArray as $objToCompare) { + if ( + $obj->getId() != $objToCompare->getId() + && $obj instanceof \Magento\Bundle\Api\Data\LinkInterface + && $objToCompare instanceof \Magento\Bundle\Api\Data\LinkInterface + ) { + $result[] = $obj; + } + } } + return $result; } } diff --git a/app/code/Magento/Bundle/Model/Plugin/PriceBackend.php b/app/code/Magento/Bundle/Model/Plugin/PriceBackend.php index 03a63f4d2fb..be729754efd 100644 --- a/app/code/Magento/Bundle/Model/Plugin/PriceBackend.php +++ b/app/code/Magento/Bundle/Model/Plugin/PriceBackend.php @@ -15,7 +15,7 @@ class PriceBackend /** * @param \Magento\Catalog\Model\Product\Attribute\Backend\Price $subject * @param \Closure $proceed - * @param \Magento\Catalog\Model\Product|\Magento\Framework\Object $object + * @param \Magento\Catalog\Model\Product|\Magento\Framework\DataObject $object * @return bool * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ diff --git a/app/code/Magento/Bundle/Model/Product/CatalogPrice.php b/app/code/Magento/Bundle/Model/Product/CatalogPrice.php index 78e47388354..17974aef20f 100644 --- a/app/code/Magento/Bundle/Model/Product/CatalogPrice.php +++ b/app/code/Magento/Bundle/Model/Product/CatalogPrice.php @@ -58,7 +58,7 @@ class CatalogPrice implements \Magento\Catalog\Model\Product\CatalogPriceInterfa $this->coreRegistry->unregister('rule_data'); $this->coreRegistry->register( 'rule_data', - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'store_id' => $product->getStoreId(), 'website_id' => $product->getWebsiteId(), diff --git a/app/code/Magento/Bundle/Model/Product/Type.php b/app/code/Magento/Bundle/Model/Product/Type.php index 78a4dd754c6..9217fd82ab9 100644 --- a/app/code/Magento/Bundle/Model/Product/Type.php +++ b/app/code/Magento/Bundle/Model/Product/Type.php @@ -215,11 +215,11 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType /** * Return relation info about used products * - * @return \Magento\Framework\Object Object with information data + * @return \Magento\Framework\DataObject Object with information data */ public function getRelationInfo() { - $info = new \Magento\Framework\Object(); + $info = new \Magento\Framework\DataObject(); $info->setTable('catalog_product_bundle_selection') ->setParentFieldName('parent_product_id') ->setChildFieldName('product_id'); @@ -468,7 +468,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType * Retrieve bundle options items * * @param \Magento\Catalog\Model\Product $product - * @return \Magento\Framework\Object[] + * @return \Magento\Framework\DataObject[] */ public function getOptions($product) { @@ -558,12 +558,12 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType * so need to change quote item qty option value too. * * @param array $options - * @param \Magento\Framework\Object $option + * @param \Magento\Framework\DataObject $option * @param mixed $value * @param \Magento\Catalog\Model\Product $product * @return $this */ - public function updateQtyOption($options, \Magento\Framework\Object $option, $value, $product) + public function updateQtyOption($options, \Magento\Framework\DataObject $option, $value, $product) { $optionProduct = $option->getProduct($product); $optionUpdateFlag = $option->getHasQtyOptionUpdate(); @@ -664,7 +664,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType * Prepare product and its configuration to be added to some products list. * Perform standard preparation process and then prepare of bundle selections options. * - * @param \Magento\Framework\Object $buyRequest + * @param \Magento\Framework\DataObject $buyRequest * @param \Magento\Catalog\Model\Product $product * @param string $processMode * @return \Magento\Framework\Phrase|array|string @@ -672,7 +672,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType * @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - protected function _prepareProduct(\Magento\Framework\Object $buyRequest, $product, $processMode) + protected function _prepareProduct(\Magento\Framework\DataObject $buyRequest, $product, $processMode) { $result = parent::_prepareProduct($buyRequest, $product, $processMode); @@ -1095,7 +1095,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType $selectionIds = $product->getCustomOption('bundle_selection_ids'); $selectionIds = unserialize($selectionIds->getValue()); $buyRequest = $product->getCustomOption('info_buyRequest'); - $buyRequest = new \Magento\Framework\Object(unserialize($buyRequest->getValue())); + $buyRequest = new \Magento\Framework\DataObject(unserialize($buyRequest->getValue())); $bundleOption = $buyRequest->getBundleOption(); if (empty($bundleOption)) { @@ -1159,7 +1159,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType * Prepare selected options for bundle product * * @param \Magento\Catalog\Model\Product $product - * @param \Magento\Framework\Object $buyRequest + * @param \Magento\Framework\DataObject $buyRequest * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -1223,7 +1223,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType } /** - * @param \Magento\Framework\Object $selection + * @param \Magento\Framework\DataObject $selection * @param int[] $qtys * @param int $selectionOptionId * @return float @@ -1242,7 +1242,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType /** * @param \Magento\Catalog\Model\Product $product - * @param \Magento\Framework\Object $selection + * @param \Magento\Framework\DataObject $selection * @return float|int */ protected function getBeforeQty($product, $selection) @@ -1326,8 +1326,8 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType /** * @param \Magento\Catalog\Model\Product\Option[] $options - * @param \Magento\Framework\Object[] $selections - * @return \Magento\Framework\Object[] + * @param \Magento\Framework\DataObject[] $selections + * @return \Magento\Framework\DataObject[] */ protected function mergeSelectionsWithOptions($options, $selections) { diff --git a/app/code/Magento/Bundle/Model/Resource/Option.php b/app/code/Magento/Bundle/Model/Resource/Option.php index 90e45fed81b..5b9fd2774d3 100644 --- a/app/code/Magento/Bundle/Model/Resource/Option.php +++ b/app/code/Magento/Bundle/Model/Resource/Option.php @@ -59,7 +59,7 @@ class Option extends \Magento\Framework\Model\Resource\Db\AbstractDb $write = $this->_getWriteAdapter(); $write->delete($this->getTable('catalog_product_bundle_option_value'), $condition); - $data = new \Magento\Framework\Object(); + $data = new \Magento\Framework\DataObject(); $data->setOptionId($object->getId()) ->setStoreId($object->getStoreId()) ->setTitle($object->getTitle()); diff --git a/app/code/Magento/Bundle/Model/Resource/Option/Collection.php b/app/code/Magento/Bundle/Model/Resource/Option/Collection.php index b3f7d2dc072..ca49c03f014 100644 --- a/app/code/Magento/Bundle/Model/Resource/Option/Collection.php +++ b/app/code/Magento/Bundle/Model/Resource/Option/Collection.php @@ -101,7 +101,7 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac * @param \Magento\Bundle\Model\Resource\Selection\Collection $selectionsCollection * @param bool $stripBefore * @param bool $appendAll - * @return \Magento\Framework\Object[] + * @return \Magento\Framework\DataObject[] */ public function appendSelections($selectionsCollection, $stripBefore = false, $appendAll = true) { diff --git a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/AbstractItems.php b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/AbstractItems.php index a66b77563ea..b341bc3f797 100644 --- a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/AbstractItems.php +++ b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/AbstractItems.php @@ -15,7 +15,7 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra /** * Getting all available children for Invoice, Shipment or CreditMemo item * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return array */ public function getChildren($item) @@ -52,7 +52,7 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra /** * Retrieve is Shipment Separately flag for Item * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return bool * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ @@ -90,7 +90,7 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra /** * Retrieve is Child Calculated * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return bool * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ @@ -130,7 +130,7 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra /** * Retrieve Bundle Options * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -146,7 +146,7 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra /** * Retrieve Selection attributes * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return mixed */ public function getSelectionAttributes($item) @@ -165,7 +165,7 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra /** * Retrieve Order options * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ diff --git a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php index abb34010db4..c0dce741b72 100644 --- a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php +++ b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php @@ -13,7 +13,7 @@ class Creditmemo extends AbstractItems /** * Core string * - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -23,7 +23,7 @@ class Creditmemo extends AbstractItems * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Framework\Filesystem $filesystem * @param \Magento\Framework\Filter\FilterManager $filterManager - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection * @param array $data @@ -34,7 +34,7 @@ class Creditmemo extends AbstractItems \Magento\Tax\Helper\Data $taxData, \Magento\Framework\Filesystem $filesystem, \Magento\Framework\Filter\FilterManager $filterManager, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [] diff --git a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php index b35c32c9ab0..39e28dc29f1 100644 --- a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php +++ b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php @@ -14,7 +14,7 @@ namespace Magento\Bundle\Model\Sales\Order\Pdf\Items; class Invoice extends AbstractItems { /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -24,7 +24,7 @@ class Invoice extends AbstractItems * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Framework\Filesystem $filesystem * @param \Magento\Framework\Filter\FilterManager $filterManager - * @param \Magento\Framework\Stdlib\String $coreString + * @param \Magento\Framework\Stdlib\StringUtils $coreString * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection * @param array $data @@ -35,7 +35,7 @@ class Invoice extends AbstractItems \Magento\Tax\Helper\Data $taxData, \Magento\Framework\Filesystem $filesystem, \Magento\Framework\Filter\FilterManager $filterManager, - \Magento\Framework\Stdlib\String $coreString, + \Magento\Framework\Stdlib\StringUtils $coreString, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [] diff --git a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php index 4bc22561875..69161623b76 100644 --- a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php +++ b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php @@ -11,7 +11,7 @@ namespace Magento\Bundle\Model\Sales\Order\Pdf\Items; class Shipment extends AbstractItems { /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -21,7 +21,7 @@ class Shipment extends AbstractItems * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Framework\Filesystem $filesystem * @param \Magento\Framework\Filter\FilterManager $filterManager - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection * @param array $data @@ -32,7 +32,7 @@ class Shipment extends AbstractItems \Magento\Tax\Helper\Data $taxData, \Magento\Framework\Filesystem $filesystem, \Magento\Framework\Filter\FilterManager $filterManager, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [] diff --git a/app/code/Magento/Bundle/Test/Unit/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/OptionTest.php b/app/code/Magento/Bundle/Test/Unit/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/OptionTest.php index ee251ce7199..79acb09eeb9 100644 --- a/app/code/Magento/Bundle/Test/Unit/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/OptionTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/OptionTest.php @@ -9,9 +9,9 @@ class OptionTest extends \PHPUnit_Framework_TestCase { public function testGetAddButtonId() { - $button = new \Magento\Framework\Object(); + $button = new \Magento\Framework\DataObject(); - $itemsBlock = $this->getMock('Magento\Framework\Object', ['getChildBlock']); + $itemsBlock = $this->getMock('Magento\Framework\DataObject', ['getChildBlock']); $itemsBlock->expects( $this->atLeastOnce() )->method( @@ -22,7 +22,7 @@ class OptionTest extends \PHPUnit_Framework_TestCase $this->returnValue($button) ); - $layout = $this->getMock('Magento\Framework\Object', ['getBlock']); + $layout = $this->getMock('Magento\Framework\DataObject', ['getBlock']); $layout->expects( $this->atLeastOnce() )->method( diff --git a/app/code/Magento/Bundle/Test/Unit/Block/Catalog/Product/View/Type/Bundle/OptionTest.php b/app/code/Magento/Bundle/Test/Unit/Block/Catalog/Product/View/Type/Bundle/OptionTest.php index b2970ec96e1..b305b9a6cf6 100644 --- a/app/code/Magento/Bundle/Test/Unit/Block/Catalog/Product/View/Type/Bundle/OptionTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Block/Catalog/Product/View/Type/Bundle/OptionTest.php @@ -65,7 +65,7 @@ class OptionTest extends \PHPUnit_Framework_TestCase $this->product->expects($this->atLeastOnce()) ->method('getPreconfiguredValues') ->will($this->returnValue( - new \Magento\Framework\Object(['bundle_option' => [15 => 315, 16 => 316]])) + new \Magento\Framework\DataObject(['bundle_option' => [15 => 315, 16 => 316]])) ); $option = $this->getMock('\Magento\Bundle\Model\Option', [], [], '', false); diff --git a/app/code/Magento/Bundle/Test/Unit/Block/Catalog/Product/View/Type/BundleTest.php b/app/code/Magento/Bundle/Test/Unit/Block/Catalog/Product/View/Type/BundleTest.php index b99aca6f631..be11cf9564b 100644 --- a/app/code/Magento/Bundle/Test/Unit/Block/Catalog/Product/View/Type/BundleTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Block/Catalog/Product/View/Type/BundleTest.php @@ -9,7 +9,7 @@ namespace Magento\Bundle\Test\Unit\Block\Catalog\Product\View\Type; use Magento\Bundle\Block\Catalog\Product\View\Type\Bundle as BundleBlock; -use Magento\Framework\Object as MagentoObject; +use Magento\Framework\DataObject as MagentoObject; class BundleTest extends \PHPUnit_Framework_TestCase { @@ -205,7 +205,7 @@ class BundleTest extends \PHPUnit_Framework_TestCase $this->product->expects($this->once()) ->method('hasPreconfiguredValues') ->will($this->returnValue(true)); - $preconfiguredValues = new \Magento\Framework\Object( + $preconfiguredValues = new \Magento\Framework\DataObject( [ 'bundle_option' => [ 1 => 123123111 diff --git a/app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php b/app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php index e4f49d48adc..a7c1ac5af2c 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php @@ -228,7 +228,7 @@ class LinkManagementTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue([$this->option])); $this->option->expects($this->any())->method('getOptionId')->will($this->returnValue(10)); - $this->option->expects($this->never())->method('getSelections'); + $this->option->expects($this->once())->method('getSelections')->willReturn([1, 2]); $this->dataObjectHelperMock->expects($this->never())->method('populateWithArray'); diff --git a/app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php b/app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php index 7f2a9cbb758..c0af9e9e41d 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php @@ -143,8 +143,8 @@ class TypeTest extends \PHPUnit_Framework_TestCase ) ->disableOriginalConstructor() ->getMock(); - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Object $buyRequest */ - $buyRequest = $this->getMockBuilder('Magento\Framework\Object') + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\DataObject $buyRequest */ + $buyRequest = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods( ['__wakeup', 'getOptions', 'getSuperProductConfig', 'unsetData', 'getData', 'getQty', 'getBundleOption'] ) @@ -257,8 +257,8 @@ class TypeTest extends \PHPUnit_Framework_TestCase ) ->disableOriginalConstructor() ->getMock(); - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Object $buyRequest */ - $buyRequest = $this->getMockBuilder('Magento\Framework\Object') + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\DataObject $buyRequest */ + $buyRequest = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods( [ '__wakeup', @@ -294,8 +294,8 @@ class TypeTest extends \PHPUnit_Framework_TestCase ->setMethods(['getItems']) ->disableOriginalConstructor() ->getMock(); - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Object $buyRequest */ - $selection = $this->getMockBuilder('Magento\Framework\Object') + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\DataObject $buyRequest */ + $selection = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods( [ '__wakeup', @@ -497,8 +497,8 @@ class TypeTest extends \PHPUnit_Framework_TestCase ) ->disableOriginalConstructor() ->getMock(); - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Object $buyRequest */ - $buyRequest = $this->getMockBuilder('Magento\Framework\Object') + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\DataObject $buyRequest */ + $buyRequest = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods( [ '__wakeup', @@ -534,8 +534,8 @@ class TypeTest extends \PHPUnit_Framework_TestCase ->setMethods(['getItems']) ->disableOriginalConstructor() ->getMock(); - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Object $buyRequest */ - $selection = $this->getMockBuilder('Magento\Framework\Object') + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\DataObject $buyRequest */ + $selection = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods( [ '__wakeup', @@ -716,8 +716,8 @@ class TypeTest extends \PHPUnit_Framework_TestCase ) ->disableOriginalConstructor() ->getMock(); - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Object $buyRequest */ - $buyRequest = $this->getMockBuilder('Magento\Framework\Object') + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\DataObject $buyRequest */ + $buyRequest = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods( [ '__wakeup', @@ -753,8 +753,8 @@ class TypeTest extends \PHPUnit_Framework_TestCase ->setMethods(['getItems']) ->disableOriginalConstructor() ->getMock(); - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Object $buyRequest */ - $selection = $this->getMockBuilder('Magento\Framework\Object') + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\DataObject $buyRequest */ + $selection = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods( [ '__wakeup', @@ -930,8 +930,8 @@ class TypeTest extends \PHPUnit_Framework_TestCase ) ->disableOriginalConstructor() ->getMock(); - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Object $buyRequest */ - $buyRequest = $this->getMockBuilder('Magento\Framework\Object') + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\DataObject $buyRequest */ + $buyRequest = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods( [ '__wakeup', @@ -1036,8 +1036,8 @@ class TypeTest extends \PHPUnit_Framework_TestCase ) ->disableOriginalConstructor() ->getMock(); - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Object $buyRequest */ - $buyRequest = $this->getMockBuilder('Magento\Framework\Object') + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\DataObject $buyRequest */ + $buyRequest = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods( ['__wakeup', 'getOptions', 'getSuperProductConfig', 'unsetData', 'getData', 'getQty', 'getBundleOption'] ) @@ -1053,8 +1053,8 @@ class TypeTest extends \PHPUnit_Framework_TestCase ->setMethods(['getItems']) ->disableOriginalConstructor() ->getMock(); - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Object $buyRequest */ - $selection = $this->getMockBuilder('Magento\Framework\Object') + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\DataObject $buyRequest */ + $selection = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods(['__wakeup', 'isSalable', 'getOptionId']) ->disableOriginalConstructor() ->getMock(); @@ -1164,8 +1164,8 @@ class TypeTest extends \PHPUnit_Framework_TestCase ) ->disableOriginalConstructor() ->getMock(); - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Object $buyRequest */ - $buyRequest = $this->getMockBuilder('Magento\Framework\Object') + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\DataObject $buyRequest */ + $buyRequest = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods( ['__wakeup', 'getOptions', 'getSuperProductConfig', 'unsetData', 'getData', 'getQty', 'getBundleOption'] ) @@ -1181,8 +1181,8 @@ class TypeTest extends \PHPUnit_Framework_TestCase ->setMethods(['getItems']) ->disableOriginalConstructor() ->getMock(); - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Object $buyRequest */ - $selection = $this->getMockBuilder('Magento\Framework\Object') + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\DataObject $buyRequest */ + $selection = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods(['__wakeup', 'isSalable', 'getOptionId']) ->disableOriginalConstructor() ->getMock(); @@ -1280,8 +1280,8 @@ class TypeTest extends \PHPUnit_Framework_TestCase public function testPrepareForCartAdvancedParentClassReturnString() { $exceptedResult = 'String message'; - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Object $buyRequest */ - $buyRequest = $this->getMockBuilder('Magento\Framework\Object') + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\DataObject $buyRequest */ + $buyRequest = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods(['getItems', '__wakeup']) ->disableOriginalConstructor() ->getMock(); @@ -1310,8 +1310,8 @@ class TypeTest extends \PHPUnit_Framework_TestCase ) ->disableOriginalConstructor() ->getMock(); - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Object $buyRequest */ - $buyRequest = $this->getMockBuilder('Magento\Framework\Object') + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\DataObject $buyRequest */ + $buyRequest = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods( ['__wakeup', 'getOptions', 'getSuperProductConfig', 'unsetData', 'getData', 'getQty', 'getBundleOption'] ) @@ -1410,8 +1410,8 @@ class TypeTest extends \PHPUnit_Framework_TestCase ) ->disableOriginalConstructor() ->getMock(); - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Object $buyRequest */ - $buyRequest = $this->getMockBuilder('Magento\Framework\Object') + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\DataObject $buyRequest */ + $buyRequest = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods( ['__wakeup', 'getOptions', 'getSuperProductConfig', 'unsetData', 'getData', 'getQty', 'getBundleOption'] ) @@ -1540,7 +1540,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase ->setMethods(['getValue', '__wakeup']) ->disableOriginalConstructor() ->getMock(); - $selectionItemMock = $this->getMockBuilder('Magento\Framework\Object') + $selectionItemMock = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods(['getSku', '__wakeup']) ->disableOriginalConstructor() ->getMock(); @@ -1617,7 +1617,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase ->setMethods(['getValue', '__wakeup']) ->disableOriginalConstructor() ->getMock(); - $selectionItemMock = $this->getMockBuilder('Magento\Framework\Object') + $selectionItemMock = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods(['getSelectionId', 'getWeight', '__wakeup']) ->disableOriginalConstructor() ->getMock(); @@ -1675,7 +1675,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase ->setMethods(['getValue', '__wakeup']) ->disableOriginalConstructor() ->getMock(); - $selectionItemMock = $this->getMockBuilder('Magento\Framework\Object') + $selectionItemMock = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods(['getSelectionId', 'getWeight', '__wakeup']) ->disableOriginalConstructor() ->getMock(); @@ -1746,7 +1746,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase ->setMethods(['getValue', '__wakeup']) ->disableOriginalConstructor() ->getMock(); - $selectionItemMock = $this->getMockBuilder('Magento\Framework\Object') + $selectionItemMock = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods(['isVirtual', 'getItems', '__wakeup']) ->disableOriginalConstructor() ->getMock(); @@ -2060,7 +2060,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase */ public function testIsSalableFalse() { - $product = new \Magento\Framework\Object( + $product = new \Magento\Framework\DataObject( [ 'is_salable' => false, 'status' => \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED @@ -2079,7 +2079,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $product = new \Magento\Framework\Object( + $product = new \Magento\Framework\DataObject( [ 'is_salable' => true, '_cache_instance_options_collection' => $optionCollectionMock, @@ -2125,7 +2125,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase $optionCollectionMock = $this->getOptionCollectionMock([$option1, $option2, $option3]); $selectionCollectionMock = $this->getSelectionCollectionMock([$option1, $option2]); - $product = new \Magento\Framework\Object( + $product = new \Magento\Framework\DataObject( [ 'is_salable' => true, '_cache_instance_options_collection' => $optionCollectionMock, @@ -2142,7 +2142,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase */ public function testIsSalableCache() { - $product = new \Magento\Framework\Object( + $product = new \Magento\Framework\DataObject( [ 'is_salable' => true, 'status' => \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED, @@ -2162,7 +2162,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase $optionCollectionMock = $this->getOptionCollectionMock([$option]); $selectionCollectionMock = $this->getSelectionCollectionMock([]); - $product = new \Magento\Framework\Object( + $product = new \Magento\Framework\DataObject( [ 'is_salable' => true, '_cache_instance_options_collection' => $optionCollectionMock, @@ -2207,7 +2207,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase $optionCollectionMock = $this->getOptionCollectionMock([$option1, $option2]); $selectionCollectionMock = $this->getSelectionCollectionMock([$option1, $option2]); - $product = new \Magento\Framework\Object( + $product = new \Magento\Framework\DataObject( [ 'is_salable' => true, '_cache_instance_options_collection' => $optionCollectionMock, @@ -2246,7 +2246,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase $optionCollectionMock = $this->getOptionCollectionMock([$option1, $option2]); $selectionCollectionMock = $this->getSelectionCollectionMock([$option1, $option2]); - $product = new \Magento\Framework\Object( + $product = new \Magento\Framework\DataObject( [ 'is_salable' => true, '_cache_instance_options_collection' => $optionCollectionMock, @@ -2367,7 +2367,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase /** * @param \PHPUnit_Framework_MockObject_MockObject|DefaultType $group * @param \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Model\Product\Option $option - * @param \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Object $buyRequest + * @param \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\DataObject $buyRequest * @param \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Model\Product $product * @return void */ @@ -2627,7 +2627,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase $product = $this->getMockBuilder('Magento\Catalog\Model\Product') ->disableOriginalConstructor() ->getMock(); - $buyRequest = $this->getMockBuilder('Magento\Framework\Object') + $buyRequest = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->setMethods(['getBundleOption', 'getBundleOptionQty']) ->getMock(); @@ -2647,7 +2647,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase ->setMethods(['getItems']) ->disableOriginalConstructor() ->getMock(); - $item = $this->getMockBuilder('Magento\Framework\Object') + $item = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->setMethods(['getId', 'getRequired']) ->getMock(); diff --git a/app/code/Magento/CacheInvalidate/Model/Observer.php b/app/code/Magento/CacheInvalidate/Model/Observer.php index ece5eca4962..280ff7e5c7c 100644 --- a/app/code/Magento/CacheInvalidate/Model/Observer.php +++ b/app/code/Magento/CacheInvalidate/Model/Observer.php @@ -65,7 +65,7 @@ class Observer { if ($this->_config->getType() == \Magento\PageCache\Model\Config::VARNISH && $this->_config->isEnabled()) { $object = $observer->getEvent()->getObject(); - if ($object instanceof \Magento\Framework\Object\IdentityInterface) { + if ($object instanceof \Magento\Framework\DataObject\IdentityInterface) { $tags = []; $pattern = "((^|,)%s(,|$))"; foreach ($object->getIdentities() as $tag) { diff --git a/app/code/Magento/CacheInvalidate/Test/Unit/Model/ObserverTest.php b/app/code/Magento/CacheInvalidate/Test/Unit/Model/ObserverTest.php index 1abb97b56f9..eddb6d739a7 100644 --- a/app/code/Magento/CacheInvalidate/Test/Unit/Model/ObserverTest.php +++ b/app/code/Magento/CacheInvalidate/Test/Unit/Model/ObserverTest.php @@ -25,7 +25,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase /** @var \PHPUnit_Framework_MockObject_MockObject */ protected $logger; - /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Object\ */ + /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\DataObject\ */ protected $_observerObject; /** diff --git a/app/code/Magento/Captcha/Controller/Refresh/Index.php b/app/code/Magento/Captcha/Controller/Refresh/Index.php index 9e43822d015..f12d17afaa9 100644 --- a/app/code/Magento/Captcha/Controller/Refresh/Index.php +++ b/app/code/Magento/Captcha/Controller/Refresh/Index.php @@ -35,7 +35,11 @@ class Index extends \Magento\Framework\App\Action\Action $formId = $this->_request->getPost('formId'); if (null === $formId) { try { - $params = \Zend_Json::decode($this->_request->getContent()); + $params = []; + $content = $this->_request->getContent(); + if ($content) { + $params = \Zend_Json::decode($content); + } $formId = isset($params['formId']) ? $params['formId'] : null; } catch (\Zend_Json_Exception $exception) { $formId = null; diff --git a/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php b/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php index 65cb2d8612a..9f1dcff38b6 100644 --- a/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php +++ b/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php @@ -51,11 +51,11 @@ class AjaxLogin /** * @param \Magento\Customer\Controller\Ajax\Login $subject - * @param callable $proceed + * @param \Closure $proceed * @return $this - * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Zend_Json_Exception * @SuppressWarnings(PHPMD.NPathComplexity) + * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function aroundExecute( \Magento\Customer\Controller\Ajax\Login $subject, @@ -67,7 +67,11 @@ class AjaxLogin /** @var \Magento\Framework\App\RequestInterface $request */ $request = $subject->getRequest(); - $loginParams = \Zend_Json::decode($request->getContent()); + $loginParams = []; + $content = $request->getContent(); + if ($content) { + $loginParams = \Zend_Json::decode($content); + } $username = isset($loginParams['username']) ? $loginParams['username'] : null; $captchaString = isset($loginParams[$captchaInputName]) ? $loginParams[$captchaInputName] : null; $loginFormId = isset($loginParams[$captchaFormIdField]) ? $loginParams[$captchaFormIdField] : null; diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php index 749e52862fa..3dc9a692b7f 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php @@ -368,7 +368,7 @@ class Tree extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory /** * Get category name * - * @param \Magento\Framework\Object $node + * @param \Magento\Framework\DataObject $node * @return string */ public function buildNodeName($node) @@ -386,7 +386,7 @@ class Tree extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory */ protected function _isCategoryMoveable($node) { - $options = new \Magento\Framework\Object(['is_moveable' => true, 'category' => $node]); + $options = new \Magento\Framework\DataObject(['is_moveable' => true, 'category' => $node]); $this->_eventManager->dispatch('adminhtml_catalog_category_tree_is_moveable', ['options' => $options]); @@ -426,7 +426,7 @@ class Tree extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory */ public function canAddRootCategory() { - $options = new \Magento\Framework\Object(['is_allow' => true]); + $options = new \Magento\Framework\DataObject(['is_allow' => true]); $this->_eventManager->dispatch( 'adminhtml_catalog_category_tree_can_add_root_category', ['category' => $this->getCategory(), 'options' => $options, 'store' => $this->getStore()->getId()] @@ -442,7 +442,7 @@ class Tree extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory */ public function canAddSubCategory() { - $options = new \Magento\Framework\Object(['is_allow' => true]); + $options = new \Magento\Framework\DataObject(['is_allow' => true]); $this->_eventManager->dispatch( 'adminhtml_catalog_category_tree_can_add_sub_category', ['category' => $this->getCategory(), 'options' => $options, 'store' => $this->getStore()->getId()] diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Main.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Main.php index a5048a3e4fe..270d8a4cd4b 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Main.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Main.php @@ -58,7 +58,7 @@ class Main extends AbstractMain ]; } - $response = new \Magento\Framework\Object(); + $response = new \Magento\Framework\DataObject(); $response->setTypes([]); $this->_eventManager->dispatch('adminhtml_product_attribute_types', ['response' => $response]); $_hiddenFields = []; diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/NewAttribute/Product/Attributes.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/NewAttribute/Product/Attributes.php index a5d7eba7fc4..e1dc2df857b 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/NewAttribute/Product/Attributes.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/NewAttribute/Product/Attributes.php @@ -66,7 +66,7 @@ class Attributes extends \Magento\Catalog\Block\Adminhtml\Form 'boolean' => 'Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Boolean', ]; - $response = new \Magento\Framework\Object(); + $response = new \Magento\Framework\DataObject(); $response->setTypes([]); $this->_eventManager->dispatch('adminhtml_catalog_product_edit_element_types', ['response' => $response]); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php index 3c38b075a9c..3f5f4d9f3a9 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php @@ -99,7 +99,7 @@ class Attributes extends \Magento\Catalog\Block\Adminhtml\Form implements /** * Retrieve attributes for product mass update * - * @return \Magento\Framework\Object[] + * @return \Magento\Framework\DataObject[] */ public function getAttributes() { diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php index d72539539a1..c56b87efe5c 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php @@ -153,7 +153,7 @@ class Attributes extends \Magento\Catalog\Block\Adminhtml\Form 'textarea' => 'Magento\Catalog\Block\Adminhtml\Helper\Form\Wysiwyg', ]; - $response = new \Magento\Framework\Object(); + $response = new \Magento\Framework\DataObject(); $response->setTypes([]); $this->_eventManager->dispatch('adminhtml_catalog_product_edit_element_types', ['response' => $response]); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Create.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Create.php index 3d295b0a1cb..d55733f83e5 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Create.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Create.php @@ -18,19 +18,19 @@ class Create extends Button /** * Config of create new attribute * - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $_config = null; /** * Retrieve config of new attribute creation * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getConfig() { if ($this->_config === null) { - $this->_config = new \Magento\Framework\Object(); + $this->_config = new \Magento\Framework\DataObject(); } return $this->_config; diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php index 8945cb8b414..f507d9ee30e 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php @@ -22,7 +22,7 @@ class Option extends Widget protected $_productInstance; /** - * @var \Magento\Framework\Object[] + * @var \Magento\Framework\DataObject[] */ protected $_values; @@ -270,7 +270,7 @@ class Option extends Widget } /** - * @return \Magento\Framework\Object[] + * @return \Magento\Framework\DataObject[] * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) @@ -380,7 +380,7 @@ class Option extends Widget $value['scopePriceDisabled'] = is_null($option->getStorePrice()) ? 'disabled' : null; } } - $values[] = new \Magento\Framework\Object($value); + $values[] = new \Magento\Framework\DataObject($value); } $this->_values = $values; } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Popup/Grid.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Popup/Grid.php index ab0acdbf63b..d1683071dd1 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Popup/Grid.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Popup/Grid.php @@ -21,7 +21,7 @@ class Grid extends \Magento\Catalog\Block\Adminhtml\Product\Grid /** * Return empty row url for disabling JS click events * - * @param Product|\Magento\Framework\Object $row + * @param Product|\Magento\Framework\DataObject $row * @return string|null * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php index b393a3632ea..744172c4d9f 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php @@ -433,7 +433,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended } /** - * @param \Magento\Catalog\Model\Product|\Magento\Framework\Object $row + * @param \Magento\Catalog\Model\Product|\Magento\Framework\DataObject $row * @return string */ public function getRowUrl($row) diff --git a/app/code/Magento/Catalog/Block/Category/View.php b/app/code/Magento/Catalog/Block/Category/View.php index da0fdb2ac73..dded286fb38 100644 --- a/app/code/Magento/Catalog/Block/Category/View.php +++ b/app/code/Magento/Catalog/Block/Category/View.php @@ -9,7 +9,7 @@ namespace Magento\Catalog\Block\Category; * Class View * @package Magento\Catalog\Block\Category */ -class View extends \Magento\Framework\View\Element\Template implements \Magento\Framework\Object\IdentityInterface +class View extends \Magento\Framework\View\Element\Template implements \Magento\Framework\DataObject\IdentityInterface { /** * Core registry diff --git a/app/code/Magento/Catalog/Block/Navigation.php b/app/code/Magento/Catalog/Block/Navigation.php index 0d742028060..1676fc6accb 100644 --- a/app/code/Magento/Catalog/Block/Navigation.php +++ b/app/code/Magento/Catalog/Block/Navigation.php @@ -17,7 +17,7 @@ use Magento\Customer\Model\Context; * @SuppressWarnings(PHPMD.LongVariable) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Navigation extends \Magento\Framework\View\Element\Template implements \Magento\Framework\Object\IdentityInterface +class Navigation extends \Magento\Framework\View\Element\Template implements \Magento\Framework\DataObject\IdentityInterface { /** * @var Category @@ -196,7 +196,7 @@ class Navigation extends \Magento\Framework\View\Element\Template implements \Ma /** * Checkin activity of category * - * @param \Magento\Framework\Object $category + * @param \Magento\Framework\DataObject $category * @return bool */ public function isCategoryActive($category) diff --git a/app/code/Magento/Catalog/Block/Product/AbstractProduct.php b/app/code/Magento/Catalog/Block/Product/AbstractProduct.php index 08617d3ebd8..0d836f12182 100644 --- a/app/code/Magento/Catalog/Block/Product/AbstractProduct.php +++ b/app/code/Magento/Catalog/Block/Product/AbstractProduct.php @@ -393,7 +393,7 @@ class AbstractProduct extends \Magento\Framework\View\Element\Template */ public function displayProductStockStatus() { - $statusInfo = new \Magento\Framework\Object(['display_status' => true]); + $statusInfo = new \Magento\Framework\DataObject(['display_status' => true]); $this->_eventManager->dispatch('catalog_block_product_status_display', ['status' => $statusInfo]); return (bool) $statusInfo->getDisplayStatus(); } diff --git a/app/code/Magento/Catalog/Block/Product/ListProduct.php b/app/code/Magento/Catalog/Block/Product/ListProduct.php index 7be200b769c..a20fcd7b9cf 100644 --- a/app/code/Magento/Catalog/Block/Product/ListProduct.php +++ b/app/code/Magento/Catalog/Block/Product/ListProduct.php @@ -11,7 +11,7 @@ use Magento\Catalog\Model\Category; use Magento\Catalog\Model\Product; use Magento\Eav\Model\Entity\Collection\AbstractCollection; use Magento\Framework\Exception\NoSuchEntityException; -use Magento\Framework\Object\IdentityInterface; +use Magento\Framework\DataObject\IdentityInterface; /** * Product list diff --git a/app/code/Magento/Catalog/Block/Product/NewProduct.php b/app/code/Magento/Catalog/Block/Product/NewProduct.php index d987a78a43f..70723bf87cf 100644 --- a/app/code/Magento/Catalog/Block/Product/NewProduct.php +++ b/app/code/Magento/Catalog/Block/Product/NewProduct.php @@ -13,7 +13,7 @@ use Magento\Customer\Model\Context as CustomerContext; * @SuppressWarnings(PHPMD.LongVariable) */ class NewProduct extends \Magento\Catalog\Block\Product\AbstractProduct implements - \Magento\Framework\Object\IdentityInterface + \Magento\Framework\DataObject\IdentityInterface { /** * Default value for products count that will be shown diff --git a/app/code/Magento/Catalog/Block/Product/Price.php b/app/code/Magento/Catalog/Block/Product/Price.php index dac1492452c..70e58428175 100644 --- a/app/code/Magento/Catalog/Block/Product/Price.php +++ b/app/code/Magento/Catalog/Block/Product/Price.php @@ -9,7 +9,7 @@ namespace Magento\Catalog\Block\Product; /** * Product price block */ -class Price extends \Magento\Framework\View\Element\Template implements \Magento\Framework\Object\IdentityInterface +class Price extends \Magento\Framework\View\Element\Template implements \Magento\Framework\DataObject\IdentityInterface { /** * @var null @@ -36,7 +36,7 @@ class Price extends \Magento\Framework\View\Element\Template implements \Magento protected $_catalogData = null; /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -60,7 +60,7 @@ class Price extends \Magento\Framework\View\Element\Template implements \Magento * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\Math\Random $mathRandom * @param \Magento\Checkout\Helper\Cart $cartHelper * @param array $data @@ -70,7 +70,7 @@ class Price extends \Magento\Framework\View\Element\Template implements \Magento \Magento\Framework\Json\EncoderInterface $jsonEncoder, \Magento\Catalog\Helper\Data $catalogData, \Magento\Framework\Registry $registry, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\Math\Random $mathRandom, \Magento\Checkout\Helper\Cart $cartHelper, array $data = [] diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Related.php b/app/code/Magento/Catalog/Block/Product/ProductList/Related.php index 78a9e8c4594..05d0342aebc 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Related.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Related.php @@ -16,7 +16,7 @@ use Magento\Framework\View\Element\AbstractBlock; * * @SuppressWarnings(PHPMD.LongVariable) */ -class Related extends \Magento\Catalog\Block\Product\AbstractProduct implements \Magento\Framework\Object\IdentityInterface +class Related extends \Magento\Catalog\Block\Product\AbstractProduct implements \Magento\Framework\DataObject\IdentityInterface { /** * @var Collection diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php b/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php index 29be0868558..dad32706434 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php @@ -632,7 +632,7 @@ class Toolbar extends \Magento\Framework\View\Element\Template { $pagerBlock = $this->getChildBlock('product_list_toolbar_pager'); - if ($pagerBlock instanceof \Magento\Framework\Object) { + if ($pagerBlock instanceof \Magento\Framework\DataObject) { /* @var $pagerBlock \Magento\Theme\Block\Html\Pager */ $pagerBlock->setAvailableLimit($this->getAvailableLimit()); @@ -680,9 +680,11 @@ class Toolbar extends \Magento\Framework\View\Element\Template 'modeCookie' => ToolbarModel::MODE_COOKIE_NAME, 'directionCookie' => ToolbarModel::DIRECTION_COOKIE_NAME, 'orderCookie' => ToolbarModel::ORDER_COOKIE_NAME, - 'limitCookie' => ToolbarModel::LIMIT_COOKIE_NAME, - 'postData' => json_decode($postData), + 'limitCookie' => ToolbarModel::LIMIT_COOKIE_NAME ]; + if ($postData) { + $options['postData'] = json_decode($postData); + } $options = array_replace_recursive($options, $customOptions); return json_encode(['productListToolbarForm' => $options]); } diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php index 10c2e4763f9..882440fc867 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php @@ -16,7 +16,7 @@ use Magento\Framework\View\Element\AbstractBlock; * * @SuppressWarnings(PHPMD.LongVariable) */ -class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct implements \Magento\Framework\Object\IdentityInterface +class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct implements \Magento\Framework\DataObject\IdentityInterface { /** * @var int @@ -24,7 +24,7 @@ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct implements \ protected $_columnCount = 4; /** - * @var \Magento\Framework\Object[] + * @var \Magento\Framework\DataObject[] */ protected $_items; @@ -138,7 +138,7 @@ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct implements \ } /** - * @return \Magento\Framework\Object[] + * @return \Magento\Framework\DataObject[] */ public function getItems() { diff --git a/app/code/Magento/Catalog/Block/Product/View.php b/app/code/Magento/Catalog/Block/Product/View.php index cd345d8a27f..d187d220a31 100644 --- a/app/code/Magento/Catalog/Block/Product/View.php +++ b/app/code/Magento/Catalog/Block/Product/View.php @@ -12,12 +12,12 @@ use Magento\Catalog\Model\Product; * Product View block * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class View extends AbstractProduct implements \Magento\Framework\Object\IdentityInterface +class View extends AbstractProduct implements \Magento\Framework\DataObject\IdentityInterface { /** * Magento string lib * - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -65,7 +65,7 @@ class View extends AbstractProduct implements \Magento\Framework\Object\Identity * @param Context $context * @param \Magento\Framework\Url\EncoderInterface $urlEncoder * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Catalog\Helper\Product $productHelper * @param \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig * @param \Magento\Framework\Locale\FormatInterface $localeFormat @@ -80,7 +80,7 @@ class View extends AbstractProduct implements \Magento\Framework\Object\Identity \Magento\Catalog\Block\Product\Context $context, \Magento\Framework\Url\EncoderInterface $urlEncoder, \Magento\Framework\Json\EncoderInterface $jsonEncoder, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Catalog\Helper\Product $productHelper, \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig, \Magento\Framework\Locale\FormatInterface $localeFormat, @@ -260,7 +260,7 @@ class View extends AbstractProduct implements \Magento\Framework\Object\Identity 'tierPrices' => $tierPrices ]; - $responseObject = new \Magento\Framework\Object(); + $responseObject = new \Magento\Framework\DataObject(); $this->_eventManager->dispatch('catalog_product_view_config', ['response_object' => $responseObject]); if (is_array($responseObject->getAdditionalOptions())) { foreach ($responseObject->getAdditionalOptions() as $option => $value) { diff --git a/app/code/Magento/Catalog/Block/Product/View/Gallery.php b/app/code/Magento/Catalog/Block/Product/View/Gallery.php index 9f7bab58554..db41d18a121 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Gallery.php +++ b/app/code/Magento/Catalog/Block/Product/View/Gallery.php @@ -28,7 +28,7 @@ class Gallery extends \Magento\Catalog\Block\Product\View\AbstractView /** * Retrieve gallery url * - * @param null|\Magento\Framework\Object $image + * @param null|\Magento\Framework\DataObject $image * @return string */ public function getGalleryUrl($image = null) @@ -43,7 +43,7 @@ class Gallery extends \Magento\Catalog\Block\Product\View\AbstractView /** * Get gallery image url * - * @param \Magento\Framework\Object $image + * @param \Magento\Framework\DataObject $image * @param string $type * @param boolean $whiteBorders * @param null|number $width @@ -64,7 +64,7 @@ class Gallery extends \Magento\Catalog\Block\Product\View\AbstractView /** * Is product main image * - * @param \Magento\Framework\Object $image + * @param \Magento\Framework\DataObject $image * @return bool */ public function isMainImage($image) diff --git a/app/code/Magento/Catalog/Block/Product/View/Options.php b/app/code/Magento/Catalog/Block/Product/View/Options.php index db3d2a91103..7086edbd40c 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Options.php +++ b/app/code/Magento/Catalog/Block/Product/View/Options.php @@ -219,7 +219,7 @@ class Options extends \Magento\Framework\View\Element\Template $config[$option->getId()] = $priceValue; } - $configObj = new \Magento\Framework\Object( + $configObj = new \Magento\Framework\DataObject( [ 'config' => $config, ] diff --git a/app/code/Magento/Catalog/Block/Product/View/Options/Type/File.php b/app/code/Magento/Catalog/Block/Product/View/Options/Type/File.php index fa44bf02b14..9c85927c849 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Options/Type/File.php +++ b/app/code/Magento/Catalog/Block/Product/View/Options/Type/File.php @@ -22,9 +22,9 @@ class File extends \Magento\Catalog\Block\Product\View\Options\AbstractOptions { $info = $this->getProduct()->getPreconfiguredValues()->getData('options/' . $this->getOption()->getId()); if (empty($info)) { - $info = new \Magento\Framework\Object(); + $info = new \Magento\Framework\DataObject(); } elseif (is_array($info)) { - $info = new \Magento\Framework\Object($info); + $info = new \Magento\Framework\DataObject($info); } return $info; } diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php index 8834b03f6a8..3c308d5deea 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php @@ -93,7 +93,7 @@ class Edit extends \Magento\Catalog\Controller\Adminhtml\Category } } - $eventResponse = new \Magento\Framework\Object([ + $eventResponse = new \Magento\Framework\DataObject([ 'content' => $resultPage->getLayout()->getBlock('category.edit')->getFormHtml() . $resultPage->getLayout()->getBlock('category.tree') ->getBreadcrumbsJavascript($breadcrumbsPath, 'editingCategoryBreadcrumbs'), diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php index 310c50fb932..ac0b303f18d 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php @@ -116,7 +116,10 @@ class Save extends \Magento\Catalog\Controller\Adminhtml\Category $category->setAttributeSetId($category->getDefaultAttributeSetId()); - if (isset($data['category_products']) && !$category->getProductsReadonly()) { + if (isset($data['category_products']) + && is_string($data['category_products']) + && !$category->getProductsReadonly() + ) { $products = json_decode($data['category_products'], true); $category->setPostedProducts($products); } diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Validate.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Validate.php index 096e32642cb..a7f2da57762 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Validate.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Validate.php @@ -42,7 +42,7 @@ class Validate extends \Magento\Catalog\Controller\Adminhtml\Product\Action\Attr */ public function execute() { - $response = $this->_objectManager->create('Magento\Framework\Object'); + $response = $this->_objectManager->create('Magento\Framework\DataObject'); $response->setError(false); $attributesData = $this->getRequest()->getParam('attributes', []); $data = $this->_objectManager->create('Magento\Catalog\Model\Product'); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php index 6cd7b5d2546..a26862db4d2 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php @@ -62,7 +62,7 @@ class AddAttributeToTemplate extends \Magento\Catalog\Controller\Adminhtml\Produ $resultJson->setJsonData($attribute->toJson()); } catch (\Exception $e) { - $response = new \Magento\Framework\Object(); + $response = new \Magento\Framework\DataObject(); $response->setError(false); $response->setMessage($e->getMessage()); $resultJson->setJsonData($response->toJson()); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php index f4db052d14a..9c50b8f3145 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php @@ -46,7 +46,7 @@ class Validate extends \Magento\Catalog\Controller\Adminhtml\Product\Attribute */ public function execute() { - $response = new \Magento\Framework\Object(); + $response = new \Magento\Framework\DataObject(); $response->setError(false); $attributeCode = $this->getRequest()->getParam('attribute_code'); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/ShowUpdateResult.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/ShowUpdateResult.php index fafde250a73..d7e4db8dbb7 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/ShowUpdateResult.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/ShowUpdateResult.php @@ -39,7 +39,7 @@ class ShowUpdateResult extends \Magento\Catalog\Controller\Adminhtml\Product { $layout = false; if ($this->_session->hasCompositeProductResult() - && $this->_session->getCompositeProductResult() instanceof \Magento\Framework\Object + && $this->_session->getCompositeProductResult() instanceof \Magento\Framework\DataObject ) { $layout = $this->productCompositeHelper->renderUpdateResult($this->_session->getCompositeProductResult()); } diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Validate.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Validate.php index 1992bfc3de3..82e68cd1c94 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Validate.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Validate.php @@ -74,7 +74,7 @@ class Validate extends \Magento\Catalog\Controller\Adminhtml\Product */ public function execute() { - $response = new \Magento\Framework\Object(); + $response = new \Magento\Framework\DataObject(); $response->setError(false); try { diff --git a/app/code/Magento/Catalog/Controller/Product.php b/app/code/Magento/Catalog/Controller/Product.php index 4fd20839f0c..281a9304934 100644 --- a/app/code/Magento/Catalog/Controller/Product.php +++ b/app/code/Magento/Catalog/Controller/Product.php @@ -22,7 +22,7 @@ abstract class Product extends \Magento\Framework\App\Action\Action implements V $categoryId = (int)$this->getRequest()->getParam('category', false); $productId = (int)$this->getRequest()->getParam('id'); - $params = new \Magento\Framework\Object(); + $params = new \Magento\Framework\DataObject(); $params->setCategoryId($categoryId); /** @var \Magento\Catalog\Helper\Product $product */ diff --git a/app/code/Magento/Catalog/Controller/Product/View.php b/app/code/Magento/Catalog/Controller/Product/View.php index 9cdee4fc826..aed317633da 100644 --- a/app/code/Magento/Catalog/Controller/Product/View.php +++ b/app/code/Magento/Catalog/Controller/Product/View.php @@ -99,7 +99,7 @@ class View extends \Magento\Catalog\Controller\Product } // Prepare helper and params - $params = new \Magento\Framework\Object(); + $params = new \Magento\Framework\DataObject(); $params->setCategoryId($categoryId); $params->setSpecifyOptions($specifyOptions); diff --git a/app/code/Magento/Catalog/Helper/Data.php b/app/code/Magento/Catalog/Helper/Data.php index 67a8a541bb0..9c40f2840f0 100644 --- a/app/code/Magento/Catalog/Helper/Data.php +++ b/app/code/Magento/Catalog/Helper/Data.php @@ -79,7 +79,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper protected $_catalogCategory; /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -185,7 +185,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Session $catalogSession - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param Category $catalogCategory * @param Product $catalogProduct * @param \Magento\Framework\Registry $coreRegistry @@ -209,7 +209,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper \Magento\Framework\App\Helper\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Session $catalogSession, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, Category $catalogCategory, Product $catalogProduct, \Magento\Framework\Registry $coreRegistry, diff --git a/app/code/Magento/Catalog/Helper/Product.php b/app/code/Magento/Catalog/Helper/Product.php index 03249f2787b..cc0305c3545 100644 --- a/app/code/Magento/Catalog/Helper/Product.php +++ b/app/code/Magento/Catalog/Helper/Product.php @@ -222,7 +222,7 @@ class Product extends \Magento\Framework\Url\Helper\Data /** * Retrieve base image url * - * @param ModelProduct|\Magento\Framework\Object $product + * @param ModelProduct|\Magento\Framework\DataObject $product * @return string|bool */ public function getImageUrl($product) @@ -240,7 +240,7 @@ class Product extends \Magento\Framework\Url\Helper\Data /** * Retrieve small image url * - * @param ModelProduct|\Magento\Framework\Object $product + * @param ModelProduct|\Magento\Framework\DataObject $product * @return string|bool */ public function getSmallImageUrl($product) @@ -258,7 +258,7 @@ class Product extends \Magento\Framework\Url\Helper\Data /** * Retrieve thumbnail image url * - * @param ModelProduct|\Magento\Framework\Object $product + * @param ModelProduct|\Magento\Framework\DataObject $product * @return string * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -398,7 +398,7 @@ class Product extends \Magento\Framework\Url\Helper\Data * * @param int $productId * @param \Magento\Framework\App\Action\Action $controller - * @param \Magento\Framework\Object $params + * @param \Magento\Framework\DataObject $params * * @return false|ModelProduct * @SuppressWarnings(PHPMD.CyclomaticComplexity) @@ -408,7 +408,7 @@ class Product extends \Magento\Framework\Url\Helper\Data { // Prepare data for routine if (!$params) { - $params = new \Magento\Framework\Object(); + $params = new \Magento\Framework\DataObject(); } // Init and load product @@ -479,7 +479,7 @@ class Product extends \Magento\Framework\Url\Helper\Data * Also parses and adds product management related values - e.g. qty * * @param ModelProduct $product - * @param \Magento\Framework\Object $buyRequest + * @param \Magento\Framework\DataObject $buyRequest * @return Product */ public function prepareProductOptions($product, $buyRequest) @@ -496,30 +496,30 @@ class Product extends \Magento\Framework\Url\Helper\Data * This method is used to attach additional parameters to processed buyRequest. * * $params holds parameters of what operation must be performed: - * - 'current_config', \Magento\Framework\Object or array - current buyRequest that configures product in this item, - * used to restore currently attached files + * - 'current_config', \Magento\Framework\DataObject or array - current buyRequest + * that configures product in this item, used to restore currently attached files * - 'files_prefix': string[a-z0-9_] - prefix that was added at frontend to names of file inputs, * so they won't intersect with other submitted options * - * @param \Magento\Framework\Object|array $buyRequest - * @param \Magento\Framework\Object|array $params - * @return \Magento\Framework\Object + * @param \Magento\Framework\DataObject|array $buyRequest + * @param \Magento\Framework\DataObject|array $params + * @return \Magento\Framework\DataObject */ public function addParamsToBuyRequest($buyRequest, $params) { if (is_array($buyRequest)) { - $buyRequest = new \Magento\Framework\Object($buyRequest); + $buyRequest = new \Magento\Framework\DataObject($buyRequest); } if (is_array($params)) { - $params = new \Magento\Framework\Object($params); + $params = new \Magento\Framework\DataObject($params); } - // Ensure that currentConfig goes as \Magento\Framework\Object - for easier work with it later + // Ensure that currentConfig goes as \Magento\Framework\DataObject - for easier work with it later $currentConfig = $params->getCurrentConfig(); if ($currentConfig) { if (is_array($currentConfig)) { - $params->setCurrentConfig(new \Magento\Framework\Object($currentConfig)); - } elseif (!$currentConfig instanceof \Magento\Framework\Object) { + $params->setCurrentConfig(new \Magento\Framework\DataObject($currentConfig)); + } elseif (!$currentConfig instanceof \Magento\Framework\DataObject) { $params->unsCurrentConfig(); } } @@ -529,8 +529,8 @@ class Product extends \Magento\Framework\Url\Helper\Data * where '_processing_params' comes in $buyRequest as array from user input */ $processingParams = $buyRequest->getData('_processing_params'); - if (!$processingParams || !$processingParams instanceof \Magento\Framework\Object) { - $processingParams = new \Magento\Framework\Object(); + if (!$processingParams || !$processingParams instanceof \Magento\Framework\DataObject) { + $processingParams = new \Magento\Framework\DataObject(); $buyRequest->setData('_processing_params', $processingParams); } $processingParams->addData($params->getData()); diff --git a/app/code/Magento/Catalog/Helper/Product/Composite.php b/app/code/Magento/Catalog/Helper/Product/Composite.php index 7655807bcc7..c76caf406d9 100644 --- a/app/code/Magento/Catalog/Helper/Product/Composite.php +++ b/app/code/Magento/Catalog/Helper/Product/Composite.php @@ -91,10 +91,10 @@ class Composite extends \Magento\Framework\App\Helper\AbstractHelper * Prepares and render result of composite product configuration update for a case * when single configuration submitted * - * @param \Magento\Framework\Object $updateResult + * @param \Magento\Framework\DataObject $updateResult * @return \Magento\Framework\View\Result\Layout */ - public function renderUpdateResult(\Magento\Framework\Object $updateResult) + public function renderUpdateResult(\Magento\Framework\DataObject $updateResult) { $this->_coreRegistry->register('composite_update_result', $updateResult); return $this->_initUpdateResultLayout(); @@ -129,10 +129,10 @@ class Composite extends \Magento\Framework\App\Helper\AbstractHelper * - 'ok' = true, and 'product_id', 'buy_request', 'current_store_id', 'current_customer_id' * - 'error' = true, and 'message' to show * - * @param \Magento\Framework\Object $configureResult + * @param \Magento\Framework\DataObject $configureResult * @return \Magento\Framework\View\Result\Layout */ - public function renderConfigureResult(\Magento\Framework\Object $configureResult) + public function renderConfigureResult(\Magento\Framework\DataObject $configureResult) { try { if (!$configureResult->getOk()) { diff --git a/app/code/Magento/Catalog/Helper/Product/Configuration.php b/app/code/Magento/Catalog/Helper/Product/Configuration.php index 2018d7d2f8e..c018ca3c6ee 100644 --- a/app/code/Magento/Catalog/Helper/Product/Configuration.php +++ b/app/code/Magento/Catalog/Helper/Product/Configuration.php @@ -32,7 +32,7 @@ class Configuration extends AbstractHelper implements ConfigurationInterface /** * Magento string lib * - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -40,13 +40,13 @@ class Configuration extends AbstractHelper implements ConfigurationInterface * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory * @param \Magento\Framework\Filter\FilterManager $filter - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string */ public function __construct( \Magento\Framework\App\Helper\Context $context, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, \Magento\Framework\Filter\FilterManager $filter, - \Magento\Framework\Stdlib\String $string + \Magento\Framework\Stdlib\StringUtils $string ) { $this->_productOptionFactory = $productOptionFactory; $this->filter = $filter; diff --git a/app/code/Magento/Catalog/Helper/Product/View.php b/app/code/Magento/Catalog/Helper/Product/View.php index a88df102798..670ed17121d 100644 --- a/app/code/Magento/Catalog/Helper/Product/View.php +++ b/app/code/Magento/Catalog/Helper/Product/View.php @@ -98,7 +98,7 @@ class View extends \Magento\Framework\App\Helper\AbstractHelper * * @param \Magento\Framework\View\Result\Page $resultPage * @param \Magento\Catalog\Model\Product $product - * @param null|\Magento\Framework\Object $params + * @param null|\Magento\Framework\DataObject $params * @return \Magento\Catalog\Helper\Product\View * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) @@ -172,14 +172,14 @@ class View extends \Magento\Framework\App\Helper\AbstractHelper * * $params can have all values as $params in \Magento\Catalog\Helper\Product - initProduct(). * Plus following keys: - * - 'buy_request' - \Magento\Framework\Object holding buyRequest to configure product + * - 'buy_request' - \Magento\Framework\DataObject holding buyRequest to configure product * - 'specify_options' - boolean, whether to show 'Specify options' message * - 'configure_mode' - boolean, whether we're in Configure-mode to edit product configuration * * @param \Magento\Framework\View\Result\Page $resultPage * @param int $productId * @param \Magento\Framework\App\Action\Action $controller - * @param null|\Magento\Framework\Object $params + * @param null|\Magento\Framework\DataObject $params * @throws \Magento\Framework\Exception\LocalizedException * @throws \Magento\Framework\Exception\NoSuchEntityException * @return \Magento\Catalog\Helper\Product\View @@ -189,7 +189,7 @@ class View extends \Magento\Framework\App\Helper\AbstractHelper // Prepare data $productHelper = $this->_catalogProduct; if (!$params) { - $params = new \Magento\Framework\Object(); + $params = new \Magento\Framework\DataObject(); } // Standard algorithm to prepare and render product view page diff --git a/app/code/Magento/Catalog/Model/AbstractModel.php b/app/code/Magento/Catalog/Model/AbstractModel.php index 6ba6241645f..14fbf363015 100644 --- a/app/code/Magento/Catalog/Model/AbstractModel.php +++ b/app/code/Magento/Catalog/Model/AbstractModel.php @@ -172,7 +172,7 @@ abstract class AbstractModel extends \Magento\Framework\Model\AbstractExtensible * * @param string|array $key * @param mixed $value - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function setData($key, $value = null) { diff --git a/app/code/Magento/Catalog/Model/Attribute/Backend/Customlayoutupdate.php b/app/code/Magento/Catalog/Model/Attribute/Backend/Customlayoutupdate.php index 575afc4b97c..c0083094873 100644 --- a/app/code/Magento/Catalog/Model/Attribute/Backend/Customlayoutupdate.php +++ b/app/code/Magento/Catalog/Model/Attribute/Backend/Customlayoutupdate.php @@ -35,7 +35,7 @@ class Customlayoutupdate extends \Magento\Eav\Model\Entity\Attribute\Backend\Abs /** * Validate the custom layout update * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return bool * @throws Exception */ diff --git a/app/code/Magento/Catalog/Model/Attribute/Backend/Startdate.php b/app/code/Magento/Catalog/Model/Attribute/Backend/Startdate.php index 459467d268e..c5c1edd3102 100644 --- a/app/code/Magento/Catalog/Model/Attribute/Backend/Startdate.php +++ b/app/code/Magento/Catalog/Model/Attribute/Backend/Startdate.php @@ -37,7 +37,7 @@ class Startdate extends \Magento\Eav\Model\Entity\Attribute\Backend\Datetime /** * Get attribute value for save. * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return string|bool */ protected function _getValueForSave($object) @@ -58,7 +58,7 @@ class Startdate extends \Magento\Eav\Model\Entity\Attribute\Backend\Datetime * Before save hook. * Prepare attribute value for save * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function beforeSave($object) @@ -77,7 +77,7 @@ class Startdate extends \Magento\Eav\Model\Entity\Attribute\Backend\Datetime * Product from date attribute validate function. * In case invalid data throws exception. * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @throws \Magento\Eav\Model\Entity\Attribute\Exception * @return bool */ diff --git a/app/code/Magento/Catalog/Model/Category.php b/app/code/Magento/Catalog/Model/Category.php index 46ea5db35f4..1c39f41e6e8 100644 --- a/app/code/Magento/Catalog/Model/Category.php +++ b/app/code/Magento/Catalog/Model/Category.php @@ -33,7 +33,7 @@ use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Category extends \Magento\Catalog\Model\AbstractModel implements - \Magento\Framework\Object\IdentityInterface, + \Magento\Framework\DataObject\IdentityInterface, \Magento\Catalog\Api\Data\CategoryInterface, \Magento\Catalog\Api\Data\CategoryTreeInterface { @@ -942,7 +942,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements /** * Return parent categories of current category * - * @return \Magento\Framework\Object[]|\Magento\Catalog\Model\Category[] + * @return \Magento\Framework\DataObject[]|\Magento\Catalog\Model\Category[] */ public function getParentCategories() { diff --git a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php index d44bebf8759..f4d3a78c272 100644 --- a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php +++ b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php @@ -59,7 +59,7 @@ class Image extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Save uploaded file and set its name to category * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return \Magento\Catalog\Model\Category\Attribute\Backend\Image */ public function afterSave($object) diff --git a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php index e6a095ef34b..924f96ded1a 100644 --- a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php +++ b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php @@ -32,7 +32,7 @@ class Sortby extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Validate process * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return bool * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) @@ -85,7 +85,7 @@ class Sortby extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Before Attribute Save Process * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function beforeSave($object) @@ -107,7 +107,7 @@ class Sortby extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * After Load Attribute Process * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function afterLoad($object) diff --git a/app/code/Magento/Catalog/Model/Config.php b/app/code/Magento/Catalog/Model/Config.php index 8cbdb43ad33..64d5d9ac249 100644 --- a/app/code/Magento/Catalog/Model/Config.php +++ b/app/code/Magento/Catalog/Model/Config.php @@ -376,7 +376,7 @@ class Config extends \Magento\Eav\Model\Config } /** - * @param \Magento\Framework\Object $source + * @param \Magento\Framework\DataObject $source * @param string $value * @return null|mixed */ diff --git a/app/code/Magento/Catalog/Model/Design.php b/app/code/Magento/Catalog/Model/Design.php index 875295185e2..b1a9aa596e2 100644 --- a/app/code/Magento/Catalog/Model/Design.php +++ b/app/code/Magento/Catalog/Model/Design.php @@ -67,7 +67,7 @@ class Design extends \Magento\Framework\Model\AbstractModel * Get custom layout settings * * @param \Magento\Catalog\Model\Category|\Magento\Catalog\Model\Product $object - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getDesignSettings($object) { @@ -97,11 +97,11 @@ class Design extends \Magento\Framework\Model\AbstractModel * Extract custom layout settings from category or product object * * @param \Magento\Catalog\Model\Category|\Magento\Catalog\Model\Product $object - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function _extractSettings($object) { - $settings = new \Magento\Framework\Object(); + $settings = new \Magento\Framework\DataObject(); if (!$object) { return $settings; } @@ -132,9 +132,9 @@ class Design extends \Magento\Framework\Model\AbstractModel /** * Merge custom design settings * - * @param \Magento\Framework\Object $categorySettings - * @param \Magento\Framework\Object $productSettings - * @return \Magento\Framework\Object + * @param \Magento\Framework\DataObject $categorySettings + * @param \Magento\Framework\DataObject $productSettings + * @return \Magento\Framework\DataObject */ protected function _mergeSettings($categorySettings, $productSettings) { diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/AbstractAction.php index c160e95db9b..2db8faeb9c6 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/AbstractAction.php @@ -169,7 +169,7 @@ abstract class AbstractAction { if ($this->_productTypes === null) { $this->_productTypes = []; - $productEmulator = new \Magento\Framework\Object(); + $productEmulator = new \Magento\Framework\DataObject(); foreach (array_keys($this->_productType->getTypes()) as $typeId) { $productEmulator->setTypeId($typeId); $this->_productTypes[$typeId] = $this->_productType->factory($productEmulator); diff --git a/app/code/Magento/Catalog/Model/Layer.php b/app/code/Magento/Catalog/Model/Layer.php index 62c79630fa6..4818eba4b6b 100644 --- a/app/code/Magento/Catalog/Model/Layer.php +++ b/app/code/Magento/Catalog/Model/Layer.php @@ -14,7 +14,7 @@ use Magento\Framework\Exception\NoSuchEntityException; * @SuppressWarnings(PHPMD.LongVariable) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Layer extends \Magento\Framework\Object +class Layer extends \Magento\Framework\DataObject { /** * Product collections array diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php b/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php index e3efdb639d2..bbd92e3cc88 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php @@ -8,7 +8,7 @@ namespace Magento\Catalog\Model\Layer\Filter; /** * Layer category filter abstract model */ -abstract class AbstractFilter extends \Magento\Framework\Object implements FilterInterface +abstract class AbstractFilter extends \Magento\Framework\DataObject implements FilterInterface { const ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS = 1; diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Attribute.php b/app/code/Magento/Catalog/Model/Layer/Filter/Attribute.php index 3741ce3fc99..bbcc8ec0a70 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/Attribute.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Attribute.php @@ -22,7 +22,7 @@ class Attribute extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter /** * Magento string lib * - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -37,7 +37,7 @@ class Attribute extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter * @param \Magento\Catalog\Model\Layer $layer * @param \Magento\Catalog\Model\Layer\Filter\Item\DataBuilder $itemDataBuilder * @param \Magento\Catalog\Model\Resource\Layer\Filter\AttributeFactory $filterAttributeFactory - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\Filter\StripTags $tagFilter * @param array $data */ @@ -47,7 +47,7 @@ class Attribute extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter \Magento\Catalog\Model\Layer $layer, \Magento\Catalog\Model\Layer\Filter\Item\DataBuilder $itemDataBuilder, \Magento\Catalog\Model\Resource\Layer\Filter\AttributeFactory $filterAttributeFactory, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\Filter\StripTags $tagFilter, array $data = [] ) { diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Item.php b/app/code/Magento/Catalog/Model/Layer/Filter/Item.php index 920b9173e0a..835d1202b0a 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/Item.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Item.php @@ -13,7 +13,7 @@ */ namespace Magento\Catalog\Model\Layer\Filter; -class Item extends \Magento\Framework\Object +class Item extends \Magento\Framework\DataObject { /** * Url diff --git a/app/code/Magento/Catalog/Model/Layer/State.php b/app/code/Magento/Catalog/Model/Layer/State.php index 9299dfc39eb..685b122d989 100644 --- a/app/code/Magento/Catalog/Model/Layer/State.php +++ b/app/code/Magento/Catalog/Model/Layer/State.php @@ -7,14 +7,14 @@ namespace Magento\Catalog\Model\Layer; use Magento\Catalog\Model\Layer\Filter\Item; use Magento\Framework\Exception\LocalizedException; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Layered navigation state model * * @author Magento Core Team <core@magentocommerce.com> */ -class State extends Object +class State extends DataObject { /** * Add filter item to layer state diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php index 2071acfd4fd..134827dd4b4 100644 --- a/app/code/Magento/Catalog/Model/Product.php +++ b/app/code/Magento/Catalog/Model/Product.php @@ -9,7 +9,7 @@ use Magento\Catalog\Api\CategoryRepositoryInterface; use Magento\Catalog\Api\Data\ProductInterface; use Magento\Framework\Api\AttributeValueFactory; use Magento\Framework\App\Filesystem\DirectoryList; -use Magento\Framework\Object\IdentityInterface; +use Magento\Framework\DataObject\IdentityInterface; use Magento\Framework\Pricing\Object\SaleableInterface; use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface; use Magento\Framework\Api\Data\ImageContentInterface; @@ -1518,7 +1518,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements $image['url'] = $this->getMediaConfig()->getMediaUrl($image['file']); $image['id'] = isset($image['value_id']) ? $image['value_id'] : null; $image['path'] = $directory->getAbsolutePath($this->getMediaConfig()->getMediaPath($image['file'])); - $images->addItem(new \Magento\Framework\Object($image)); + $images->addItem(new \Magento\Framework\DataObject($image)); } $this->setData('media_gallery_images', $images); } @@ -1660,7 +1660,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements $salable = $this->isAvailable(); - $object = new \Magento\Framework\Object(['product' => $this, 'is_salable' => $salable]); + $object = new \Magento\Framework\DataObject(['product' => $this, 'is_salable' => $salable]); $this->_eventManager->dispatch( 'catalog_product_is_salable_after', ['product' => $this, 'salable' => $object] @@ -2155,12 +2155,12 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements /** * Parse buyRequest into options values used by product * - * @param \Magento\Framework\Object $buyRequest - * @return \Magento\Framework\Object + * @param \Magento\Framework\DataObject $buyRequest + * @return \Magento\Framework\DataObject */ - public function processBuyRequest(\Magento\Framework\Object $buyRequest) + public function processBuyRequest(\Magento\Framework\DataObject $buyRequest) { - $options = new \Magento\Framework\Object(); + $options = new \Magento\Framework\DataObject(); /* add product custom options data */ $customOptions = $buyRequest->getOptions(); @@ -2188,13 +2188,13 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements /** * Get preconfigured values from product * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getPreconfiguredValues() { $preConfiguredValues = $this->getData('preconfigured_values'); if (!$preConfiguredValues) { - $preConfiguredValues = new \Magento\Framework\Object(); + $preConfiguredValues = new \Magento\Framework\DataObject(); } return $preConfiguredValues; diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Boolean.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Boolean.php index b35396608e8..cd0f0cdb9fd 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Boolean.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Boolean.php @@ -15,7 +15,7 @@ class Boolean extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacken /** * Set attribute default value if value empty * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function beforeSave($object) diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php index 56631b4a8fa..9d513740694 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php @@ -384,7 +384,7 @@ abstract class AbstractGroupPrice extends Price if (!empty($insert)) { foreach ($insert as $data) { - $price = new \Magento\Framework\Object($data); + $price = new \Magento\Framework\DataObject($data); $price->setEntityId($productId); $this->_getResource()->savePriceData($price); @@ -395,7 +395,7 @@ abstract class AbstractGroupPrice extends Price if (!empty($update)) { foreach ($update as $k => $v) { if ($old[$k]['price'] != $v['value']) { - $price = new \Magento\Framework\Object(['value_id' => $old[$k]['price_id'], 'value' => $v['value']]); + $price = new \Magento\Framework\DataObject(['value_id' => $old[$k]['price_id'], 'value' => $v['value']]); $this->_getResource()->savePriceData($price); $isChanged = true; diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php index ed6bed093f3..e47fb145577 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php @@ -166,7 +166,7 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend } /** - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this|void * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) @@ -258,7 +258,7 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend } /** - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return void * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) @@ -757,7 +757,7 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend } /** - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function duplicate($object) diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php index 5d21012f396..97e5e7f4149 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php @@ -27,14 +27,14 @@ class Sku extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Magento string lib * - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; /** - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string */ - public function __construct(\Magento\Framework\Stdlib\String $string) + public function __construct(\Magento\Framework\Stdlib\StringUtils $string) { $this->string = $string; } diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Source/Inputtype.php b/app/code/Magento/Catalog/Model/Product/Attribute/Source/Inputtype.php index 7573262af05..f26c60f8c18 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Source/Inputtype.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Source/Inputtype.php @@ -50,7 +50,7 @@ class Inputtype extends \Magento\Eav\Model\Adminhtml\System\Config\Source\Inputt ['value' => 'media_image', 'label' => __('Media Image')], ]; - $response = new \Magento\Framework\Object(); + $response = new \Magento\Framework\DataObject(); $response->setTypes([]); $this->_eventManager->dispatch('adminhtml_product_attribute_types', ['response' => $response]); $_hiddenFields = []; diff --git a/app/code/Magento/Catalog/Model/Product/Compare/Item.php b/app/code/Magento/Catalog/Model/Product/Compare/Item.php index 428201a988d..7d191428151 100644 --- a/app/code/Magento/Catalog/Model/Product/Compare/Item.php +++ b/app/code/Magento/Catalog/Model/Product/Compare/Item.php @@ -18,7 +18,7 @@ use Magento\Catalog\Model\Product; * @method int getStoreId() * @method \Magento\Catalog\Model\Product\Compare\Item setStoreId(int $value) */ -class Item extends \Magento\Framework\Model\AbstractModel implements \Magento\Framework\Object\IdentityInterface +class Item extends \Magento\Framework\Model\AbstractModel implements \Magento\Framework\DataObject\IdentityInterface { /** * Model cache tag diff --git a/app/code/Magento/Catalog/Model/Product/Compare/ListCompare.php b/app/code/Magento/Catalog/Model/Product/Compare/ListCompare.php index 90cadba4d17..4edc1cc6db9 100644 --- a/app/code/Magento/Catalog/Model/Product/Compare/ListCompare.php +++ b/app/code/Magento/Catalog/Model/Product/Compare/ListCompare.php @@ -12,7 +12,7 @@ use Magento\Catalog\Model\Resource\Product\Compare\Item\Collection; * * @SuppressWarnings(PHPMD.LongVariable) */ -class ListCompare extends \Magento\Framework\Object +class ListCompare extends \Magento\Framework\DataObject { /** * Customer visitor diff --git a/app/code/Magento/Catalog/Model/Product/Condition.php b/app/code/Magento/Catalog/Model/Product/Condition.php index ba8923e8aea..dcd95d5871f 100644 --- a/app/code/Magento/Catalog/Model/Product/Condition.php +++ b/app/code/Magento/Catalog/Model/Product/Condition.php @@ -15,7 +15,7 @@ use Magento\Framework\DB\Select; * @method string|array getTable() * @method Condition setTable($table) */ -class Condition extends \Magento\Framework\Object implements \Magento\Catalog\Model\Product\Condition\ConditionInterface +class Condition extends \Magento\Framework\DataObject implements Condition\ConditionInterface { /** * @param AbstractCollection $collection diff --git a/app/code/Magento/Catalog/Model/Product/Configuration/Item/ItemInterface.php b/app/code/Magento/Catalog/Model/Product/Configuration/Item/ItemInterface.php index 61d8e68737b..de30f1d78c9 100644 --- a/app/code/Magento/Catalog/Model/Product/Configuration/Item/ItemInterface.php +++ b/app/code/Magento/Catalog/Model/Product/Configuration/Item/ItemInterface.php @@ -29,11 +29,11 @@ interface ItemInterface /** * Returns special download params (if needed) for custom option with type = 'file'' * Return null, if not special params needed' - * Or return \Magento\Framework\Object with any of the following indexes: + * Or return \Magento\Framework\DataObject with any of the following indexes: * - 'url' - url of controller to give the file * - 'urlParams' - additional parameters for url (custom option id, or item id, for example) * - * @return null|\Magento\Framework\Object + * @return null|\Magento\Framework\DataObject */ public function getFileDownloadParams(); } diff --git a/app/code/Magento/Catalog/Model/Product/Configuration/Item/Option.php b/app/code/Magento/Catalog/Model/Product/Configuration/Item/Option.php index 7a39c56fac1..530b3c2e728 100644 --- a/app/code/Magento/Catalog/Model/Product/Configuration/Item/Option.php +++ b/app/code/Magento/Catalog/Model/Product/Configuration/Item/Option.php @@ -11,7 +11,7 @@ */ namespace Magento\Catalog\Model\Product\Configuration\Item; -class Option extends \Magento\Framework\Object implements +class Option extends \Magento\Framework\DataObject implements \Magento\Catalog\Model\Product\Configuration\Item\Option\OptionInterface { /** diff --git a/app/code/Magento/Catalog/Model/Product/Image/View.php b/app/code/Magento/Catalog/Model/Product/Image/View.php index 798b3d1b625..1c37e78d994 100644 --- a/app/code/Magento/Catalog/Model/Product/Image/View.php +++ b/app/code/Magento/Catalog/Model/Product/Image/View.php @@ -9,7 +9,7 @@ */ namespace Magento\Catalog\Model\Product\Image; -class View extends \Magento\Framework\Object +class View extends \Magento\Framework\DataObject { /** * Index of width image information diff --git a/app/code/Magento/Catalog/Model/Product/Option.php b/app/code/Magento/Catalog/Model/Product/Option.php index 05ca2bbdf9c..f6364057e84 100644 --- a/app/code/Magento/Catalog/Model/Product/Option.php +++ b/app/code/Magento/Catalog/Model/Product/Option.php @@ -104,7 +104,7 @@ class Option extends \Magento\Framework\Model\AbstractExtensibleModel protected $_optionFactory; /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -120,7 +120,7 @@ class Option extends \Magento\Framework\Model\AbstractExtensibleModel * @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory * @param Option\Value $productOptionValue * @param Option\Type\Factory $optionFactory - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param Option\Validator\Pool $validatorPool * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection @@ -134,7 +134,7 @@ class Option extends \Magento\Framework\Model\AbstractExtensibleModel \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, Option\Value $productOptionValue, \Magento\Catalog\Model\Product\Option\Type\Factory $optionFactory, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, Option\Validator\Pool $validatorPool, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php b/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php index e001dced13f..ebf2dcaa158 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php @@ -16,7 +16,7 @@ use Magento\Framework\Exception\LocalizedException; * @author Magento Core Team <core@magentocommerce.com> * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class DefaultType extends \Magento\Framework\Object +class DefaultType extends \Magento\Framework\DataObject { /** * Option Instance @@ -171,12 +171,12 @@ class DefaultType extends \Magento\Framework\Object /** * Getter for Buy Request * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject * @throws \Magento\Framework\Exception\LocalizedException */ public function getRequest() { - if ($this->_getData('request') instanceof \Magento\Framework\Object) { + if ($this->_getData('request') instanceof \Magento\Framework\DataObject) { return $this->_getData('request'); } throw new LocalizedException(__('The BuyRequest instance in options group is incorrect.')); diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php index 04faaeb1225..3eb9ed0fd78 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php @@ -133,20 +133,20 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType /** * Returns additional params for processing options * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function _getProcessingParams() { $buyRequest = $this->getRequest(); $params = $buyRequest->getData('_processing_params'); /* - * Notice check for params to be \Magento\Framework\Object - by using object we protect from + * Notice check for params to be \Magento\Framework\DataObject - by using object we protect from * params being forged and contain data from user frontend input */ - if ($params instanceof \Magento\Framework\Object) { + if ($params instanceof \Magento\Framework\DataObject) { return $params; } - return new \Magento\Framework\Object(); + return new \Magento\Framework\DataObject(); } /** diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php index cea7f07b44c..a9f7a1188c5 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php @@ -87,7 +87,7 @@ class ValidatorFile extends Validator } /** - * @param \Magento\Framework\Object $processingParams + * @param \Magento\Framework\DataObject $processingParams * @param \Magento\Catalog\Model\Product\Option $option * @return array * @throws LocalizedException diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php index c3c49e06779..9599d365008 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php @@ -25,21 +25,21 @@ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType /** * Magento string lib * - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; /** * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\Escaper $escaper * @param array $data */ public function __construct( \Magento\Checkout\Model\Session $checkoutSession, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\Escaper $escaper, array $data = [] ) { diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php index 99c17e0a3af..6b1a1686eab 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php @@ -15,7 +15,7 @@ class Text extends \Magento\Catalog\Model\Product\Option\Type\DefaultType /** * Magento string lib * - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -28,14 +28,14 @@ class Text extends \Magento\Catalog\Model\Product\Option\Type\DefaultType * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\Escaper $escaper - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param array $data */ public function __construct( \Magento\Checkout\Model\Session $checkoutSession, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\Escaper $escaper, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, array $data = [] ) { $this->_escaper = $escaper; diff --git a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php index 837e2481681..98c88a5bc45 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php +++ b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php @@ -211,11 +211,11 @@ abstract class AbstractType /** * Return relation info about used products for specific type instance * - * @return \Magento\Framework\Object Object with information data + * @return \Magento\Framework\DataObject Object with information data */ public function getRelationInfo() { - return new \Magento\Framework\Object(); + return new \Magento\Framework\DataObject(); } /** @@ -356,13 +356,13 @@ abstract class AbstractType * Prepare product and its configuration to be added to some products list. * Perform standard preparation process and then prepare options belonging to specific product type. * - * @param \Magento\Framework\Object $buyRequest + * @param \Magento\Framework\DataObject $buyRequest * @param \Magento\Catalog\Model\Product $product * @param string $processMode * @return array|string * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - protected function _prepareProduct(\Magento\Framework\Object $buyRequest, $product, $processMode) + protected function _prepareProduct(\Magento\Framework\DataObject $buyRequest, $product, $processMode) { // try to add custom options try { @@ -423,13 +423,13 @@ abstract class AbstractType /** * Process product configuration * - * @param \Magento\Framework\Object $buyRequest + * @param \Magento\Framework\DataObject $buyRequest * @param \Magento\Catalog\Model\Product $product * @param string $processMode * @return array|string */ public function processConfiguration( - \Magento\Framework\Object $buyRequest, + \Magento\Framework\DataObject $buyRequest, $product, $processMode = self::PROCESS_MODE_LITE ) { @@ -442,12 +442,12 @@ abstract class AbstractType * Initialize product(s) for add to cart process. * Advanced version of func to prepare product for cart - processMode can be specified there. * - * @param \Magento\Framework\Object $buyRequest + * @param \Magento\Framework\DataObject $buyRequest * @param \Magento\Catalog\Model\Product $product * @param null|string $processMode * @return array|string */ - public function prepareForCartAdvanced(\Magento\Framework\Object $buyRequest, $product, $processMode = null) + public function prepareForCartAdvanced(\Magento\Framework\DataObject $buyRequest, $product, $processMode = null) { if (!$processMode) { $processMode = self::PROCESS_MODE_FULL; @@ -460,11 +460,11 @@ abstract class AbstractType /** * Initialize product(s) for add to cart process * - * @param \Magento\Framework\Object $buyRequest + * @param \Magento\Framework\DataObject $buyRequest * @param \Magento\Catalog\Model\Product $product * @return array|string */ - public function prepareForCart(\Magento\Framework\Object $buyRequest, $product) + public function prepareForCart(\Magento\Framework\DataObject $buyRequest, $product) { return $this->prepareForCartAdvanced($buyRequest, $product, self::PROCESS_MODE_FULL); } @@ -565,12 +565,12 @@ abstract class AbstractType /** * Process custom defined options for product * - * @param \Magento\Framework\Object $buyRequest + * @param \Magento\Framework\DataObject $buyRequest * @param \Magento\Catalog\Model\Product $product * @param string $processMode * @return array */ - protected function _prepareOptions(\Magento\Framework\Object $buyRequest, $product, $processMode) + protected function _prepareOptions(\Magento\Framework\DataObject $buyRequest, $product, $processMode) { $transport = new \StdClass(); $transport->options = []; @@ -796,7 +796,7 @@ abstract class AbstractType $group = $option->groupFactory($option->getType()) ->setOption($option) - ->setListener(new \Magento\Framework\Object()); + ->setListener(new \Magento\Framework\DataObject()); $optionSku = $group->getOptionSku($confItemOption->getValue(), $skuDelimiter); if ($optionSku) { @@ -841,14 +841,14 @@ abstract class AbstractType * so need to change configuration item qty option value too. * * @param array $options - * @param \Magento\Framework\Object $option + * @param \Magento\Framework\DataObject $option * @param int|float|null $value * @param \Magento\Catalog\Model\Product $product * * @return $this * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function updateQtyOption($options, \Magento\Framework\Object $option, $value, $product) + public function updateQtyOption($options, \Magento\Framework\DataObject $option, $value, $product) { return $this; } @@ -995,7 +995,7 @@ abstract class AbstractType * Prepare selected options for product * * @param \Magento\Catalog\Model\Product $product - * @param \Magento\Framework\Object $buyRequest + * @param \Magento\Framework\DataObject $buyRequest * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -1008,7 +1008,7 @@ abstract class AbstractType * Check product's options configuration * * @param \Magento\Catalog\Model\Product $product - * @param \Magento\Framework\Object $buyRequest + * @param \Magento\Framework\DataObject $buyRequest * @return array */ public function checkProductConfiguration($product, $buyRequest) diff --git a/app/code/Magento/Catalog/Model/Product/Url.php b/app/code/Magento/Catalog/Model/Product/Url.php index 819232c0725..2a6ddbd8e9e 100644 --- a/app/code/Magento/Catalog/Model/Product/Url.php +++ b/app/code/Magento/Catalog/Model/Product/Url.php @@ -14,7 +14,7 @@ namespace Magento\Catalog\Model\Product; use Magento\UrlRewrite\Model\UrlFinderInterface; use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; -class Url extends \Magento\Framework\Object +class Url extends \Magento\Framework\DataObject { /** * Static URL instance diff --git a/app/code/Magento/Catalog/Model/Product/Validator.php b/app/code/Magento/Catalog/Model/Product/Validator.php index 00bd85a34d4..cac79c22d2e 100644 --- a/app/code/Magento/Catalog/Model/Product/Validator.php +++ b/app/code/Magento/Catalog/Model/Product/Validator.php @@ -16,11 +16,11 @@ class Validator * * @param Product $product * @param RequestInterface $request - * @param \Magento\Framework\Object $response + * @param \Magento\Framework\DataObject $response * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function validate(Product $product, RequestInterface $request, \Magento\Framework\Object $response) + public function validate(Product $product, RequestInterface $request, \Magento\Framework\DataObject $response) { return $product->validate(); } diff --git a/app/code/Magento/Catalog/Model/Product/Visibility.php b/app/code/Magento/Catalog/Model/Product/Visibility.php index 586b02c7d8b..9ae183c6a41 100644 --- a/app/code/Magento/Catalog/Model/Product/Visibility.php +++ b/app/code/Magento/Catalog/Model/Product/Visibility.php @@ -14,7 +14,7 @@ namespace Magento\Catalog\Model\Product; use Magento\Framework\Data\OptionSourceInterface; use Magento\Framework\DB\Ddl\Table; -class Visibility extends \Magento\Framework\Object implements OptionSourceInterface +class Visibility extends \Magento\Framework\DataObject implements OptionSourceInterface { const VISIBILITY_NOT_VISIBLE = 1; diff --git a/app/code/Magento/Catalog/Model/Resource/AbstractResource.php b/app/code/Magento/Catalog/Model/Resource/AbstractResource.php index a71d342df48..877f9728bba 100644 --- a/app/code/Magento/Catalog/Model/Resource/AbstractResource.php +++ b/app/code/Magento/Catalog/Model/Resource/AbstractResource.php @@ -77,7 +77,7 @@ abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity /** * Check whether the attribute is Applicable to the object * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @param \Magento\Catalog\Model\Resource\Eav\Attribute $attribute * @return boolean */ @@ -102,7 +102,7 @@ abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity && ($method == 'beforeSave' || $method = 'afterSave') ) { $attributeCode = $instance->getAttribute()->getAttributeCode(); - if (isset($args[0]) && $args[0] instanceof \Magento\Framework\Object && $args[0]->getData($attributeCode) === false) { + if (isset($args[0]) && $args[0] instanceof \Magento\Framework\DataObject && $args[0]->getData($attributeCode) === false) { return false; } } @@ -114,7 +114,7 @@ abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity * Retrieve select object for loading entity attributes values * Join attribute store value * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @param string $table * @return \Magento\Framework\DB\Select */ @@ -239,7 +239,7 @@ abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity ); } - $data = new \Magento\Framework\Object( + $data = new \Magento\Framework\DataObject( [ 'attribute_id' => $attribute->getAttributeId(), 'store_id' => $storeId, @@ -277,7 +277,7 @@ abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity /** * Insert entity attribute value * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @param AbstractAttribute $attribute * @param mixed $value * @return $this @@ -300,7 +300,7 @@ abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity $row = $this->_getReadAdapter()->fetchOne($select); if (!$row) { - $data = new \Magento\Framework\Object( + $data = new \Magento\Framework\DataObject( [ 'attribute_id' => $attribute->getAttributeId(), 'store_id' => $this->getDefaultStoreId(), @@ -320,7 +320,7 @@ abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity /** * Update entity attribute value * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @param AbstractAttribute $attribute * @param mixed $valueId * @param mixed $value @@ -382,7 +382,7 @@ abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity /** * Delete entity attribute values * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @param string $table * @param array $info * @return $this @@ -451,8 +451,8 @@ abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity /** * Retrieve Object instance with original data * - * @param \Magento\Framework\Object $object - * @return \Magento\Framework\Object + * @param \Magento\Framework\DataObject $object + * @return \Magento\Framework\DataObject */ protected function _getOrigObject($object) { @@ -624,7 +624,7 @@ abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity /** * Reset firstly loaded attributes * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @param integer $entityId * @param array|null $attributes * @return $this diff --git a/app/code/Magento/Catalog/Model/Resource/Category.php b/app/code/Magento/Catalog/Model/Resource/Category.php index 27d7f8b801d..ec43c2c66fe 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category.php +++ b/app/code/Magento/Catalog/Model/Resource/Category.php @@ -167,10 +167,10 @@ class Category extends AbstractResource * update children count for parent category * delete child categories * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ - protected function _beforeDelete(\Magento\Framework\Object $object) + protected function _beforeDelete(\Magento\Framework\DataObject $object) { parent::_beforeDelete($object); @@ -192,10 +192,10 @@ class Category extends AbstractResource /** * Delete children categories of specific category * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ - public function deleteChildren(\Magento\Framework\Object $object) + public function deleteChildren(\Magento\Framework\DataObject $object) { $adapter = $this->_getWriteAdapter(); $pathField = $adapter->quoteIdentifier('path'); @@ -225,12 +225,12 @@ class Category extends AbstractResource * Process category data before saving * prepare path and increment children count for parent categories * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this * @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - protected function _beforeSave(\Magento\Framework\Object $object) + protected function _beforeSave(\Magento\Framework\DataObject $object) { parent::_beforeSave($object); @@ -272,10 +272,10 @@ class Category extends AbstractResource * Process category data after save category object * save related products ids and update path value * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ - protected function _afterSave(\Magento\Framework\Object $object) + protected function _afterSave(\Magento\Framework\DataObject $object) { /** * Add identifier for new category @@ -644,7 +644,7 @@ class Category extends AbstractResource * Return parent categories of category * * @param \Magento\Catalog\Model\Category $category - * @return \Magento\Framework\Object[] + * @return \Magento\Framework\DataObject[] */ public function getParentCategories($category) { diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Frontend/Image.php b/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Frontend/Image.php index 61b59b70d9d..0bfaf7fce2e 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Frontend/Image.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Frontend/Image.php @@ -34,7 +34,7 @@ class Image extends \Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFronten /** * Return image url * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return string|null */ public function getUrl($object) diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Flat.php b/app/code/Magento/Catalog/Model/Resource/Category/Flat.php index fcc0fbf435f..f86a5f957a0 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Flat.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Flat.php @@ -304,7 +304,7 @@ class Flat extends \Magento\Indexer\Model\Resource\AbstractResource * * @param array $children * @param string $path - * @param \Magento\Framework\Object $parent + * @param \Magento\Framework\DataObject $parent * @return void */ public function addChildNodes($children, $path, $parent) @@ -421,7 +421,7 @@ class Flat extends \Magento\Indexer\Model\Resource\AbstractResource * * @param integer $nodeId * @param array $nodes - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getNodeById($nodeId, $nodes = null) { diff --git a/app/code/Magento/Catalog/Model/Resource/Product.php b/app/code/Magento/Catalog/Model/Resource/Product.php index da4aee259b6..d77950a7d02 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product.php +++ b/app/code/Magento/Catalog/Model/Resource/Product.php @@ -240,10 +240,10 @@ class Product extends AbstractResource /** * Process product data before save * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ - protected function _beforeSave(\Magento\Framework\Object $object) + protected function _beforeSave(\Magento\Framework\DataObject $object) { /** * Check if declared category ids in object data. @@ -266,10 +266,10 @@ class Product extends AbstractResource /** * Save data related with product * - * @param \Magento\Framework\Object $product + * @param \Magento\Framework\DataObject $product * @return $this */ - protected function _afterSave(\Magento\Framework\Object $product) + protected function _afterSave(\Magento\Framework\DataObject $product) { $this->_saveWebsiteIds($product)->_saveCategories($product); return parent::_afterSave($product); @@ -334,11 +334,11 @@ class Product extends AbstractResource /** * Save product category relations * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - protected function _saveCategories(\Magento\Framework\Object $object) + protected function _saveCategories(\Magento\Framework\DataObject $object) { /** * If category ids data is not declared we haven't do manipulations diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Action.php b/app/code/Magento/Catalog/Model/Resource/Product/Action.php index 2a9d0de92a2..f8b5756dbd1 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Action.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Action.php @@ -39,7 +39,7 @@ class Action extends \Magento\Catalog\Model\Resource\AbstractResource */ public function updateAttributes($entityIds, $attrData, $storeId) { - $object = new \Magento\Framework\Object(); + $object = new \Magento\Framework\DataObject(); $object->setStoreId($storeId); $this->_getWriteAdapter()->beginTransaction(); diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php index 3d40ca229e6..ebb9c001675 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php @@ -101,10 +101,10 @@ abstract class AbstractGroupPrice extends \Magento\Framework\Model\Resource\Db\A /** * Save tier price object * - * @param \Magento\Framework\Object $priceObject + * @param \Magento\Framework\DataObject $priceObject * @return \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Tierprice */ - public function savePriceData(\Magento\Framework\Object $priceObject) + public function savePriceData(\Magento\Framework\DataObject $priceObject) { $adapter = $this->_getWriteAdapter(); $data = $this->_prepareDataForTable($priceObject, $this->getMainTable()); diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Image.php b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Image.php index bad42fb386e..ca444f90f90 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Image.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Image.php @@ -44,7 +44,7 @@ class Image extends AbstractBackend /** * After save * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this|void */ public function afterSave($object) diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Media.php b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Media.php index 6fde77a376f..bb8d06f29f8 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Media.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Media.php @@ -113,7 +113,7 @@ class Media extends \Magento\Framework\Model\Resource\Db\AbstractDb public function insertGallery($data) { $adapter = $this->_getWriteAdapter(); - $data = $this->_prepareDataForTable(new \Magento\Framework\Object($data), $this->getMainTable()); + $data = $this->_prepareDataForTable(new \Magento\Framework\DataObject($data), $this->getMainTable()); $adapter->insert($this->getMainTable(), $data); return $adapter->lastInsertId($this->getMainTable()); @@ -147,7 +147,7 @@ class Media extends \Magento\Framework\Model\Resource\Db\AbstractDb */ public function insertGalleryValueInStore($data) { - $data = $this->_prepareDataForTable(new \Magento\Framework\Object($data), $this->getTable(self::GALLERY_VALUE_TABLE)); + $data = $this->_prepareDataForTable(new \Magento\Framework\DataObject($data), $this->getTable(self::GALLERY_VALUE_TABLE)); $this->_getWriteAdapter()->insert($this->getTable(self::GALLERY_VALUE_TABLE), $data); return $this; diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Collection.php index 4ac6244bd11..dd45fee87f0 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Collection.php @@ -352,7 +352,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl protected function _preparePriceExpressionParameters($select) { // prepare response object for event - $response = new \Magento\Framework\Object(); + $response = new \Magento\Framework\DataObject(); $response->setAdditionalCalculations([]); $tableAliases = array_keys($select->getPart(\Zend_Db_Select::FROM)); if (in_array(self::INDEX_TABLE_ALIAS, $tableAliases)) { @@ -499,7 +499,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl * Retrieve collection empty item * Redeclared for specifying id field name without getting resource model inside model * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getNewEmptyItem() { @@ -662,7 +662,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl $objects = $this->_catalogUrl->getRewriteByProductStore($objects); foreach ($this->_items as $item) { if (isset($objects[$item->getEntityId()])) { - $object = new \Magento\Framework\Object($objects[$item->getEntityId()]); + $object = new \Magento\Framework\DataObject($objects[$item->getEntityId()]); $item->setUrlDataObject($object); } } diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Option.php b/app/code/Magento/Catalog/Model/Resource/Product/Option.php index 27ee2f7505a..b71e4fa1546 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Option.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Option.php @@ -122,7 +122,7 @@ class Option extends \Magento\Framework\Model\Resource\Db\AbstractDb if ($optionId) { if ($object->getStoreId() == '0') { $data = $this->_prepareDataForTable( - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( ['price' => $object->getPrice(), 'price_type' => $object->getPriceType()] ), $priceTable @@ -139,7 +139,7 @@ class Option extends \Magento\Framework\Model\Resource\Db\AbstractDb } } else { $data = $this->_prepareDataForTable( - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'option_id' => $object->getId(), 'store_id' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, @@ -190,7 +190,7 @@ class Option extends \Magento\Framework\Model\Resource\Db\AbstractDb if ($readAdapter->fetchOne($statement)) { $data = $this->_prepareDataForTable( - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( ['price' => $newPrice, 'price_type' => $object->getPriceType()] ), $priceTable @@ -203,7 +203,7 @@ class Option extends \Magento\Framework\Model\Resource\Db\AbstractDb ); } else { $data = $this->_prepareDataForTable( - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'option_id' => $object->getId(), 'store_id' => $storeId, @@ -251,7 +251,7 @@ class Option extends \Magento\Framework\Model\Resource\Db\AbstractDb if ($existInCurrentStore) { if ($object->getStoreId() == $storeId) { $data = $this->_prepareDataForTable( - new \Magento\Framework\Object(['title' => $object->getTitle()]), + new \Magento\Framework\DataObject(['title' => $object->getTitle()]), $titleTableName ); $writeAdapter->update( @@ -269,7 +269,7 @@ class Option extends \Magento\Framework\Model\Resource\Db\AbstractDb || ($storeId != \Magento\Store\Model\Store::DEFAULT_STORE_ID && !$existInCurrentStore) ) { $data = $this->_prepareDataForTable( - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'option_id' => $object->getId(), 'store_id' => $storeId, diff --git a/app/code/Magento/Catalog/Model/Resource/Url.php b/app/code/Magento/Catalog/Model/Resource/Url.php index b9a8a3d076b..e72df5aaaba 100644 --- a/app/code/Magento/Catalog/Model/Resource/Url.php +++ b/app/code/Magento/Catalog/Model/Resource/Url.php @@ -314,10 +314,10 @@ class Url extends \Magento\Framework\Model\Resource\Db\AbstractDb /** * Prepare category parentId * - * @param \Magento\Framework\Object $category + * @param \Magento\Framework\DataObject $category * @return $this */ - protected function _prepareCategoryParentId(\Magento\Framework\Object $category) + protected function _prepareCategoryParentId(\Magento\Framework\DataObject $category) { if ($category->getPath() != $category->getId()) { $split = explode('/', $category->getPath()); @@ -431,7 +431,7 @@ class Url extends \Magento\Framework\Model\Resource\Db\AbstractDb } } - $category = new \Magento\Framework\Object($row); + $category = new \Magento\Framework\DataObject($row); $category->setId($row['entity_id']); $category->setEntityId($row['entity_id']); $category->setStoreId($storeId); @@ -462,7 +462,7 @@ class Url extends \Magento\Framework\Model\Resource\Db\AbstractDb * * @param int $categoryId * @param int $storeId - * @return \Magento\Framework\Object|false + * @return \Magento\Framework\DataObject|false */ public function getCategory($categoryId, $storeId) { @@ -535,7 +535,7 @@ class Url extends \Magento\Framework\Model\Resource\Db\AbstractDb $rowSet = $adapter->fetchAll($select, $bind); foreach ($rowSet as $row) { - $product = new \Magento\Framework\Object($row); + $product = new \Magento\Framework\DataObject($row); $product->setId($row['entity_id']); $product->setEntityId($row['entity_id']); $product->setCategoryIds([]); @@ -578,7 +578,7 @@ class Url extends \Magento\Framework\Model\Resource\Db\AbstractDb * * @param int $productId * @param int $storeId - * @return \Magento\Framework\Object|false + * @return \Magento\Framework\DataObject|false */ public function getProduct($productId, $storeId) { diff --git a/app/code/Magento/Catalog/Model/Template/Filter.php b/app/code/Magento/Catalog/Model/Template/Filter.php index debc0a56254..58d4c72319b 100644 --- a/app/code/Magento/Catalog/Model/Template/Filter.php +++ b/app/code/Magento/Catalog/Model/Template/Filter.php @@ -43,13 +43,13 @@ class Filter extends \Magento\Framework\Filter\Template protected $_storeManager; /** - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\View\Asset\Repository $assetRepo * @param array $variables */ public function __construct( - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\View\Asset\Repository $assetRepo, $variables = [] diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Product/ListTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Product/ListTest.php index 87aa0c750a2..e9000b74c5b 100644 --- a/app/code/Magento/Catalog/Test/Unit/Block/Product/ListTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Block/Product/ListTest.php @@ -9,7 +9,7 @@ class ListTest extends \PHPUnit_Framework_TestCase { public function testGetMode() { - $childBlock = new \Magento\Framework\Object(); + $childBlock = new \Magento\Framework\DataObject(); $block = $this->getMock( 'Magento\Catalog\Block\Product\ListProduct', diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Rss/CategoryTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Rss/CategoryTest.php index f6c485538b0..c591a59edb3 100644 --- a/app/code/Magento/Catalog/Test/Unit/Block/Rss/CategoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Block/Rss/CategoryTest.php @@ -232,7 +232,7 @@ class CategoryTest extends \PHPUnit_Framework_TestCase $category->expects($this->once())->method('getResourceCollection')->will($this->returnValue($collection)); $this->categoryFactory->expects($this->once())->method('create')->will($this->returnValue($category)); - $node = new \Magento\Framework\Object(['id' => 1]); + $node = new \Magento\Framework\DataObject(['id' => 1]); $nodes = $this->getMockBuilder('Magento\Framework\Data\Tree\Node') ->setMethods(['getChildren'])->disableOriginalConstructor()->getMock(); $nodes->expects($this->once())->method('getChildren')->will($this->returnValue([$node])); diff --git a/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Initialization/Helper/HandlerFactoryTest.php b/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Initialization/Helper/HandlerFactoryTest.php index 647be62e3ac..caa5cc929f8 100644 --- a/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Initialization/Helper/HandlerFactoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Initialization/Helper/HandlerFactoryTest.php @@ -29,11 +29,11 @@ class HandlerFactoryTest extends \PHPUnit_Framework_TestCase { $this->setExpectedException( '\InvalidArgumentException', - 'Magento\Framework\Object does not implement ' . + 'Magento\Framework\DataObject does not implement ' . 'Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\HandlerInterface' ); $this->_objectManagerMock->expects($this->never())->method('create'); - $this->_model->create('Magento\Framework\Object'); + $this->_model->create('Magento\Framework\DataObject'); } public function testCreateWithValidType() diff --git a/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/ShowUpdateResultTest.php b/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/ShowUpdateResultTest.php index 67c4c96989d..c9209c3f0a7 100644 --- a/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/ShowUpdateResultTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/ShowUpdateResultTest.php @@ -42,7 +42,7 @@ class ShowUpdateResultTest extends \PHPUnit_Framework_TestCase ->method('unsCompositeProductResult'); $session->expects($this->atLeastOnce()) ->method('getCompositeProductResult') - ->willReturn(new \Magento\Framework\Object()); + ->willReturn(new \Magento\Framework\DataObject()); return $session; } diff --git a/app/code/Magento/Catalog/Test/Unit/Controller/Category/ViewTest.php b/app/code/Magento/Catalog/Test/Unit/Controller/Category/ViewTest.php index 5683e54fcf8..735c13b0483 100644 --- a/app/code/Magento/Catalog/Test/Unit/Controller/Category/ViewTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Controller/Category/ViewTest.php @@ -192,7 +192,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase $this->categoryHelper->expects($this->any())->method('canShow')->will($this->returnValue(true)); - $settings = $this->getMock('Magento\Framework\Object', ['getPageLayout'], [], '', false); + $settings = $this->getMock('Magento\Framework\DataObject', ['getPageLayout'], [], '', false); $settings->expects($this->atLeastOnce())->method('getPageLayout')->will($this->returnValue($pageLayout)); $this->catalogDesign->expects($this->any())->method('getDesignSettings')->will($this->returnValue($settings)); diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/CustomlayoutupdateTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/CustomlayoutupdateTest.php index 450d21fa520..fa8beb38241 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/CustomlayoutupdateTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/CustomlayoutupdateTest.php @@ -8,7 +8,7 @@ namespace Magento\Catalog\Test\Unit\Model\Attribute\Backend; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; class CustomlayoutupdateTest extends \PHPUnit_Framework_TestCase @@ -28,7 +28,7 @@ class CustomlayoutupdateTest extends \PHPUnit_Framework_TestCase */ public function testValidateException() { - $object = new Object(); + $object = new DataObject(); $object->setData($this->attributeName, 'exception'); $this->model->validate($object); } @@ -39,7 +39,7 @@ class CustomlayoutupdateTest extends \PHPUnit_Framework_TestCase */ public function testValidate($data) { - $object = new Object(); + $object = new DataObject(); $object->setData($this->attributeName, $data); $this->assertTrue($this->model->validate($object)); diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Category/Attribute/Backend/SortbyTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Category/Attribute/Backend/SortbyTest.php index e772d52b465..fe26ac2a448 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Category/Attribute/Backend/SortbyTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Category/Attribute/Backend/SortbyTest.php @@ -69,7 +69,7 @@ class SortbyTest extends \PHPUnit_Framework_TestCase public function testBeforeSave($attributeCode, $data, $expected) { $this->_attribute->expects($this->any())->method('getName')->will($this->returnValue($attributeCode)); - $object = new \Magento\Framework\Object($data); + $object = new \Magento\Framework\DataObject($data); $this->_model->beforeSave($object); $this->assertTrue($object->hasData($attributeCode)); $this->assertSame($expected, $object->getData($attributeCode)); @@ -115,7 +115,7 @@ class SortbyTest extends \PHPUnit_Framework_TestCase public function testAfterLoad($attributeCode, $data, $expected) { $this->_attribute->expects($this->any())->method('getName')->will($this->returnValue($attributeCode)); - $object = new \Magento\Framework\Object($data); + $object = new \Magento\Framework\DataObject($data); $this->_model->afterLoad($object); $this->assertTrue($object->hasData($attributeCode)); $this->assertSame($expected, $object->getData($attributeCode)); @@ -159,7 +159,7 @@ class SortbyTest extends \PHPUnit_Framework_TestCase ->expects($this->any()) ->method('isValueEmpty') ->will($this->returnValue($attributeData['isValueEmpty'])); - $object = new \Magento\Framework\Object($data); + $object = new \Magento\Framework\DataObject($data); $this->assertSame($expected, $this->_model->validate($object)); } @@ -206,7 +206,7 @@ class SortbyTest extends \PHPUnit_Framework_TestCase ); $this->_attribute->expects($this->any())->method('getEntity')->will($this->returnValue($entityMock)); $entityMock->expects($this->at(0))->method('checkAttributeUniqueValue')->will($this->returnValue(true)); - $this->assertTrue($this->_model->validate(new \Magento\Framework\Object())); + $this->assertTrue($this->_model->validate(new \Magento\Framework\DataObject())); } /** @@ -239,7 +239,7 @@ class SortbyTest extends \PHPUnit_Framework_TestCase $this->_attribute->expects($this->any())->method('getEntity')->will($this->returnValue($entityMock)); $this->_attribute->expects($this->any())->method('getFrontend')->will($this->returnValue($frontMock)); $entityMock->expects($this->at(0))->method('checkAttributeUniqueValue')->will($this->returnValue(false)); - $this->assertTrue($this->_model->validate(new \Magento\Framework\Object())); + $this->assertTrue($this->_model->validate(new \Magento\Framework\DataObject())); } /** @@ -251,7 +251,7 @@ class SortbyTest extends \PHPUnit_Framework_TestCase { $this->_attribute->expects($this->any())->method('getName')->will($this->returnValue($attributeCode)); $this->_scopeConfig->expects($this->any())->method('getValue')->will($this->returnValue('value2')); - $object = new \Magento\Framework\Object($data); + $object = new \Magento\Framework\DataObject($data); $this->assertTrue($this->_model->validate($object)); } @@ -294,7 +294,7 @@ class SortbyTest extends \PHPUnit_Framework_TestCase { $this->_attribute->expects($this->any())->method('getName')->will($this->returnValue($attributeCode)); $this->_scopeConfig->expects($this->any())->method('getValue')->will($this->returnValue('another value')); - $object = new \Magento\Framework\Object($data); + $object = new \Magento\Framework\DataObject($data); $this->_model->validate($object); } diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Category/AttributeRepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Category/AttributeRepositoryTest.php index 3626042fac9..6e36da98307 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Category/AttributeRepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Category/AttributeRepositoryTest.php @@ -69,7 +69,7 @@ class AttributeRepositoryTest extends \PHPUnit_Framework_TestCase false); $this->eavConfigMock = $this->getMock('Magento\Eav\Model\Config', [], [], '', false); $this->eavConfigMock->expects($this->any())->method('getEntityType') - ->willReturn(new \Magento\Framework\Object(['default_attribute_set_id' => 3])); + ->willReturn(new \Magento\Framework\DataObject(['default_attribute_set_id' => 3])); $this->model = (new ObjectManager($this))->getObject( 'Magento\Catalog\Model\Category\AttributeRepository', [ @@ -117,7 +117,7 @@ class AttributeRepositoryTest extends \PHPUnit_Framework_TestCase $this->searchBuilderMock->expects($this->once())->method('addFilters')->with([$filterMock])->willReturnSelf(); $searchCriteriaMock = $this->getMock('Magento\Framework\Api\SearchCriteria', [], [], '', false); $this->searchBuilderMock->expects($this->once())->method('create')->willReturn($searchCriteriaMock); - $itemMock = $this->getMock('Magento\Framework\Object', [], [], '', false); + $itemMock = $this->getMock('Magento\Framework\DataObject', [], [], '', false); $this->attributeRepositoryMock->expects($this->once())->method('getList')->with( \Magento\Catalog\Api\Data\CategoryAttributeInterface::ENTITY_TYPE_CODE, $searchCriteriaMock diff --git a/app/code/Magento/Catalog/Test/Unit/Model/CategoryRepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/CategoryRepositoryTest.php index 906346504be..3364d055806 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/CategoryRepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/CategoryRepositoryTest.php @@ -111,7 +111,9 @@ class CategoryRepositoryTest extends \PHPUnit_Framework_TestCase $categoryMock->expects($this->once())->method('getParentId')->willReturn(3); $categoryMock->expects($this->once())->method('getPath')->willReturn('path'); $categoryMock->expects($this->once())->method('getIsActive')->willReturn(true); - $this->categoryResourceMock->expects($this->once())->method('save')->willReturn('\Magento\Framework\Object'); + $this->categoryResourceMock->expects($this->once()) + ->method('save') + ->willReturn('\Magento\Framework\DataObject'); $this->assertEquals($categoryMock, $this->model->save($categoryMock)); } @@ -132,7 +134,9 @@ class CategoryRepositoryTest extends \PHPUnit_Framework_TestCase $parentCategoryMock->expects($this->once())->method('getPath')->willReturn('path'); $categoryMock->expects($this->once())->method('validate')->willReturn(true); $categoryMock->expects($this->once())->method('getParentId')->willReturn(3); - $this->categoryResourceMock->expects($this->once())->method('save')->willReturn('\Magento\Framework\Object'); + $this->categoryResourceMock->expects($this->once()) + ->method('save') + ->willReturn('\Magento\Framework\DataObject'); $this->assertEquals($categoryMock, $this->model->save($categoryMock)); } @@ -165,7 +169,7 @@ class CategoryRepositoryTest extends \PHPUnit_Framework_TestCase $this->setExpectedException($expectedException, $expectedExceptionMessage); $categoryId = 5; $categoryMock = $this->getMock('\Magento\Catalog\Model\Category', [], [], '', false); - $objectMock = $this->getMock('\Magento\Framework\Object', ['getFrontend', 'getLabel'], [], '', false); + $objectMock = $this->getMock('\Magento\Framework\DataObject', ['getFrontend', 'getLabel'], [], '', false); $categoryMock->expects( $this->atLeastOnce() )->method('getId')->willReturn($categoryId); diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ConfigTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ConfigTest.php index a74f7fef63e..6432227d2d3 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ConfigTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ConfigTest.php @@ -181,7 +181,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase */ public function testGetSourceOptionId($expected, $data, $search) { - $object = $this->getMock('\Magento\Framework\Object', ['getAllOptions'], [], '', false); + $object = $this->getMock('\Magento\Framework\DataObject', ['getAllOptions'], [], '', false); $object->expects($this->once())->method('getAllOptions')->will($this->returnValue($data)); $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $model = $objectManager->getObject('Magento\Catalog\Model\Config'); diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Layer/Filter/AttributeTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Layer/Filter/AttributeTest.php index 3d35b5f910a..ee2f146c2dd 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Layer/Filter/AttributeTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Layer/Filter/AttributeTest.php @@ -129,7 +129,7 @@ class AttributeTest extends \PHPUnit_Framework_TestCase ->method('filter') ->will($this->returnArgument(0)); - $string = $this->getMockBuilder('\Magento\Framework\Stdlib\String') + $string = $this->getMockBuilder('\Magento\Framework\Stdlib\StringUtils') ->disableOriginalConstructor() ->setMethods(['strlen']) ->getMock(); diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/CategoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/CategoryTest.php index d66f53bc493..db9db223fbe 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/CategoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/CategoryTest.php @@ -11,12 +11,12 @@ class CategoryTest extends \PHPUnit_Framework_TestCase { $categoryIds = [1, 2, 3, 4, 5]; - $product = $this->getMock('Magento\Framework\Object', ['getCategoryIds', 'setData']); + $product = $this->getMock('Magento\Framework\DataObject', ['getCategoryIds', 'setData']); $product->expects($this->once())->method('getCategoryIds')->will($this->returnValue($categoryIds)); $product->expects($this->once())->method('setData')->with('category_ids', $categoryIds); - $categoryAttribute = $this->getMock('Magento\Framework\Object', ['getAttributeCode']); + $categoryAttribute = $this->getMock('Magento\Framework\DataObject', ['getAttributeCode']); $categoryAttribute->expects( $this->once() )->method( diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPrice/AbstractTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPrice/AbstractTest.php index 1cc544f2541..01eb34bdefb 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPrice/AbstractTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPrice/AbstractTest.php @@ -71,7 +71,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $this->_model->setAttribute($attribute); - $object = new \Magento\Framework\Object(); + $object = new \Magento\Framework\DataObject(); $object->setGroupPrice([['price_id' => 10]]); $object->setId(555); diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/MediaTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/MediaTest.php index 98df6c6baa8..5ff3d8b2d52 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/MediaTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/MediaTest.php @@ -18,7 +18,7 @@ class MediaTest extends \PHPUnit_Framework_TestCase protected $_objectHelper; /** - * @var \Magento\Framework\Object | \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObject | \PHPUnit_Framework_MockObject_MockObject */ protected $dataObject; @@ -92,7 +92,7 @@ class MediaTest extends \PHPUnit_Framework_TestCase 'resourceProductAttribute' => $this->resourceModel ] ); - $this->dataObject = $this->getMockBuilder('Magento\Framework\Object') + $this->dataObject = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->setMethods(['getIsDuplicate', 'isLockedAttribute', 'getMediaAttributes']) ->getMock(); @@ -117,7 +117,7 @@ class MediaTest extends \PHPUnit_Framework_TestCase $this->model->setAttribute($attribute); - $object = new \Magento\Framework\Object(); + $object = new \Magento\Framework\DataObject(); $object->setImage(['images' => [['value_id' => $valueId]]]); $object->setId(555); diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/StockTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/StockTest.php index 6acd8589b6f..76913ebb1e6 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/StockTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/StockTest.php @@ -50,7 +50,7 @@ class StockTest extends \PHPUnit_Framework_TestCase 'Magento\Catalog\Model\Product\Attribute\Backend\Stock', ['stockRegistry' => $this->stockRegistry] ); - $attribute = $this->getMock('Magento\Framework\Object', ['getAttributeCode']); + $attribute = $this->getMock('Magento\Framework\DataObject', ['getAttributeCode']); $attribute->expects($this->atLeastOnce()) ->method('getAttributeCode') ->will($this->returnValue(self::ATTRIBUTE_NAME)); @@ -68,7 +68,7 @@ class StockTest extends \PHPUnit_Framework_TestCase $store->expects($this->once()) ->method('getWebsiteId') ->will($this->returnValue(10)); - $object = new \Magento\Framework\Object(['id' => $productId, 'store' => $store]); + $object = new \Magento\Framework\DataObject(['id' => $productId, 'store' => $store]); $this->model->afterLoad($object); $data = $object->getData(); $this->assertEquals(1, $data[self::ATTRIBUTE_NAME]['is_in_stock']); @@ -77,7 +77,7 @@ class StockTest extends \PHPUnit_Framework_TestCase public function testBeforeSave() { - $object = new \Magento\Framework\Object( + $object = new \Magento\Framework\DataObject( [ self::ATTRIBUTE_NAME => ['is_in_stock' => 1, 'qty' => 5], 'stock_data' => ['is_in_stock' => 2, 'qty' => 2], @@ -98,7 +98,7 @@ class StockTest extends \PHPUnit_Framework_TestCase public function testBeforeSaveQtyIsEmpty() { - $object = new \Magento\Framework\Object( + $object = new \Magento\Framework\DataObject( [ self::ATTRIBUTE_NAME => ['is_in_stock' => 1, 'qty' => ''], 'stock_data' => ['is_in_stock' => 2, 'qty' => ''], @@ -113,7 +113,7 @@ class StockTest extends \PHPUnit_Framework_TestCase public function testBeforeSaveQtyIsZero() { - $object = new \Magento\Framework\Object( + $object = new \Magento\Framework\DataObject( [ self::ATTRIBUTE_NAME => ['is_in_stock' => 1, 'qty' => 0], 'stock_data' => ['is_in_stock' => 2, 'qty' => 0], diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/GroupTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/GroupTest.php index a7298c3d932..652c94ec0f3 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/GroupTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/GroupTest.php @@ -5,7 +5,7 @@ */ namespace Magento\Catalog\Test\Unit\Model\Product\Attribute; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; class GroupTest extends \PHPUnit_Framework_TestCase @@ -60,7 +60,7 @@ class GroupTest extends \PHPUnit_Framework_TestCase $mock = $mockBuilder->disableOriginalConstructor() ->getMock(); - $item = new Object(); + $item = new DataObject(); $item->setIsUserDefine(false); $mock->expects($this->any()) diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/RepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/RepositoryTest.php index 533a4196a74..2f0d531bb8c 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/RepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/RepositoryTest.php @@ -75,7 +75,7 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\Eav\Api\AttributeRepositoryInterface', [], [], '', false); $this->eavConfigMock = $this->getMock('Magento\Eav\Model\Config', [], [], '', false); $this->eavConfigMock->expects($this->any())->method('getEntityType') - ->willReturn(new \Magento\Framework\Object(['default_attribute_set_id' => 4])); + ->willReturn(new \Magento\Framework\DataObject(['default_attribute_set_id' => 4])); $this->validatorFactoryMock = $this->getMock( 'Magento\Eav\Model\Adminhtml\System\Config\Source\Inputtype\ValidatorFactory', ['create'], diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/CopyConstructorFactoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/CopyConstructorFactoryTest.php index 2863a801b26..9359c743f5e 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/CopyConstructorFactoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/CopyConstructorFactoryTest.php @@ -29,10 +29,10 @@ class CopyConstructorFactoryTest extends \PHPUnit_Framework_TestCase { $this->setExpectedException( '\InvalidArgumentException', - 'Magento\Framework\Object does not implement \Magento\Catalog\Model\Product\CopyConstructorInterface' + 'Magento\Framework\DataObject does not implement \Magento\Catalog\Model\Product\CopyConstructorInterface' ); $this->_objectManagerMock->expects($this->never())->method('create'); - $this->_model->create('Magento\Framework\Object'); + $this->_model->create('Magento\Framework\DataObject'); } public function testCreateWithValidType() diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Image/CacheTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Image/CacheTest.php index 5259f28e5ea..cf06fb55db6 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Image/CacheTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Image/CacheTest.php @@ -90,7 +90,7 @@ class CacheTest extends \PHPUnit_Framework_TestCase { $imageFile = 'image.jpg'; $imageItem = $this->objectManager->getObject( - 'Magento\Framework\Object', + 'Magento\Framework\DataObject', [ 'data' => ['file' => $imageFile] ] diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Option/Validator/DefaultValidatorTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Option/Validator/DefaultValidatorTest.php index 2dd2a2dd4c7..df9c738dd4a 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Option/Validator/DefaultValidatorTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Option/Validator/DefaultValidatorTest.php @@ -59,10 +59,10 @@ class DefaultValidatorTest extends \PHPUnit_Framework_TestCase { $mess = ['option required fields' => 'Missed values for option required fields']; return [ - ['option_title', 'name 1.1', 'fixed', 10, new \Magento\Framework\Object(['store_id' => 1]), [], true], - ['option_title', 'name 1.1', 'fixed', 10, new \Magento\Framework\Object(['store_id' => 0]), [], true], - [null, 'name 1.1', 'fixed', 10, new \Magento\Framework\Object(['store_id' => 1]), [], true], - [null, 'name 1.1', 'fixed', 10, new \Magento\Framework\Object(['store_id' => 0]), $mess, false], + ['option_title', 'name 1.1', 'fixed', 10, new \Magento\Framework\DataObject(['store_id' => 1]), [], true], + ['option_title', 'name 1.1', 'fixed', 10, new \Magento\Framework\DataObject(['store_id' => 0]), [], true], + [null, 'name 1.1', 'fixed', 10, new \Magento\Framework\DataObject(['store_id' => 1]), [], true], + [null, 'name 1.1', 'fixed', 10, new \Magento\Framework\DataObject(['store_id' => 0]), $mess, false], ]; } @@ -97,8 +97,8 @@ class DefaultValidatorTest extends \PHPUnit_Framework_TestCase public function isValidFailDataProvider() { return [ - [new \Magento\Framework\Object(['store_id' => 1])], - [new \Magento\Framework\Object(['store_id' => 0])], + [new \Magento\Framework\DataObject(['store_id' => 1])], + [new \Magento\Framework\DataObject(['store_id' => 0])], ]; } @@ -131,8 +131,8 @@ class DefaultValidatorTest extends \PHPUnit_Framework_TestCase public function validationNegativePriceDataProvider() { return [ - ['option_title', 'name 1.1', 'fixed', -12, new \Magento\Framework\Object(['store_id' => 1])], - ['option_title', 'name 1.1', 'fixed', -12, new \Magento\Framework\Object(['store_id' => 0])], + ['option_title', 'name 1.1', 'fixed', -12, new \Magento\Framework\DataObject(['store_id' => 1])], + ['option_title', 'name 1.1', 'fixed', -12, new \Magento\Framework\DataObject(['store_id' => 0])], ]; } diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/ValidatorTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/ValidatorTest.php index 2d4c22981ac..2f3b20a2bbb 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/ValidatorTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/ValidatorTest.php @@ -12,7 +12,7 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase $validator = new \Magento\Catalog\Model\Product\Validator(); $productMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); $requestMock = $this->getMock('Magento\Framework\App\RequestInterface'); - $responseMock = $this->getMock('Magento\Framework\Object'); + $responseMock = $this->getMock('Magento\Framework\DataObject'); $productMock->expects($this->once())->method('validate')->will($this->returnValue(true)); $this->assertEquals(true, $validator->validate($productMock, $requestMock, $responseMock)); } diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php index 87aef1de10e..261296b1d3c 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php @@ -578,7 +578,7 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase $filterGroupMock = $this->getMock('\Magento\Framework\Api\Search\FilterGroup', [], [], '', false); $filterGroupFilterMock = $this->getMock('\Magento\Framework\Api\Filter', [], [], '', false); $sortOrderMock = $this->getMock('\Magento\Framework\Api\SortOrder', [], [], '', false); - $itemsMock = $this->getMock('\Magento\Framework\Object', [], [], '', false); + $itemsMock = $this->getMock('\Magento\Framework\DataObject', [], [], '', false); $this->collectionFactoryMock->expects($this->once())->method('create')->willReturn($collectionMock); $this->searchCriteriaBuilderMock->expects($this->once())->method('create') diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Resource/AbstractTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Resource/AbstractTest.php index 62460a7b1f6..7f1f43250c5 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Resource/AbstractTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Resource/AbstractTest.php @@ -53,7 +53,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $object->setData('test_attr', 'test_attr'); $object->setData('attribute_set_id', $set); - $entityType = new \Magento\Framework\Object(); + $entityType = new \Magento\Framework\DataObject(); $entityType->setEntityTypeCode('test'); $entityType->setEntityTypeId(0); $entityType->setEntityTable('table'); diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Resource/Product/Link/Product/CollectionTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Resource/Product/Link/Product/CollectionTest.php index dd6c8e48544..4a56d241793 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Resource/Product/Link/Product/CollectionTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Resource/Product/Link/Product/CollectionTest.php @@ -96,7 +96,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase ->method('getStore') ->will($this->returnCallback( function ($store) { - return is_object($store) ? $store : new \Magento\Framework\Object(['id' => 42]); + return is_object($store) ? $store : new \Magento\Framework\DataObject(['id' => 42]); } )); $this->catalogHelperMock = $this->getMock('Magento\Catalog\Helper\Data', [], [], '', false); @@ -138,7 +138,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject $product */ $product = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); $product->expects($this->any())->method('getId')->will($this->returnValue('5')); - $productStore = new \Magento\Framework\Object(['id' => 33]); + $productStore = new \Magento\Framework\DataObject(['id' => 33]); $product->expects($this->any())->method('getStore')->will($this->returnValue($productStore)); $this->collection->setProduct($product); $this->assertEquals(33, $this->collection->getStoreId()); diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Resource/ProductTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Resource/ProductTest.php index 97c41ca67ea..bab9cd0f09b 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Resource/ProductTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Resource/ProductTest.php @@ -58,7 +58,13 @@ class ProductTest extends \PHPUnit_Framework_TestCase $productTypeId = 4; $expectedErrorMessage = ['attribute_set' => 'Invalid product template entity type']; - $productMock = $this->getMock('\Magento\Framework\Object', ['getAttributeSetId', '__wakeup'], [], '', false); + $productMock = $this->getMock( + '\Magento\Framework\DataObject', + ['getAttributeSetId', '__wakeup'], + [], + '', + false + ); $attributeSetMock = $this->getMock( '\Magento\Eav\Model\Entity\Attribute\Set', ['load', 'getEntityTypeId', '__wakeup'], diff --git a/app/code/Magento/Catalog/Test/Unit/Pricing/Price/CustomOptionPriceTest.php b/app/code/Magento/Catalog/Test/Unit/Pricing/Price/CustomOptionPriceTest.php index 523e2c79834..710055ebab7 100644 --- a/app/code/Magento/Catalog/Test/Unit/Pricing/Price/CustomOptionPriceTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Pricing/Price/CustomOptionPriceTest.php @@ -358,7 +358,7 @@ class CustomOptionPriceTest extends \PHPUnit_Framework_TestCase $optionValueMock->expects($this->once()) ->method('getValue') ->will($this->returnValue($optionValue)); - $optionIds = new \Magento\Framework\Object(['value' => '1,2']); + $optionIds = new \Magento\Framework\DataObject(['value' => '1,2']); $customOptions = ['option_ids' => $optionIds, 'option_1' => $optionValueMock, 'option_2' => null]; $this->product->setCustomOptions($customOptions); diff --git a/app/code/Magento/Catalog/Ui/Component/Listing/Columns/Thumbnail.php b/app/code/Magento/Catalog/Ui/Component/Listing/Columns/Thumbnail.php index 1a49073bf40..b47b36974e6 100644 --- a/app/code/Magento/Catalog/Ui/Component/Listing/Columns/Thumbnail.php +++ b/app/code/Magento/Catalog/Ui/Component/Listing/Columns/Thumbnail.php @@ -46,7 +46,7 @@ class Thumbnail extends \Magento\Ui\Component\Listing\Columns\Column if (isset($dataSource['data']['items'])) { $fieldName = $this->getData('name'); foreach ($dataSource['data']['items'] as & $item) { - $product = new \Magento\Framework\Object($item); + $product = new \Magento\Framework\DataObject($item); $imageView = $this->imageFactory->create() ->init($product, 'product_listing_thumbnail', 'Magento_Catalog'); $origImageView = $this->imageFactory->create() diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml index 505a3f19d3f..b33b32dcd13 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml @@ -100,7 +100,7 @@ jQuery(function ($) { ] )?>); //adding data to templates - <?php /** @var $_value \Magento\Framework\Object */ ?> + <?php /** @var $_value \Magento\Framework\DataObject */ ?> <?php foreach ($block->getOptionValues() as $_value): ?> fieldSet.customOptions('addOption', <?php echo $_value->toJson() ?>); <?php endforeach; ?> diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index 6f3dffec4b3..fb3c3248e24 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -560,7 +560,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity * @param \Magento\Eav\Model\Config $config * @param \Magento\Framework\App\Resource $resource * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry * @param \Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration @@ -596,7 +596,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity \Magento\Eav\Model\Config $config, \Magento\Framework\App\Resource $resource, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\Event\ManagerInterface $eventManager, \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry, \Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration, diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php index 9d4eec60dd6..d9a7920de0e 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php @@ -42,7 +42,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase /** @var \Magento\ImportExport\Model\Resource\Helper|\PHPUnit_Framework_MockObject_MockObject */ protected $_resourceHelper; - /** @var \Magento\Framework\Stdlib\String|\PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Framework\Stdlib\StringUtils|\PHPUnit_Framework_MockObject_MockObject */ protected $string; /** @var \Magento\Framework\Event\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ @@ -182,7 +182,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); $this->string = - $this->getMockBuilder('\Magento\Framework\Stdlib\String') + $this->getMockBuilder('\Magento\Framework\Stdlib\StringUtils') ->disableOriginalConstructor() ->getMock(); @@ -528,7 +528,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase { $attrCode = 'code'; $rowNum = 0; - $string = $this->getMockBuilder('\Magento\Framework\Stdlib\String')->setMethods(null)->getMock(); + $string = $this->getMockBuilder('\Magento\Framework\Stdlib\StringUtils')->setMethods(null)->getMock(); $this->setPropertyValue($this->importProduct, 'string', $string); $result = $this->importProduct->isAttributeValid($attrCode, $attrParams, $rowData, $rowNum); @@ -542,7 +542,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase { $attrCode = 'code'; $rowNum = 0; - $string = $this->getMockBuilder('\Magento\Framework\Stdlib\String')->setMethods(null)->getMock(); + $string = $this->getMockBuilder('\Magento\Framework\Stdlib\StringUtils')->setMethods(null)->getMock(); $this->setPropertyValue($this->importProduct, 'string', $string); $result = $this->importProduct->isAttributeValid($attrCode, $attrParams, $rowData, $rowNum); diff --git a/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Minsaleqty.php b/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Minsaleqty.php index 14205e21cdc..12f8028adf1 100644 --- a/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Minsaleqty.php +++ b/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Minsaleqty.php @@ -55,10 +55,10 @@ class Minsaleqty extends \Magento\Config\Block\System\Config\Form\Field\FieldArr /** * Prepare existing row data object * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return void */ - protected function _prepareArrayRow(\Magento\Framework\Object $row) + protected function _prepareArrayRow(\Magento\Framework\DataObject $row) { $optionExtraAttr = []; $optionExtraAttr['option_' . $this->_getGroupRenderer()->calcOptionHash($row->getData('customer_group_id'))] = diff --git a/app/code/Magento/CatalogInventory/Block/Qtyincrements.php b/app/code/Magento/CatalogInventory/Block/Qtyincrements.php index 06334160c1f..87f2ad8ee79 100644 --- a/app/code/Magento/CatalogInventory/Block/Qtyincrements.php +++ b/app/code/Magento/CatalogInventory/Block/Qtyincrements.php @@ -6,7 +6,7 @@ namespace Magento\CatalogInventory\Block; -use Magento\Framework\Object\IdentityInterface; +use Magento\Framework\DataObject\IdentityInterface; use Magento\Framework\View\Element\Template; /** diff --git a/app/code/Magento/CatalogInventory/Block/Stockqty/DefaultStockqty.php b/app/code/Magento/CatalogInventory/Block/Stockqty/DefaultStockqty.php index 2f2e3de76c9..1fabefdabec 100644 --- a/app/code/Magento/CatalogInventory/Block/Stockqty/DefaultStockqty.php +++ b/app/code/Magento/CatalogInventory/Block/Stockqty/DefaultStockqty.php @@ -9,7 +9,7 @@ namespace Magento\CatalogInventory\Block\Stockqty; /** * Product stock qty default block */ -class DefaultStockqty extends AbstractStockqty implements \Magento\Framework\Object\IdentityInterface +class DefaultStockqty extends AbstractStockqty implements \Magento\Framework\DataObject\IdentityInterface { /** * Render block HTML diff --git a/app/code/Magento/CatalogInventory/Model/Adminhtml/Stock/Item.php b/app/code/Magento/CatalogInventory/Model/Adminhtml/Stock/Item.php index ee34eeea325..8b8a78576f1 100644 --- a/app/code/Magento/CatalogInventory/Model/Adminhtml/Stock/Item.php +++ b/app/code/Magento/CatalogInventory/Model/Adminhtml/Stock/Item.php @@ -11,7 +11,7 @@ use Magento\CatalogInventory\Api\StockRegistryInterface; use Magento\Customer\Api\GroupManagementInterface; use Magento\Framework\Api\AttributeValueFactory; use Magento\Framework\Api\ExtensionAttributesFactory; -use Magento\Framework\Object\IdentityInterface; +use Magento\Framework\DataObject\IdentityInterface; use Magento\Catalog\Model\Product; /** diff --git a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/Option.php b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/Option.php index 25bd993d9c4..e73e2604e72 100644 --- a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/Option.php +++ b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/Option.php @@ -82,7 +82,7 @@ class Option * @param \Magento\Quote\Model\Quote\Item $quoteItem * @param int $qty * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject * @throws \Magento\Framework\Exception\LocalizedException */ public function initialize( diff --git a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/StockItem.php b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/StockItem.php index fb4a2db4e4b..80ad846c065 100644 --- a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/StockItem.php +++ b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/StockItem.php @@ -48,7 +48,7 @@ class StockItem * @param \Magento\Quote\Model\Quote\Item $quoteItem * @param int $qty * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php index b182d738370..14840bf4cbc 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php @@ -92,11 +92,11 @@ class Item extends \Magento\Framework\Model\Resource\Db\AbstractDb /** * Use qty correction for qty column update * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @param string $table * @return array */ - protected function _prepareDataForTable(\Magento\Framework\Object $object, $table) + protected function _prepareDataForTable(\Magento\Framework\DataObject $object, $table) { $data = parent::_prepareDataForTable($object, $table); $ifNullSql = $this->_getWriteAdapter()->getIfNullSql('qty'); diff --git a/app/code/Magento/CatalogInventory/Model/Spi/StockStateProviderInterface.php b/app/code/Magento/CatalogInventory/Model/Spi/StockStateProviderInterface.php index 8cf02411bd7..fee268a4a42 100644 --- a/app/code/Magento/CatalogInventory/Model/Spi/StockStateProviderInterface.php +++ b/app/code/Magento/CatalogInventory/Model/Spi/StockStateProviderInterface.php @@ -56,7 +56,7 @@ interface StockStateProviderInterface /** * @param StockItemInterface $stockItem * @param int|float $qty - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function checkQtyIncrements(StockItemInterface $stockItem, $qty); diff --git a/app/code/Magento/CatalogInventory/Model/StockIndex.php b/app/code/Magento/CatalogInventory/Model/StockIndex.php index 2eaf9a9bac6..406d6364e7f 100644 --- a/app/code/Magento/CatalogInventory/Model/StockIndex.php +++ b/app/code/Magento/CatalogInventory/Model/StockIndex.php @@ -17,6 +17,7 @@ use Magento\Catalog\Api\ProductRepositoryInterface; /** * Class StockIndex + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class StockIndex implements StockIndexInterface { @@ -250,7 +251,7 @@ class StockIndex implements StockIndexInterface protected function getProductTypeInstances() { if (empty($this->productTypes)) { - $productEmulator = new \Magento\Framework\Object(); + $productEmulator = new \Magento\Framework\DataObject(); foreach (array_keys($this->productType->getTypes()) as $typeId) { $productEmulator->setTypeId($typeId); $this->productTypes[$typeId] = $this->productType->factory($productEmulator); diff --git a/app/code/Magento/CatalogInventory/Model/StockState.php b/app/code/Magento/CatalogInventory/Model/StockState.php index 3c1dc5073e7..c299fc19e0a 100644 --- a/app/code/Magento/CatalogInventory/Model/StockState.php +++ b/app/code/Magento/CatalogInventory/Model/StockState.php @@ -129,7 +129,7 @@ class StockState implements StockStateInterface * @param int $productId * @param float $qty * @param int $websiteId - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function checkQtyIncrements($productId, $qty, $websiteId = null) { @@ -146,7 +146,7 @@ class StockState implements StockStateInterface * @param float $qtyToCheck * @param float $origQty * @param int $websiteId - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function checkQuoteItemQty($productId, $itemQty, $qtyToCheck, $origQty, $websiteId = null) { diff --git a/app/code/Magento/CatalogInventory/Model/StockStateProvider.php b/app/code/Magento/CatalogInventory/Model/StockStateProvider.php index bb4acf45859..8fbb6f3512d 100644 --- a/app/code/Magento/CatalogInventory/Model/StockStateProvider.php +++ b/app/code/Magento/CatalogInventory/Model/StockStateProvider.php @@ -13,7 +13,7 @@ use Magento\CatalogInventory\Api\Data\StockItemInterface; use Magento\CatalogInventory\Model\Spi\StockStateProviderInterface; use Magento\Framework\Locale\FormatInterface; use Magento\Framework\Math\Division as MathDivision; -use Magento\Framework\Object\Factory as ObjectFactory; +use Magento\Framework\DataObject\Factory as ObjectFactory; /** * Interface StockStateProvider @@ -95,7 +95,7 @@ class StockStateProvider implements StockStateProviderInterface * @param int|float $qty * @param int|float $summaryQty * @param int|float $origQty - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) @@ -294,11 +294,11 @@ class StockStateProvider implements StockStateProviderInterface /** * @param StockItemInterface $stockItem * @param float|int $qty - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function checkQtyIncrements(StockItemInterface $stockItem, $qty) { - $result = new \Magento\Framework\Object(); + $result = new \Magento\Framework\DataObject(); if ($stockItem->getSuppressCheckQtyIncrements()) { return $result; } diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Api/StockStateTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Api/StockStateTest.php index 90ed131e060..13f8a52905c 100644 --- a/app/code/Magento/CatalogInventory/Test/Unit/Api/StockStateTest.php +++ b/app/code/Magento/CatalogInventory/Test/Unit/Api/StockStateTest.php @@ -48,7 +48,7 @@ class StockStateTest extends \PHPUnit_Framework_TestCase protected $stockStatus; /** - * @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject */ protected $objectResult; @@ -82,7 +82,7 @@ class StockStateTest extends \PHPUnit_Framework_TestCase false ); $this->objectResult = $this->getMock( - '\Magento\Framework\Object', + '\Magento\Framework\DataObject', [], [], '', diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/OptionTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/OptionTest.php index cf29ddb3123..5a027850f28 100644 --- a/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/OptionTest.php +++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/OptionTest.php @@ -142,7 +142,7 @@ class OptionTest extends \PHPUnit_Framework_TestCase 'getItemBackorders', '__wakeup', ]; - $this->resultMock = $this->getMock('Magento\Framework\Object', $resultMethods, [], '', false); + $this->resultMock = $this->getMock('Magento\Framework\DataObject', $resultMethods, [], '', false); $this->stockRegistry = $this->getMockForAbstractClass( 'Magento\CatalogInventory\Api\StockRegistryInterface', diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/StockItemTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/StockItemTest.php index efc414be61f..27453c6fee7 100644 --- a/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/StockItemTest.php +++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/StockItemTest.php @@ -110,7 +110,7 @@ class StockItemTest extends \PHPUnit_Framework_TestCase $productTypeCustomOption = $this->getMockBuilder('Magento\Catalog\Model\Product\Configuration\Item\Option') ->disableOriginalConstructor() ->getMock(); - $result = $this->getMockBuilder('Magento\Framework\Object') + $result = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods( [ 'getItemIsQtyDecimal', @@ -206,7 +206,7 @@ class StockItemTest extends \PHPUnit_Framework_TestCase $productTypeCustomOption = $this->getMockBuilder('Magento\Catalog\Model\Product\Configuration\Item\Option') ->disableOriginalConstructor() ->getMock(); - $result = $this->getMockBuilder('Magento\Framework\Object') + $result = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods( ['getItemIsQtyDecimal', 'getHasQtyOptionUpdate', 'getItemUseOldQty', 'getMessage', 'getItemBackorders'] ) diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Spi/StockStateProviderTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Spi/StockStateProviderTest.php index 88920dc0704..8dd8774fa8f 100644 --- a/app/code/Magento/CatalogInventory/Test/Unit/Model/Spi/StockStateProviderTest.php +++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Spi/StockStateProviderTest.php @@ -44,12 +44,12 @@ class StockStateProviderTest extends \PHPUnit_Framework_TestCase protected $localeFormat; /** - * @var \Magento\Framework\Object\Factory|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObject\Factory|\PHPUnit_Framework_MockObject_MockObject */ protected $objectFactory; /** - * @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject */ protected $object; @@ -125,8 +125,8 @@ class StockStateProviderTest extends \PHPUnit_Framework_TestCase ->method('getNumber') ->willReturn($this->qty); - $this->object = $this->objectManagerHelper->getObject('Magento\Framework\Object'); - $this->objectFactory = $this->getMock('\Magento\Framework\Object\Factory', ['create'], [], '', false); + $this->object = $this->objectManagerHelper->getObject('Magento\Framework\DataObject'); + $this->objectFactory = $this->getMock('\Magento\Framework\DataObject\Factory', ['create'], [], '', false); $this->objectFactory->expects($this->any())->method('create')->willReturn($this->object); $this->product = $this->getMock( diff --git a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Main.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Main.php index c3da800a88d..c9d538a0920 100644 --- a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Main.php +++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Main.php @@ -33,7 +33,7 @@ class Main extends Generic implements TabInterface protected $_searchCriteriaBuilder; /** - * @var \Magento\Framework\Convert\Object + * @var \Magento\Framework\Convert\DataObject */ protected $_objectConverter; @@ -43,7 +43,7 @@ class Main extends Generic implements TabInterface * @param \Magento\Framework\Data\FormFactory $formFactory * @param \Magento\Customer\Api\GroupRepositoryInterface $groupRepository * @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder - * @param \Magento\Framework\Convert\Object $objectConverter + * @param \Magento\Framework\Convert\DataObject $objectConverter * @param \Magento\Store\Model\System\Store $systemStore * @param array $data */ @@ -53,7 +53,7 @@ class Main extends Generic implements TabInterface \Magento\Framework\Data\FormFactory $formFactory, \Magento\Customer\Api\GroupRepositoryInterface $groupRepository, \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder, - \Magento\Framework\Convert\Object $objectConverter, + \Magento\Framework\Convert\DataObject $objectConverter, \Magento\Store\Model\System\Store $systemStore, array $data = [] ) { diff --git a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/Save.php b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/Save.php index d03e7ac48af..16415977b55 100644 --- a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/Save.php +++ b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/Save.php @@ -39,7 +39,7 @@ class Save extends \Magento\CatalogRule\Controller\Adminhtml\Promo\Catalog } } - $validateResult = $model->validateData(new \Magento\Framework\Object($data)); + $validateResult = $model->validateData(new \Magento\Framework\DataObject($data)); if ($validateResult !== true) { foreach ($validateResult as $errorMessage) { $this->messageManager->addError($errorMessage); diff --git a/app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php b/app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php index e3644ad442a..74f2f984cdd 100644 --- a/app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php +++ b/app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php @@ -7,7 +7,7 @@ namespace Magento\CatalogRule\Model\Indexer; use Magento\Framework\Mview\ActionInterface as MviewActionInterface; use Magento\Indexer\Model\ActionInterface as IndexerActionInterface; -use Magento\Framework\Object\IdentityInterface as IdentityInterface; +use Magento\Framework\DataObject\IdentityInterface as IdentityInterface; abstract class AbstractIndexer implements IndexerActionInterface, MviewActionInterface, IdentityInterface { diff --git a/app/code/Magento/CatalogRule/Model/Rule/Job.php b/app/code/Magento/CatalogRule/Model/Rule/Job.php index a4aebae5b28..013a3191f06 100644 --- a/app/code/Magento/CatalogRule/Model/Rule/Job.php +++ b/app/code/Magento/CatalogRule/Model/Rule/Job.php @@ -24,7 +24,7 @@ namespace Magento\CatalogRule\Model\Rule; use Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor; -class Job extends \Magento\Framework\Object +class Job extends \Magento\Framework\DataObject { /** * @var RuleProductProcessor diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php index 38863860cbb..7cf38177d93 100644 --- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php +++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php @@ -659,12 +659,12 @@ class Full * Retrieve Product Emulator (Magento Object) * * @param string $typeId - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function getProductEmulator($typeId) { if (!isset($this->productEmulators[$typeId])) { - $productEmulator = new \Magento\Framework\Object(); + $productEmulator = new \Magento\Framework\DataObject(); $productEmulator->setTypeId($typeId); $this->productEmulators[$typeId] = $productEmulator; } diff --git a/app/code/Magento/CatalogSearch/Model/Search/Catalog.php b/app/code/Magento/CatalogSearch/Model/Search/Catalog.php index c78fd855170..176e94a3d4c 100644 --- a/app/code/Magento/CatalogSearch/Model/Search/Catalog.php +++ b/app/code/Magento/CatalogSearch/Model/Search/Catalog.php @@ -10,7 +10,7 @@ use Magento\Search\Model\QueryFactory; /** * Search model for backend search */ -class Catalog extends \Magento\Framework\Object +class Catalog extends \Magento\Framework\DataObject { /** * Catalog search data @@ -22,7 +22,7 @@ class Catalog extends \Magento\Framework\Object /** * Magento string lib * - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -35,12 +35,12 @@ class Catalog extends \Magento\Framework\Object /** * @param \Magento\Backend\Helper\Data $adminhtmlData - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param QueryFactory $queryFactory */ public function __construct( \Magento\Backend\Helper\Data $adminhtmlData, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, QueryFactory $queryFactory ) { $this->_adminhtmlData = $adminhtmlData; diff --git a/app/code/Magento/CatalogSearch/Model/Search/IndexBuilder.php b/app/code/Magento/CatalogSearch/Model/Search/IndexBuilder.php index 6ae4e1ba0cf..36d28c5f017 100644 --- a/app/code/Magento/CatalogSearch/Model/Search/IndexBuilder.php +++ b/app/code/Magento/CatalogSearch/Model/Search/IndexBuilder.php @@ -203,7 +203,7 @@ class IndexBuilder implements IndexBuilderInterface $hasFilters = false; switch ($query->getType()) { case RequestQueryInterface::TYPE_BOOL: - /** @var \Magento\Framework\Search\Request\Query\Bool $query */ + /** @var \Magento\Framework\Search\Request\Query\BoolExpression $query */ foreach ($query->getMust() as $subQuery) { $hasFilters |= $this->hasFilters($subQuery); } diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Model/Autocomplete/DataProviderTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Model/Autocomplete/DataProviderTest.php index 9144f2de2ae..21ad2e71def 100644 --- a/app/code/Magento/CatalogSearch/Test/Unit/Model/Autocomplete/DataProviderTest.php +++ b/app/code/Magento/CatalogSearch/Test/Unit/Model/Autocomplete/DataProviderTest.php @@ -111,7 +111,7 @@ class DataProviderTest extends \PHPUnit_Framework_TestCase { $collectionData = []; foreach ($data as $collectionItem) { - $collectionData[] = new \Magento\Framework\Object($collectionItem); + $collectionData[] = new \Magento\Framework\DataObject($collectionItem); } $this->suggestCollection->expects($this->any()) ->method('getIterator') diff --git a/app/code/Magento/CatalogUrlRewrite/Model/ObjectRegistry.php b/app/code/Magento/CatalogUrlRewrite/Model/ObjectRegistry.php index 73b61a63349..ddcf267c22e 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/ObjectRegistry.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/ObjectRegistry.php @@ -10,12 +10,12 @@ class ObjectRegistry /** * Key is id of entity, value is entity * - * @var \Magento\Framework\Object[] + * @var \Magento\Framework\DataObject[] */ protected $entitiesMap; /** - * @param \Magento\Framework\Object[] $entities + * @param \Magento\Framework\DataObject[] $entities */ public function __construct($entities) { @@ -27,7 +27,7 @@ class ObjectRegistry /** * @param int $entityId - * @return \Magento\Framework\Object|null + * @return \Magento\Framework\DataObject|null */ public function get($entityId) { @@ -35,7 +35,7 @@ class ObjectRegistry } /** - * @return \Magento\Framework\Object[] + * @return \Magento\Framework\DataObject[] */ public function getList() { diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ObjectRegistryTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ObjectRegistryTest.php index d5f435f0963..c6e85a0ca28 100644 --- a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ObjectRegistryTest.php +++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ObjectRegistryTest.php @@ -5,7 +5,7 @@ */ namespace Magento\CatalogUrlRewrite\Test\Unit\Model; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; class ObjectRegistryTest extends \PHPUnit_Framework_TestCase @@ -13,12 +13,12 @@ class ObjectRegistryTest extends \PHPUnit_Framework_TestCase /** @var \Magento\CatalogUrlRewrite\Model\ObjectRegistry */ protected $objectRegistry; - /** @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject */ protected $object; protected function setUp() { - $this->object = new \Magento\Framework\Object(['id' => 1]); + $this->object = new \Magento\Framework\DataObject(['id' => 1]); $this->objectRegistry = (new ObjectManager($this))->getObject( 'Magento\CatalogUrlRewrite\Model\ObjectRegistry', ['entities' => [$this->object]] diff --git a/app/code/Magento/Checkout/Block/Cart.php b/app/code/Magento/Checkout/Block/Cart.php index 4a788f5725a..a3401d0a4b2 100644 --- a/app/code/Magento/Checkout/Block/Cart.php +++ b/app/code/Magento/Checkout/Block/Cart.php @@ -98,7 +98,7 @@ class Cart extends \Magento\Checkout\Block\Cart\AbstractCart } if (isset($products[$product->getId()])) { - $object = new \Magento\Framework\Object($products[$product->getId()]); + $object = new \Magento\Framework\DataObject($products[$product->getId()]); $item->getProduct()->setUrlDataObject($object); } } diff --git a/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php b/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php index 3153691b173..79a4ea3bf2c 100644 --- a/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php +++ b/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php @@ -23,7 +23,7 @@ use Magento\Catalog\Pricing\Price\ConfiguredPriceInterface; * @method \Magento\Checkout\Block\Cart\Item\Renderer setDeleteUrl(string) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Renderer extends \Magento\Framework\View\Element\Template implements \Magento\Framework\Object\IdentityInterface +class Renderer extends \Magento\Framework\View\Element\Template implements \Magento\Framework\DataObject\IdentityInterface { /** * @var \Magento\Checkout\Model\Session diff --git a/app/code/Magento/Checkout/Controller/Cart/Configure.php b/app/code/Magento/Checkout/Controller/Cart/Configure.php index 5dbf15da3ac..6ed2fdd5084 100644 --- a/app/code/Magento/Checkout/Controller/Cart/Configure.php +++ b/app/code/Magento/Checkout/Controller/Cart/Configure.php @@ -63,7 +63,7 @@ class Configure extends \Magento\Checkout\Controller\Cart return $this->resultFactory->create(ResultFactory::TYPE_REDIRECT)->setPath('checkout/cart'); } - $params = new \Magento\Framework\Object(); + $params = new \Magento\Framework\DataObject(); $params->setCategoryId(false); $params->setConfigureMode(true); $params->setBuyRequest($quoteItem->getBuyRequest()); diff --git a/app/code/Magento/Checkout/Controller/Cart/UpdateItemOptions.php b/app/code/Magento/Checkout/Controller/Cart/UpdateItemOptions.php index f8519d2ee57..d989b47152d 100644 --- a/app/code/Magento/Checkout/Controller/Cart/UpdateItemOptions.php +++ b/app/code/Magento/Checkout/Controller/Cart/UpdateItemOptions.php @@ -39,7 +39,7 @@ class UpdateItemOptions extends \Magento\Checkout\Controller\Cart throw new \Magento\Framework\Exception\LocalizedException(__('We can\'t find the quote item.')); } - $item = $this->cart->updateItem($id, new \Magento\Framework\Object($params)); + $item = $this->cart->updateItem($id, new \Magento\Framework\DataObject($params)); if (is_string($item)) { throw new \Magento\Framework\Exception\LocalizedException(__($item)); } diff --git a/app/code/Magento/Checkout/Controller/Onepage/SaveOrder.php b/app/code/Magento/Checkout/Controller/Onepage/SaveOrder.php index 6ded4bb2323..5b6c8ca719a 100644 --- a/app/code/Magento/Checkout/Controller/Onepage/SaveOrder.php +++ b/app/code/Magento/Checkout/Controller/Onepage/SaveOrder.php @@ -5,7 +5,7 @@ */ namespace Magento\Checkout\Controller\Onepage; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\Exception\PaymentException; /** @@ -31,7 +31,7 @@ class SaveOrder extends \Magento\Checkout\Controller\Onepage return $this->_ajaxRedirectResponse(); } - $result = new Object(); + $result = new DataObject(); try { $agreementsValidator = $this->_objectManager->get('Magento\Checkout\Model\Agreements\AgreementsValidator'); if (!$agreementsValidator->isValid(array_keys($this->getRequest()->getPost('agreement', [])))) { diff --git a/app/code/Magento/Checkout/CustomerData/Cart.php b/app/code/Magento/Checkout/CustomerData/Cart.php index 55fd454db8a..fc37830b2d6 100644 --- a/app/code/Magento/Checkout/CustomerData/Cart.php +++ b/app/code/Magento/Checkout/CustomerData/Cart.php @@ -11,7 +11,7 @@ use Magento\Customer\CustomerData\SectionSourceInterface; /** * Cart source */ -class Cart extends \Magento\Framework\Object implements SectionSourceInterface +class Cart extends \Magento\Framework\DataObject implements SectionSourceInterface { /** * @var \Magento\Customer\Model\Session @@ -154,7 +154,7 @@ class Cart extends \Magento\Framework\Object implements SectionSourceInterface if (!isset($products[$productId])) { continue; } - $urlDataObject = new \Magento\Framework\Object($products[$productId]); + $urlDataObject = new \Magento\Framework\DataObject($products[$productId]); $item->getProduct()->setUrlDataObject($urlDataObject); } $items[] = $this->itemPoolInterface->getItemData($item); diff --git a/app/code/Magento/Checkout/Helper/Data.php b/app/code/Magento/Checkout/Helper/Data.php index 51ac3e2d298..c701962ab29 100644 --- a/app/code/Magento/Checkout/Helper/Data.php +++ b/app/code/Magento/Checkout/Helper/Data.php @@ -140,7 +140,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper /** * Get sales item (quote item, order item etc) price including tax based on row total and tax amount * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return float */ public function getPriceInclTax($item) @@ -157,7 +157,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper /** * Get sales item (quote item, order item etc) row total price including tax * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return float */ public function getSubtotalInclTax($item) @@ -360,7 +360,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper ); if ($guestCheckout == true) { - $result = new \Magento\Framework\Object(); + $result = new \Magento\Framework\DataObject(); $result->setIsAllowed($guestCheckout); $this->_eventManager->dispatch( 'checkout_allow_guest', diff --git a/app/code/Magento/Checkout/Model/Cart.php b/app/code/Magento/Checkout/Model/Cart.php index e0d633415a1..3e20a3e4bf1 100644 --- a/app/code/Magento/Checkout/Model/Cart.php +++ b/app/code/Magento/Checkout/Model/Cart.php @@ -9,13 +9,13 @@ use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Catalog\Model\Product; use Magento\Checkout\Model\Cart\CartInterface; use Magento\Framework\Exception\NoSuchEntityException; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Shopping cart model * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Cart extends Object implements CartInterface +class Cart extends DataObject implements CartInterface { /** * Shopping cart items summary quantity(s) @@ -256,7 +256,7 @@ class Cart extends Object implements CartInterface return $this; } $info = $orderItem->getProductOptionByCode('info_buyRequest'); - $info = new \Magento\Framework\Object($info); + $info = new \Magento\Framework\DataObject($info); if ($qtyFlag === null) { $info->setQty($orderItem->getQtyOrdered()); } else { @@ -303,17 +303,17 @@ class Cart extends Object implements CartInterface /** * Get request for product add to cart procedure * - * @param \Magento\Framework\Object|int|array $requestInfo - * @return \Magento\Framework\Object + * @param \Magento\Framework\DataObject|int|array $requestInfo + * @return \Magento\Framework\DataObject */ protected function _getProductRequest($requestInfo) { - if ($requestInfo instanceof \Magento\Framework\Object) { + if ($requestInfo instanceof \Magento\Framework\DataObject) { $request = $requestInfo; } elseif (is_numeric($requestInfo)) { - $request = new \Magento\Framework\Object(['qty' => $requestInfo]); + $request = new \Magento\Framework\DataObject(['qty' => $requestInfo]); } else { - $request = new \Magento\Framework\Object($requestInfo); + $request = new \Magento\Framework\DataObject($requestInfo); } if (!$request->hasQty()) { @@ -327,7 +327,7 @@ class Cart extends Object implements CartInterface * Add product to shopping cart (quote) * * @param int|Product $productInfo - * @param \Magento\Framework\Object|int|array $requestInfo + * @param \Magento\Framework\DataObject|int|array $requestInfo * @return $this * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) @@ -479,7 +479,7 @@ class Cart extends Object implements CartInterface */ public function updateItems($data) { - $infoDataObject = new \Magento\Framework\Object($data); + $infoDataObject = new \Magento\Framework\DataObject($data); $this->_eventManager->dispatch( 'checkout_cart_update_items_before', ['cart' => $this, 'info' => $infoDataObject] @@ -650,12 +650,12 @@ class Cart extends Object implements CartInterface /** * Update item in shopping cart (quote) - * $requestInfo - either qty (int) or buyRequest in form of array or \Magento\Framework\Object + * $requestInfo - either qty (int) or buyRequest in form of array or \Magento\Framework\DataObject * $updatingParams - information on how to perform update, passed to Quote->updateItem() method * * @param int $itemId - * @param int|array|\Magento\Framework\Object $requestInfo - * @param null|array|\Magento\Framework\Object $updatingParams + * @param int|array|\Magento\Framework\DataObject $requestInfo + * @param null|array|\Magento\Framework\DataObject $updatingParams * @return \Magento\Quote\Model\Quote\Item|string * @throws \Magento\Framework\Exception\LocalizedException * diff --git a/app/code/Magento/Checkout/Model/Cart/CartInterface.php b/app/code/Magento/Checkout/Model/Cart/CartInterface.php index da423892b42..99f2c82f102 100644 --- a/app/code/Magento/Checkout/Model/Cart/CartInterface.php +++ b/app/code/Magento/Checkout/Model/Cart/CartInterface.php @@ -18,7 +18,7 @@ interface CartInterface * Add product to shopping cart (quote) * * @param int|\Magento\Catalog\Model\Product $productInfo - * @param array|float|int|\Magento\Framework\Object|null $requestInfo + * @param array|float|int|\Magento\Framework\DataObject|null $requestInfo * @return $this */ public function addProduct($productInfo, $requestInfo = null); diff --git a/app/code/Magento/Checkout/Model/Type/Onepage.php b/app/code/Magento/Checkout/Model/Type/Onepage.php index 2f7b71dc698..a560dc97e18 100644 --- a/app/code/Magento/Checkout/Model/Type/Onepage.php +++ b/app/code/Magento/Checkout/Model/Type/Onepage.php @@ -107,7 +107,7 @@ class Onepage protected $_orderFactory; /** - * @var \Magento\Framework\Object\Copy + * @var \Magento\Framework\DataObject\Copy */ protected $_objectCopyService; @@ -184,7 +184,7 @@ class Onepage * @param \Magento\Customer\Model\FormFactory $customerFormFactory * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory - * @param \Magento\Framework\Object\Copy $objectCopyService + * @param \Magento\Framework\DataObject\Copy $objectCopyService * @param \Magento\Framework\Message\ManagerInterface $messageManager * @param \Magento\Customer\Model\Metadata\FormFactory $formFactory * @param CustomerDataFactory $customerDataFactory @@ -214,7 +214,7 @@ class Onepage \Magento\Customer\Model\FormFactory $customerFormFactory, \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Sales\Model\OrderFactory $orderFactory, - \Magento\Framework\Object\Copy $objectCopyService, + \Magento\Framework\DataObject\Copy $objectCopyService, \Magento\Framework\Message\ManagerInterface $messageManager, \Magento\Customer\Model\Metadata\FormFactory $formFactory, CustomerDataFactory $customerDataFactory, diff --git a/app/code/Magento/Checkout/Test/Unit/Controller/Cart/ConfigureTest.php b/app/code/Magento/Checkout/Test/Unit/Controller/Cart/ConfigureTest.php index 6d9bcbd3b8f..35fff77a2b4 100644 --- a/app/code/Magento/Checkout/Test/Unit/Controller/Cart/ConfigureTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Controller/Cart/ConfigureTest.php @@ -121,7 +121,7 @@ class ConfigureTest extends \PHPUnit_Framework_TestCase $pageMock = $this->getMockBuilder('Magento\Framework\View\Result\Page') ->disableOriginalConstructor() ->getMock(); - $buyRequestMock = $this->getMockBuilder('Magento\Framework\Object') + $buyRequestMock = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->getMock(); //expects diff --git a/app/code/Magento/Checkout/Test/Unit/CustomerData/CartTest.php b/app/code/Magento/Checkout/Test/Unit/CustomerData/CartTest.php index 2122d5152a0..9af0bbea2da 100644 --- a/app/code/Magento/Checkout/Test/Unit/CustomerData/CartTest.php +++ b/app/code/Magento/Checkout/Test/Unit/CustomerData/CartTest.php @@ -94,7 +94,7 @@ class CartTest extends \PHPUnit_Framework_TestCase $itemData = ['item' => 'data']; $shortcutButtonsHtml = '<span>Buttons</span>'; - $subtotalMock = $this->getMock('\Magento\Framework\Object', ['getValue'], [], '', false); + $subtotalMock = $this->getMock('\Magento\Framework\DataObject', ['getValue'], [], '', false); $subtotalMock->expects($this->once())->method('getValue')->willReturn($subtotalValue); $totals = ['subtotal' => $subtotalMock]; @@ -133,7 +133,7 @@ class CartTest extends \PHPUnit_Framework_TestCase $productMock->expects($this->once())->method('getId')->willReturn($productId); $productMock->expects($this->once()) ->method('setUrlDataObject') - ->with(new \Magento\Framework\Object($productRewrite[$productId])) + ->with(new \Magento\Framework\DataObject($productRewrite[$productId])) ->willReturnSelf(); $this->catalogUrlMock->expects($this->once()) diff --git a/app/code/Magento/Checkout/Test/Unit/Helper/CartTest.php b/app/code/Magento/Checkout/Test/Unit/Helper/CartTest.php index b656c5d4206..14f89b5cb36 100644 --- a/app/code/Magento/Checkout/Test/Unit/Helper/CartTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Helper/CartTest.php @@ -11,7 +11,7 @@ namespace Magento\Checkout\Test\Unit\Helper; use \Magento\Checkout\Helper\Cart; use Magento\Framework\App\Action\Action; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Quote\Model\Quote\Item; class CartTest extends \PHPUnit_Framework_TestCase @@ -161,7 +161,7 @@ class CartTest extends \PHPUnit_Framework_TestCase $productMock->expects($this->any())->method('getEntityId')->will($this->returnValue($productEntityId)); $productMock->expects($this->any())->method('hasUrlDataObject')->will($this->returnValue(true)); $productMock->expects($this->any())->method('getUrlDataObject') - ->will($this->returnValue(new Object(['store_id' => $storeId]))); + ->will($this->returnValue(new DataObject(['store_id' => $storeId]))); $currentUrl = 'http://www.example.com/'; $this->urlBuilderMock->expects($this->any())->method('getCurrentUrl')->will($this->returnValue($currentUrl)); diff --git a/app/code/Magento/Checkout/Test/Unit/Helper/DataTest.php b/app/code/Magento/Checkout/Test/Unit/Helper/DataTest.php index 9ce33f555c7..2e738ea4907 100644 --- a/app/code/Magento/Checkout/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Helper/DataTest.php @@ -140,8 +140,8 @@ class DataTest extends \PHPUnit_Framework_TestCase */ public function testSendPaymentFailedEmail() { - $shippingAddress = new \Magento\Framework\Object(['shipping_method' => 'ground_transportation']); - $billingAddress = new \Magento\Framework\Object(['street' => 'Fixture St']); + $shippingAddress = new \Magento\Framework\DataObject(['shipping_method' => 'ground_transportation']); + $billingAddress = new \Magento\Framework\DataObject(['street' => 'Fixture St']); $this->_transportBuilder->expects( $this->once() @@ -229,7 +229,7 @@ class DataTest extends \PHPUnit_Framework_TestCase $productTwo->expects($this->once())->method('getName')->will($this->returnValue('Product Two')); $productTwo->expects($this->once())->method('getFinalPrice')->with(3)->will($this->returnValue(60)); - $quote = new \Magento\Framework\Object( + $quote = new \Magento\Framework\DataObject( [ 'store_id' => 8, 'store_currency_code' => 'USD', @@ -239,10 +239,10 @@ class DataTest extends \PHPUnit_Framework_TestCase 'customer_email' => 'john.doe@example.com', 'billing_address' => $billingAddress, 'shipping_address' => $shippingAddress, - 'payment' => new \Magento\Framework\Object(['method' => 'fixture-payment-method']), + 'payment' => new \Magento\Framework\DataObject(['method' => 'fixture-payment-method']), 'all_visible_items' => [ - new \Magento\Framework\Object(['product' => $productOne, 'qty' => 2]), - new \Magento\Framework\Object(['product' => $productTwo, 'qty' => 3]) + new \Magento\Framework\DataObject(['product' => $productOne, 'qty' => 2]), + new \Magento\Framework\DataObject(['product' => $productTwo, 'qty' => 3]) ] ] ); @@ -324,7 +324,7 @@ class DataTest extends \PHPUnit_Framework_TestCase public function testGetPriceInclTax() { - $itemMock = $this->getMock('Magento\Framework\Object', ['getPriceInclTax'], [], '', false); + $itemMock = $this->getMock('Magento\Framework\DataObject', ['getPriceInclTax'], [], '', false); $itemMock->expects($this->exactly(2))->method('getPriceInclTax')->will($this->returnValue(5.5)); $this->assertEquals(5.5, $this->_helper->getPriceInclTax($itemMock)); } @@ -347,7 +347,7 @@ class DataTest extends \PHPUnit_Framework_TestCase ] ); $itemMock = $this->getMock( - 'Magento\Framework\Object', + 'Magento\Framework\DataObject', ['getPriceInclTax', 'getQty', 'getTaxAmount', 'getDiscountTaxCompensation', 'getRowTotal'], [], '', @@ -368,7 +368,7 @@ class DataTest extends \PHPUnit_Framework_TestCase { $rowTotalInclTax = 5.5; $expected = 5.5; - $itemMock = $this->getMock('Magento\Framework\Object', ['getRowTotalInclTax'], [], '', false); + $itemMock = $this->getMock('Magento\Framework\DataObject', ['getRowTotalInclTax'], [], '', false); $itemMock->expects($this->exactly(2))->method('getRowTotalInclTax')->will($this->returnValue($rowTotalInclTax)); $this->assertEquals($expected, $this->_helper->getSubtotalInclTax($itemMock)); } @@ -380,7 +380,7 @@ class DataTest extends \PHPUnit_Framework_TestCase $rowTotal = 15; $expected = 17; $itemMock = $this->getMock( - 'Magento\Framework\Object', + 'Magento\Framework\DataObject', ['getRowTotalInclTax', 'getTaxAmount', 'getDiscountTaxCompensation', 'getRowTotal'], [], '', @@ -405,7 +405,7 @@ class DataTest extends \PHPUnit_Framework_TestCase 'priceCurrency' => $this->priceCurrency, ] ); - $itemMock = $this->getMock('Magento\Framework\Object', ['getQty'], [], '', false); + $itemMock = $this->getMock('Magento\Framework\DataObject', ['getQty'], [], '', false); $itemMock->expects($this->once())->method('getQty'); $this->priceCurrency->expects($this->once())->method('round'); $helper->getPriceInclTax($itemMock); @@ -422,7 +422,7 @@ class DataTest extends \PHPUnit_Framework_TestCase 'priceCurrency' => $this->priceCurrency, ] ); - $itemMock = $this->getMock('Magento\Framework\Object', ['getQty', 'getQtyOrdered'], [], '', false); + $itemMock = $this->getMock('Magento\Framework\DataObject', ['getQty', 'getQtyOrdered'], [], '', false); $itemMock->expects($this->once())->method('getQty')->will($this->returnValue(false)); $itemMock->expects($this->exactly(2))->method('getQtyOrdered')->will($this->returnValue(5.5)); $this->priceCurrency->expects($this->once())->method('round'); @@ -432,7 +432,7 @@ class DataTest extends \PHPUnit_Framework_TestCase public function testGetBaseSubtotalInclTax() { $itemMock = $this->getMock( - 'Magento\Framework\Object', + 'Magento\Framework\DataObject', ['getBaseTaxAmount', 'getBaseDiscountTaxCompensation', 'getBaseRowTotal'], [], '', diff --git a/app/code/Magento/Checkout/Test/Unit/Model/CartTest.php b/app/code/Magento/Checkout/Test/Unit/Model/CartTest.php index 6b84f1fad4f..eb43103ee34 100644 --- a/app/code/Magento/Checkout/Test/Unit/Model/CartTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Model/CartTest.php @@ -140,7 +140,7 @@ class CartTest extends \PHPUnit_Framework_TestCase public function testUpdateItems() { $data = [['qty' => 5.5, 'before_suggest_qty' => 5.5]]; - $infoDataObject = $this->objectManagerHelper->getObject('Magento\Framework\Object', ['data' => $data]); + $infoDataObject = $this->objectManagerHelper->getObject('Magento\Framework\DataObject', ['data' => $data]); $this->checkoutSessionMock->expects($this->once()) ->method('getQuote') diff --git a/app/code/Magento/Checkout/Test/Unit/Model/ObserverTest.php b/app/code/Magento/Checkout/Test/Unit/Model/ObserverTest.php index 2c3e0946318..b35cf3685a1 100644 --- a/app/code/Magento/Checkout/Test/Unit/Model/ObserverTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Model/ObserverTest.php @@ -68,8 +68,8 @@ class ObserverTest extends \PHPUnit_Framework_TestCase { $observer = $this->getMock('Magento\Framework\Event\Observer', [], [], '', false); $observer->expects($this->once())->method('getEvent')->will( - $this->returnValue(new \Magento\Framework\Object( - ['quote' => new \Magento\Framework\Object(['is_checkout_cart' => 1, 'id' => 7])] + $this->returnValue(new \Magento\Framework\DataObject( + ['quote' => new \Magento\Framework\DataObject(['is_checkout_cart' => 1, 'id' => 7])] )) ); $this->checkoutSession->expects($this->once())->method('getQuoteId')->with(7); diff --git a/app/code/Magento/Checkout/Test/Unit/Model/Type/OnepageTest.php b/app/code/Magento/Checkout/Test/Unit/Model/Type/OnepageTest.php index e4fa8c65d6f..52d80ff6c34 100644 --- a/app/code/Magento/Checkout/Test/Unit/Model/Type/OnepageTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Model/Type/OnepageTest.php @@ -63,7 +63,7 @@ class OnepageTest extends \PHPUnit_Framework_TestCase /** @var \PHPUnit_Framework_MockObject_MockObject */ protected $orderFactoryMock; - /** @var \Magento\Framework\Object\Copy|\PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Framework\DataObject\Copy|\PHPUnit_Framework_MockObject_MockObject */ protected $copyMock; /** @var \Magento\Framework\Message\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ @@ -141,7 +141,7 @@ class OnepageTest extends \PHPUnit_Framework_TestCase $this->customerFactoryMock = $this->getMock('Magento\Customer\Model\CustomerFactory', [], [], '', false); $this->quoteManagementMock = $this->getMock('Magento\Quote\Model\QuoteManagement', [], [], '', false); $this->orderFactoryMock = $this->getMock('Magento\Sales\Model\OrderFactory', ['create'], [], '', false); - $this->copyMock = $this->getMock('Magento\Framework\Object\Copy', [], [], '', false); + $this->copyMock = $this->getMock('Magento\Framework\DataObject\Copy', [], [], '', false); $this->messageManagerMock = $this->getMock('Magento\Framework\Message\ManagerInterface'); $this->customerFormFactoryMock = $this->getMock( diff --git a/app/code/Magento/Checkout/etc/fieldset.xml b/app/code/Magento/Checkout/etc/fieldset.xml index 9f1cb520029..cf8aed6d65e 100644 --- a/app/code/Magento/Checkout/etc/fieldset.xml +++ b/app/code/Magento/Checkout/etc/fieldset.xml @@ -6,7 +6,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Object/etc/fieldset.xsd"> + xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/DataObject/etc/fieldset.xsd"> <scope id="global"> <fieldset id="customer_account"> <field name="prefix"> diff --git a/app/code/Magento/CheckoutAgreements/Block/Adminhtml/Agreement/Grid.php b/app/code/Magento/CheckoutAgreements/Block/Adminhtml/Agreement/Grid.php index ccf00e4ef61..14ea98fd008 100644 --- a/app/code/Magento/CheckoutAgreements/Block/Adminhtml/Agreement/Grid.php +++ b/app/code/Magento/CheckoutAgreements/Block/Adminhtml/Agreement/Grid.php @@ -131,7 +131,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended } /** - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ public function getRowUrl($row) diff --git a/app/code/Magento/CheckoutAgreements/Controller/Adminhtml/Agreement/Save.php b/app/code/Magento/CheckoutAgreements/Controller/Adminhtml/Agreement/Save.php index 760a465693f..ffdfd74395d 100644 --- a/app/code/Magento/CheckoutAgreements/Controller/Adminhtml/Agreement/Save.php +++ b/app/code/Magento/CheckoutAgreements/Controller/Adminhtml/Agreement/Save.php @@ -19,7 +19,7 @@ class Save extends \Magento\CheckoutAgreements\Controller\Adminhtml\Agreement $model->setData($postData); try { - $validationResult = $model->validateData(new \Magento\Framework\Object($postData)); + $validationResult = $model->validateData(new \Magento\Framework\DataObject($postData)); if ($validationResult !== true) { foreach ($validationResult as $message) { $this->messageManager->addError($message); diff --git a/app/code/Magento/CheckoutAgreements/Model/Agreement.php b/app/code/Magento/CheckoutAgreements/Model/Agreement.php index b29030f8124..74d2fef6b58 100644 --- a/app/code/Magento/CheckoutAgreements/Model/Agreement.php +++ b/app/code/Magento/CheckoutAgreements/Model/Agreement.php @@ -25,7 +25,7 @@ class Agreement extends \Magento\Framework\Model\AbstractExtensibleModel impleme } /** - * @param \Magento\Framework\Object $agreementData + * @param \Magento\Framework\DataObject $agreementData * @return array|bool */ public function validateData($agreementData) diff --git a/app/code/Magento/CheckoutAgreements/Test/Unit/Model/AgreementTest.php b/app/code/Magento/CheckoutAgreements/Test/Unit/Model/AgreementTest.php index 2adc8d41e40..6eedabbe0c7 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Unit/Model/AgreementTest.php +++ b/app/code/Magento/CheckoutAgreements/Test/Unit/Model/AgreementTest.php @@ -22,7 +22,7 @@ class AgreementTest extends \PHPUnit_Framework_TestCase * @covers \Magento\CheckoutAgreements\Model\Agreement::validateData * * @dataProvider validateDataDataProvider - * @param \Magento\Framework\Object $inputData + * @param \Magento\Framework\DataObject $inputData * @param array|bool $expectedResult */ public function testValidateData($inputData, $expectedResult) @@ -37,33 +37,33 @@ class AgreementTest extends \PHPUnit_Framework_TestCase { return [ [ - 'inputData' => (new \Magento\Framework\Object())->setContentHeight('1px'), + 'inputData' => (new \Magento\Framework\DataObject())->setContentHeight('1px'), 'expectedResult' => true, ], [ - 'inputData' => (new \Magento\Framework\Object())->setContentHeight('1.1px'), + 'inputData' => (new \Magento\Framework\DataObject())->setContentHeight('1.1px'), 'expectedResult' => true ], [ - 'inputData' => (new \Magento\Framework\Object())->setContentHeight('0.1in'), + 'inputData' => (new \Magento\Framework\DataObject())->setContentHeight('0.1in'), 'expectedResult' => true ], [ - 'inputData' => (new \Magento\Framework\Object())->setContentHeight('5%'), + 'inputData' => (new \Magento\Framework\DataObject())->setContentHeight('5%'), 'expectedResult' => true ], [ - 'inputData' => (new \Magento\Framework\Object())->setContentHeight('5'), + 'inputData' => (new \Magento\Framework\DataObject())->setContentHeight('5'), 'expectedResult' => true ], [ - 'inputData' => (new \Magento\Framework\Object())->setContentHeight('px'), + 'inputData' => (new \Magento\Framework\DataObject())->setContentHeight('px'), 'expectedResult' => [ "Please input a valid CSS-height. For example 100px or 77pt or 20em or .5ex or 50%.", ] ], [ - 'inputData' => (new \Magento\Framework\Object())->setContentHeight('abracadabra'), + 'inputData' => (new \Magento\Framework\DataObject())->setContentHeight('abracadabra'), 'expectedResult' => [ "Please input a valid CSS-height. For example 100px or 77pt or 20em or .5ex or 50%.", ] diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page/Grid.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Grid.php index af9f8d533c2..4986f395d2a 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Page/Grid.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Grid.php @@ -174,11 +174,11 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended * Filter store condition * * @param \Magento\Framework\Data\Collection $collection - * @param \Magento\Framework\Object $column + * @param \Magento\Framework\DataObject $column * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - protected function _filterStoreCondition($collection, \Magento\Framework\Object $column) + protected function _filterStoreCondition($collection, \Magento\Framework\DataObject $column) { if (!($value = $column->getFilter()->getValue())) { return; @@ -190,7 +190,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended /** * Row click url * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ public function getRowUrl($row) diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page/Grid/Renderer/Action.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Grid/Renderer/Action.php index dcb9dae0637..5518615e538 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Page/Grid/Renderer/Action.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Grid/Renderer/Action.php @@ -29,10 +29,10 @@ class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstract /** * Render action * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $href = $this->actionUrlBuilder->getUrl( $row->getIdentifier(), diff --git a/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content.php b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content.php index ed93f309265..22fc1a4b96c 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content.php @@ -91,7 +91,7 @@ class Content extends \Magento\Backend\Block\Widget\Container */ public function getFilebrowserSetupObject() { - $setupObject = new \Magento\Framework\Object(); + $setupObject = new \Magento\Framework\DataObject(); $setupObject->setData( [ diff --git a/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content/Files.php b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content/Files.php index 5a661e40786..041bf363160 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content/Files.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content/Files.php @@ -76,10 +76,10 @@ class Files extends \Magento\Backend\Block\Template /** * File idetifier getter * - * @param \Magento\Framework\Object $file + * @param \Magento\Framework\DataObject $file * @return string */ - public function getFileId(\Magento\Framework\Object $file) + public function getFileId(\Magento\Framework\DataObject $file) { return $file->getId(); } @@ -87,10 +87,10 @@ class Files extends \Magento\Backend\Block\Template /** * File thumb URL getter * - * @param \Magento\Framework\Object $file + * @param \Magento\Framework\DataObject $file * @return string */ - public function getFileThumbUrl(\Magento\Framework\Object $file) + public function getFileThumbUrl(\Magento\Framework\DataObject $file) { return $file->getThumbUrl(); } @@ -98,10 +98,10 @@ class Files extends \Magento\Backend\Block\Template /** * File name URL getter * - * @param \Magento\Framework\Object $file + * @param \Magento\Framework\DataObject $file * @return string */ - public function getFileName(\Magento\Framework\Object $file) + public function getFileName(\Magento\Framework\DataObject $file) { return $file->getName(); } @@ -109,10 +109,10 @@ class Files extends \Magento\Backend\Block\Template /** * Image file width getter * - * @param \Magento\Framework\Object $file + * @param \Magento\Framework\DataObject $file * @return string */ - public function getFileWidth(\Magento\Framework\Object $file) + public function getFileWidth(\Magento\Framework\DataObject $file) { return $file->getWidth(); } @@ -120,10 +120,10 @@ class Files extends \Magento\Backend\Block\Template /** * Image file height getter * - * @param \Magento\Framework\Object $file + * @param \Magento\Framework\DataObject $file * @return string */ - public function getFileHeight(\Magento\Framework\Object $file) + public function getFileHeight(\Magento\Framework\DataObject $file) { return $file->getHeight(); } @@ -131,10 +131,10 @@ class Files extends \Magento\Backend\Block\Template /** * File short name getter * - * @param \Magento\Framework\Object $file + * @param \Magento\Framework\DataObject $file * @return string */ - public function getFileShortName(\Magento\Framework\Object $file) + public function getFileShortName(\Magento\Framework\DataObject $file) { return $file->getShortName(); } diff --git a/app/code/Magento/Cms/Block/Block.php b/app/code/Magento/Cms/Block/Block.php index de7dbc8a54a..20d5071369c 100644 --- a/app/code/Magento/Cms/Block/Block.php +++ b/app/code/Magento/Cms/Block/Block.php @@ -11,7 +11,7 @@ namespace Magento\Cms\Block; /** * Cms block content block */ -class Block extends \Magento\Framework\View\Element\AbstractBlock implements \Magento\Framework\Object\IdentityInterface +class Block extends \Magento\Framework\View\Element\AbstractBlock implements \Magento\Framework\DataObject\IdentityInterface { /** * @var \Magento\Cms\Model\Template\FilterProvider diff --git a/app/code/Magento/Cms/Block/Page.php b/app/code/Magento/Cms/Block/Page.php index 211cac3afec..89d251a0dec 100644 --- a/app/code/Magento/Cms/Block/Page.php +++ b/app/code/Magento/Cms/Block/Page.php @@ -11,7 +11,7 @@ use Magento\Store\Model\ScopeInterface; * Cms page content block */ class Page extends \Magento\Framework\View\Element\AbstractBlock implements - \Magento\Framework\Object\IdentityInterface + \Magento\Framework\DataObject\IdentityInterface { /** * @var \Magento\Cms\Model\Template\FilterProvider diff --git a/app/code/Magento/Cms/Controller/Router.php b/app/code/Magento/Cms/Controller/Router.php index 669434a6342..fa0089d73fc 100644 --- a/app/code/Magento/Cms/Controller/Router.php +++ b/app/code/Magento/Cms/Controller/Router.php @@ -93,7 +93,7 @@ class Router implements \Magento\Framework\App\RouterInterface { $identifier = trim($request->getPathInfo(), '/'); - $condition = new \Magento\Framework\Object(['identifier' => $identifier, 'continue' => true]); + $condition = new \Magento\Framework\DataObject(['identifier' => $identifier, 'continue' => true]); $this->_eventManager->dispatch( 'cms_controller_router_match_before', ['router' => $this, 'condition' => $condition] diff --git a/app/code/Magento/Cms/Model/Block.php b/app/code/Magento/Cms/Model/Block.php index 8fd71257082..e8605a682cd 100644 --- a/app/code/Magento/Cms/Model/Block.php +++ b/app/code/Magento/Cms/Model/Block.php @@ -6,7 +6,7 @@ namespace Magento\Cms\Model; use Magento\Cms\Api\Data\BlockInterface; -use Magento\Framework\Object\IdentityInterface; +use Magento\Framework\DataObject\IdentityInterface; /** * CMS block model diff --git a/app/code/Magento/Cms/Model/Page.php b/app/code/Magento/Cms/Model/Page.php index fca4ecc84aa..cd850308243 100644 --- a/app/code/Magento/Cms/Model/Page.php +++ b/app/code/Magento/Cms/Model/Page.php @@ -6,7 +6,7 @@ namespace Magento\Cms\Model; use Magento\Cms\Api\Data\PageInterface; -use Magento\Framework\Object\IdentityInterface; +use Magento\Framework\DataObject\IdentityInterface; /** * Cms Page Model diff --git a/app/code/Magento/Cms/Model/Wysiwyg/Config.php b/app/code/Magento/Cms/Model/Wysiwyg/Config.php index e5c6a0e761c..6f93c85c769 100644 --- a/app/code/Magento/Cms/Model/Wysiwyg/Config.php +++ b/app/code/Magento/Cms/Model/Wysiwyg/Config.php @@ -8,7 +8,7 @@ namespace Magento\Cms\Model\Wysiwyg; /** * Wysiwyg Config for Editor HTML Element */ -class Config extends \Magento\Framework\Object +class Config extends \Magento\Framework\DataObject { /** * Wysiwyg status enabled @@ -127,7 +127,7 @@ class Config extends \Magento\Framework\Object } /** - * Return Wysiwyg config as \Magento\Framework\Object + * Return Wysiwyg config as \Magento\Framework\DataObject * * Config options description: * @@ -139,12 +139,12 @@ class Config extends \Magento\Framework\Object * files_browser_*: Files Browser (media, images) settings * encode_directives: Encode template directives with JS or not * - * @param array|\Magento\Framework\Object $data Object constructor params to override default config values - * @return \Magento\Framework\Object + * @param array|\Magento\Framework\DataObject $data Object constructor params to override default config values + * @return \Magento\Framework\DataObject */ public function getConfig($data = []) { - $config = new \Magento\Framework\Object(); + $config = new \Magento\Framework\DataObject(); $config->setData( [ diff --git a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php index b884e625c1a..d4122559739 100644 --- a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php +++ b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php @@ -15,7 +15,7 @@ use Magento\Framework\App\Filesystem\DirectoryList; * @SuppressWarnings(PHPMD.TooManyFields) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Storage extends \Magento\Framework\Object +class Storage extends \Magento\Framework\DataObject { const DIRECTORY_NAME_REGEXP = '/^[a-z0-9\-\_]+$/si'; diff --git a/app/code/Magento/Cms/Test/Unit/Block/Adminhtml/Block/Edit/FormTest.php b/app/code/Magento/Cms/Test/Unit/Block/Adminhtml/Block/Edit/FormTest.php index d671e0b864f..e9363034260 100644 --- a/app/code/Magento/Cms/Test/Unit/Block/Adminhtml/Block/Edit/FormTest.php +++ b/app/code/Magento/Cms/Test/Unit/Block/Adminhtml/Block/Edit/FormTest.php @@ -171,7 +171,7 @@ class FormTest extends \PHPUnit_Framework_TestCase ->willReturn($this->storeValues); $this->field = $this->getMock('Magento\Framework\Data\Form\Element\AbstractElement', [], [], '', false); - $this->config = $this->getMock('Magento\Framework\Object', [], [], '', false); + $this->config = $this->getMock('Magento\Framework\DataObject', [], [], '', false); $this->store = $this->getMock('Magento\Store\Model\Store', [], [], '', false); $this->storeManager = $this->getMock('Magento\Store\Model\StoreManagerInterface', [], [], '', false); $this->fieldSet = $this->getMock('Magento\Framework\Data\Form\Element\Fieldset', [], [], '', false); diff --git a/app/code/Magento/Cms/Test/Unit/Model/ObserverTest.php b/app/code/Magento/Cms/Test/Unit/Model/ObserverTest.php index f18bd6c6d5d..650110b16b8 100644 --- a/app/code/Magento/Cms/Test/Unit/Model/ObserverTest.php +++ b/app/code/Magento/Cms/Test/Unit/Model/ObserverTest.php @@ -36,7 +36,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase protected $eventMock; /** - * @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject */ protected $objectMock; @@ -65,7 +65,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); $this->objectMock = $this - ->getMockBuilder('Magento\Framework\Object') + ->getMockBuilder('Magento\Framework\DataObject') ->setMethods( [ 'setLoaded', diff --git a/app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/ConfigTest.php b/app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/ConfigTest.php index f939b8dc600..ced7ca8e640 100644 --- a/app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/ConfigTest.php +++ b/app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/ConfigTest.php @@ -157,7 +157,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ->willReturn($pluginSettings); $config = $this->wysiwygConfig->getConfig($data); - $this->assertInstanceOf('Magento\Framework\Object', $config); + $this->assertInstanceOf('Magento\Framework\DataObject', $config); $this->assertEquals($expectedResults[0], $config->getData('someData')); $this->assertEquals($expectedResults[1], $config->getData('wysiwygPluginSettings')); $this->assertEquals($expectedResults[2], $config->getData('pluginSettings')); diff --git a/app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/Images/StorageTest.php b/app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/Images/StorageTest.php index f2a23dc16b8..3942471e76b 100644 --- a/app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/Images/StorageTest.php +++ b/app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/Images/StorageTest.php @@ -351,8 +351,8 @@ class StorageTest extends \PHPUnit_Framework_TestCase $collection = []; foreach ($fileNames as $filename) { - /** @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject $objectMock */ - $objectMock = $this->getMock('Magento\Framework\Object', ['getFilename'], [], '', false); + /** @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject $objectMock */ + $objectMock = $this->getMock('Magento\Framework\DataObject', ['getFilename'], [], '', false); $objectMock->expects($this->any()) ->method('getFilename') ->willReturn(self::STORAGE_ROOT_DIR . $filename); diff --git a/app/code/Magento/Config/Block/System/Config/Form/Field/FieldArray/AbstractFieldArray.php b/app/code/Magento/Config/Block/System/Config/Form/Field/FieldArray/AbstractFieldArray.php index bf4b9348c8d..ee2203fd297 100644 --- a/app/code/Magento/Config/Block/System/Config/Form/Field/FieldArray/AbstractFieldArray.php +++ b/app/code/Magento/Config/Block/System/Config/Form/Field/FieldArray/AbstractFieldArray.php @@ -120,11 +120,11 @@ abstract class AbstractFieldArray extends \Magento\Config\Block\System\Config\Fo /** * Prepare existing row data object * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - protected function _prepareArrayRow(\Magento\Framework\Object $row) + protected function _prepareArrayRow(\Magento\Framework\DataObject $row) { // override in descendants } @@ -132,7 +132,7 @@ abstract class AbstractFieldArray extends \Magento\Config\Block\System\Config\Fo /** * Obtain existing data from form element * - * Each row will be instance of \Magento\Framework\Object + * Each row will be instance of \Magento\Framework\DataObject * * @return array */ @@ -153,7 +153,7 @@ abstract class AbstractFieldArray extends \Magento\Config\Block\System\Config\Fo } $row['_id'] = $rowId; $row['column_values'] = $rowColumnValues; - $result[$rowId] = new \Magento\Framework\Object($row); + $result[$rowId] = new \Magento\Framework\DataObject($row); $this->_prepareArrayRow($result[$rowId]); } } diff --git a/app/code/Magento/Config/Block/System/Config/Form/Fieldset/Modules/DisableOutput.php b/app/code/Magento/Config/Block/System/Config/Form/Fieldset/Modules/DisableOutput.php index b592be2e40c..706e1b9ca71 100644 --- a/app/code/Magento/Config/Block/System/Config/Form/Fieldset/Modules/DisableOutput.php +++ b/app/code/Magento/Config/Block/System/Config/Form/Fieldset/Modules/DisableOutput.php @@ -12,7 +12,7 @@ namespace Magento\Config\Block\System\Config\Form\Fieldset\Modules; class DisableOutput extends \Magento\Config\Block\System\Config\Form\Fieldset { /** - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $_dummyElement; @@ -59,7 +59,7 @@ class DisableOutput extends \Magento\Config\Block\System\Config\Form\Fieldset $modules = $this->_moduleList->getNames(); - $dispatchResult = new \Magento\Framework\Object($modules); + $dispatchResult = new \Magento\Framework\DataObject($modules); $this->_eventManager->dispatch( 'adminhtml_system_config_advanced_disableoutput_render_before', ['modules' => $dispatchResult] @@ -80,12 +80,12 @@ class DisableOutput extends \Magento\Config\Block\System\Config\Form\Fieldset } /** - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function _getDummyElement() { if (empty($this->_dummyElement)) { - $this->_dummyElement = new \Magento\Framework\Object(['showInDefault' => 1, 'showInWebsite' => 1]); + $this->_dummyElement = new \Magento\Framework\DataObject(['showInDefault' => 1, 'showInWebsite' => 1]); } return $this->_dummyElement; } diff --git a/app/code/Magento/Config/Controller/Adminhtml/System/Config/Save.php b/app/code/Magento/Config/Controller/Adminhtml/System/Config/Save.php index 75b8eb4fd26..d18c4ffc4bc 100644 --- a/app/code/Magento/Config/Controller/Adminhtml/System/Config/Save.php +++ b/app/code/Magento/Config/Controller/Adminhtml/System/Config/Save.php @@ -28,7 +28,7 @@ class Save extends AbstractConfig protected $_cache; /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -38,7 +38,7 @@ class Save extends AbstractConfig * @param \Magento\Config\Controller\Adminhtml\System\ConfigSectionChecker $sectionChecker * @param \Magento\Config\Model\Config\Factory $configFactory * @param \Magento\Framework\Cache\FrontendInterface $cache - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string */ public function __construct( \Magento\Backend\App\Action\Context $context, @@ -46,7 +46,7 @@ class Save extends AbstractConfig \Magento\Config\Controller\Adminhtml\System\ConfigSectionChecker $sectionChecker, \Magento\Config\Model\Config\Factory $configFactory, \Magento\Framework\Cache\FrontendInterface $cache, - \Magento\Framework\Stdlib\String $string + \Magento\Framework\Stdlib\StringUtils $string ) { parent::__construct($context, $configStructure, $sectionChecker); $this->_configFactory = $configFactory; diff --git a/app/code/Magento/Config/Model/Config.php b/app/code/Magento/Config/Model/Config.php index a23f0c1d437..22a06b40f3b 100644 --- a/app/code/Magento/Config/Model/Config.php +++ b/app/code/Magento/Config/Model/Config.php @@ -12,7 +12,7 @@ namespace Magento\Config\Model; * @author Magento Core Team <core@magentocommerce.com> * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Config extends \Magento\Framework\Object +class Config extends \Magento\Framework\DataObject { /** * Config data for sections diff --git a/app/code/Magento/Config/Model/Config/Compiler/IncludeElement.php b/app/code/Magento/Config/Model/Config/Compiler/IncludeElement.php index bfbad7dfaac..22843a83326 100644 --- a/app/code/Magento/Config/Model/Config/Compiler/IncludeElement.php +++ b/app/code/Magento/Config/Model/Config/Compiler/IncludeElement.php @@ -5,7 +5,7 @@ */ namespace Magento\Config\Model\Config\Compiler; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\Filesystem; use Magento\Framework\Module\Dir\Reader; use Magento\Framework\Exception\LocalizedException; @@ -47,12 +47,16 @@ class IncludeElement implements ElementInterface * * @param CompilerInterface $compiler * @param \DOMElement $node - * @param Object $processedObject - * @param Object $context + * @param DataObject $processedObject + * @param DataObject $context * @return void */ - public function compile(CompilerInterface $compiler, \DOMElement $node, Object $processedObject, Object $context) - { + public function compile( + CompilerInterface $compiler, + \DOMElement $node, + DataObject $processedObject, + DataObject $context + ) { $ownerDocument = $node->ownerDocument; $parentNode = $node->parentNode; diff --git a/app/code/Magento/Config/Model/Config/Source/Email/Template.php b/app/code/Magento/Config/Model/Config/Source/Email/Template.php index b1f95b3b60d..4a4107cdc11 100644 --- a/app/code/Magento/Config/Model/Config/Source/Email/Template.php +++ b/app/code/Magento/Config/Model/Config/Source/Email/Template.php @@ -5,7 +5,7 @@ */ namespace Magento\Config\Model\Config\Source\Email; -class Template extends \Magento\Framework\Object implements \Magento\Framework\Option\ArrayInterface +class Template extends \Magento\Framework\DataObject implements \Magento\Framework\Option\ArrayInterface { /** * @var \Magento\Framework\Registry diff --git a/app/code/Magento/Config/Model/Config/Structure/Element/Field.php b/app/code/Magento/Config/Model/Config/Structure/Element/Field.php index f64292f9db8..5d7d5d1e329 100644 --- a/app/code/Magento/Config/Model/Config/Structure/Element/Field.php +++ b/app/code/Magento/Config/Model/Config/Structure/Element/Field.php @@ -421,7 +421,7 @@ class Field extends \Magento\Config\Model\Config\Structure\AbstractElement } $sourceModel = $this->_sourceFactory->create($sourceModel); - if ($sourceModel instanceof \Magento\Framework\Object) { + if ($sourceModel instanceof \Magento\Framework\DataObject) { $sourceModel->setPath($this->getPath()); } if ($method) { diff --git a/app/code/Magento/Config/Model/Config/Structure/Reader.php b/app/code/Magento/Config/Model/Config/Structure/Reader.php index 06af36609cd..45c04eeb4f0 100644 --- a/app/code/Magento/Config/Model/Config/Structure/Reader.php +++ b/app/code/Magento/Config/Model/Config/Structure/Reader.php @@ -8,7 +8,7 @@ */ namespace Magento\Config\Model\Config\Structure; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\View\TemplateEngine\Xhtml\CompilerInterface; @@ -126,7 +126,7 @@ class Reader extends \Magento\Framework\Config\Reader\Filesystem */ protected function processingDocument($content) { - $object = new Object(); + $object = new DataObject(); $document = new \DOMDocument(); $document->loadXML($content); diff --git a/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/FieldArray/AbstractTest.php b/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/FieldArray/AbstractTest.php index 3f254baee2d..b8ce158cdcb 100644 --- a/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/FieldArray/AbstractTest.php +++ b/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/FieldArray/AbstractTest.php @@ -27,7 +27,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $block->setElement($element); $this->assertEquals( [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'test' => 'test', 'data1' => 'data1', diff --git a/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/FileTest.php b/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/FileTest.php index f6d51f1ec49..33588695e62 100644 --- a/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/FileTest.php +++ b/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/FileTest.php @@ -43,7 +43,7 @@ class FileTest extends \PHPUnit_Framework_TestCase ['data' => $this->testData] ); - $formMock = new \Magento\Framework\Object(); + $formMock = new \Magento\Framework\DataObject(); $formMock->setHtmlIdPrefix($this->testData['html_id_prefix']); $formMock->setHtmlIdSuffix($this->testData['html_id_suffix']); $this->file->setForm($formMock); diff --git a/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/ImageTest.php b/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/ImageTest.php index 0d17790ad56..f6364e9aca2 100644 --- a/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/ImageTest.php +++ b/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/ImageTest.php @@ -47,7 +47,7 @@ class ImageTest extends \PHPUnit_Framework_TestCase 'value' => 'test_value', ]; - $formMock = new \Magento\Framework\Object(); + $formMock = new \Magento\Framework\DataObject(); $formMock->setHtmlIdPrefix($this->testData['html_id_prefix']); $formMock->setHtmlIdSuffix($this->testData['html_id_suffix']); $this->image->setForm($formMock); diff --git a/app/code/Magento/Config/Test/Unit/Controller/Adminhtml/System/Config/SaveTest.php b/app/code/Magento/Config/Test/Unit/Controller/Adminhtml/System/Config/SaveTest.php index 23d788e710f..eb5d66c4a62 100644 --- a/app/code/Magento/Config/Test/Unit/Controller/Adminhtml/System/Config/SaveTest.php +++ b/app/code/Magento/Config/Test/Unit/Controller/Adminhtml/System/Config/SaveTest.php @@ -172,7 +172,7 @@ class SaveTest extends \PHPUnit_Framework_TestCase $this->_sectionCheckerMock, $this->_configFactoryMock, $this->_cacheMock, - new \Magento\Framework\Stdlib\String(), + new \Magento\Framework\Stdlib\StringUtils(), ] ); } diff --git a/app/code/Magento/Config/Test/Unit/Model/Compiler/IncludeElementTest.php b/app/code/Magento/Config/Test/Unit/Model/Compiler/IncludeElementTest.php index f00651dd2b9..b9247bb304a 100644 --- a/app/code/Magento/Config/Test/Unit/Model/Compiler/IncludeElementTest.php +++ b/app/code/Magento/Config/Test/Unit/Model/Compiler/IncludeElementTest.php @@ -59,7 +59,7 @@ class IncludeElementTest extends \PHPUnit_Framework_TestCase $compilerMock = $this->getMockBuilder('Magento\Framework\View\TemplateEngine\Xhtml\CompilerInterface') ->getMockForAbstractClass(); - $processedObjectMock = $this->getMockBuilder('Magento\Framework\Object') + $processedObjectMock = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->getMock(); @@ -95,7 +95,7 @@ class IncludeElementTest extends \PHPUnit_Framework_TestCase $compilerMock = $this->getMockBuilder('Magento\Framework\View\TemplateEngine\Xhtml\CompilerInterface') ->getMockForAbstractClass(); - $processedObjectMock = $this->getMockBuilder('Magento\Framework\Object') + $processedObjectMock = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/LoaderTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/LoaderTest.php index 8e361f39bf6..5cb9fa68440 100644 --- a/app/code/Magento/Config/Test/Unit/Model/Config/LoaderTest.php +++ b/app/code/Magento/Config/Test/Unit/Model/Config/LoaderTest.php @@ -74,7 +74,7 @@ class LoaderTest extends \PHPUnit_Framework_TestCase 'getItems' )->will( $this->returnValue( - [new \Magento\Framework\Object(['path' => 'section', 'value' => 10, 'config_id' => 20])] + [new \Magento\Framework\DataObject(['path' => 'section', 'value' => 10, 'config_id' => 20])] ) ); } diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/Structure/Element/FieldTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/Structure/Element/FieldTest.php index c9457d003b3..bd752f99703 100644 --- a/app/code/Magento/Config/Test/Unit/Model/Config/Structure/Element/FieldTest.php +++ b/app/code/Magento/Config/Test/Unit/Model/Config/Structure/Element/FieldTest.php @@ -383,7 +383,7 @@ class FieldTest extends \PHPUnit_Framework_TestCase ['source_model' => 'Source_Model_Name::retrieveElements', 'path' => 'path', 'type' => 'multiselect'], 'scope' ); - $sourceModelMock = $this->getMock('Magento\Framework\Object', ['setPath', 'retrieveElements']); + $sourceModelMock = $this->getMock('Magento\Framework\DataObject', ['setPath', 'retrieveElements']); $this->_sourceFactoryMock->expects( $this->once() )->method( @@ -405,7 +405,7 @@ class FieldTest extends \PHPUnit_Framework_TestCase ['source_model' => 'Source_Model_Name::retrieveElements', 'path' => 'path', 'type' => 'select'], 'scope' ); - $sourceModelMock = $this->getMock('Magento\Framework\Object', ['setPath', 'retrieveElements']); + $sourceModelMock = $this->getMock('Magento\Framework\DataObject', ['setPath', 'retrieveElements']); $this->_sourceFactoryMock->expects( $this->once() )->method( diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ReaderTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ReaderTest.php index 3a7e0b1a7ac..e914b074461 100644 --- a/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ReaderTest.php +++ b/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ReaderTest.php @@ -89,8 +89,8 @@ class ReaderTest extends \PHPUnit_Framework_TestCase ->method('compile') ->with( $this->isInstanceOf('\DOMElement'), - $this->isInstanceOf('Magento\Framework\Object'), - $this->isInstanceOf('Magento\Framework\Object') + $this->isInstanceOf('Magento\Framework\DataObject'), + $this->isInstanceOf('Magento\Framework\DataObject') ); $this->converterMock->expects($this->once()) ->method('convert') diff --git a/app/code/Magento/ConfigurableImportExport/Test/Unit/Model/Import/Product/Type/ConfigurableTest.php b/app/code/Magento/ConfigurableImportExport/Test/Unit/Model/Import/Product/Type/ConfigurableTest.php index 4b91af96d9d..08ab2cc05b8 100644 --- a/app/code/Magento/ConfigurableImportExport/Test/Unit/Model/Import/Product/Type/ConfigurableTest.php +++ b/app/code/Magento/ConfigurableImportExport/Test/Unit/Model/Import/Product/Type/ConfigurableTest.php @@ -100,7 +100,7 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->setCollection) ); - $item = new \Magento\Framework\Object([ + $item = new \Magento\Framework\DataObject([ 'id' => 1, 'attribute_set_name' => 'Default', '_attribute_set' => 'Default' @@ -254,7 +254,7 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase ]; foreach ($testProducts as $product) { $item = $this->getMock( - '\Magento\Framework\Object', + '\Magento\Framework\DataObject', ['getAttributeSetId'], [], '', diff --git a/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/Grid/Renderer/Checkbox.php b/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/Grid/Renderer/Checkbox.php index 6cc0172a55a..c95d0f2359d 100644 --- a/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/Grid/Renderer/Checkbox.php +++ b/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/Grid/Renderer/Checkbox.php @@ -33,10 +33,10 @@ class Checkbox extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Checkb /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $result = parent::render($row); return $result . '<input type="hidden" class="value-json" value="' . htmlspecialchars( @@ -47,10 +47,10 @@ class Checkbox extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Checkb /** * Get attributes json * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function getAttributesJson(\Magento\Framework\Object $row) + public function getAttributesJson(\Magento\Framework\DataObject $row) { if (!$this->getColumn()->getAttributes()) { return '[]'; diff --git a/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/Grid/Renderer/Inventory.php b/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/Grid/Renderer/Inventory.php index dc55e044b8e..8a3668cf9ac 100644 --- a/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/Grid/Renderer/Inventory.php +++ b/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/Grid/Renderer/Inventory.php @@ -14,10 +14,10 @@ class Inventory extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstr /** * Renders grid column value * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $inStock = $this->_getValue($row); return $inStock ? __('In Stock') : __('Out of Stock'); diff --git a/app/code/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/Configurable.php b/app/code/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/Configurable.php index 01814c8861c..349bbde39a6 100644 --- a/app/code/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/Configurable.php @@ -7,7 +7,7 @@ namespace Magento\ConfigurableProduct\Block\Cart\Item\Renderer; use Magento\Catalog\Model\Config\Source\Product\Thumbnail as ThumbnailSource; use Magento\Checkout\Block\Cart\Item\Renderer; -use Magento\Framework\Object\IdentityInterface; +use Magento\Framework\DataObject\IdentityInterface; /** * Shopping cart item render block for configurable products. diff --git a/app/code/Magento/ConfigurableProduct/Block/Product/Configurable/AssociatedSelector/Renderer/Id.php b/app/code/Magento/ConfigurableProduct/Block/Product/Configurable/AssociatedSelector/Renderer/Id.php index 08185cc630a..e49d2ff4992 100644 --- a/app/code/Magento/ConfigurableProduct/Block/Product/Configurable/AssociatedSelector/Renderer/Id.php +++ b/app/code/Magento/ConfigurableProduct/Block/Product/Configurable/AssociatedSelector/Renderer/Id.php @@ -31,10 +31,10 @@ class Id extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRend /** * Render grid row * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $imageUrl = $row->getImage() && $row->getImage() != 'no_selection' ? $this->escapeHtml( $this->_productHelper->getImageUrl($row) diff --git a/app/code/Magento/ConfigurableProduct/Model/ConfigurableProductManagement.php b/app/code/Magento/ConfigurableProduct/Model/ConfigurableProductManagement.php index 618977fd9d2..62e4262591d 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ConfigurableProductManagement.php +++ b/app/code/Magento/ConfigurableProduct/Model/ConfigurableProductManagement.php @@ -69,10 +69,10 @@ class ConfigurableProductManagement implements \Magento\ConfigurableProduct\Api\ /** * Return Data Object data in array format. * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return array */ - private function objectToArray(\Magento\Framework\Object $object) + private function objectToArray(\Magento\Framework\DataObject $object) { $data = $object->getData(); foreach ($data as $key => $value) { diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php index 25e63a80ce0..8136b7361de 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php @@ -250,11 +250,11 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType /** * Return relation info about used products * - * @return \Magento\Framework\Object Object with information data + * @return \Magento\Framework\DataObject Object with information data */ public function getRelationInfo() { - $info = new \Magento\Framework\Object(); + $info = new \Magento\Framework\DataObject(); $info->setTable( 'catalog_product_super_link' )->setParentFieldName( @@ -750,14 +750,14 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType * Prepare product and its configuration to be added to some products list. * Perform standard preparation process and then add Configurable specific options. * - * @param \Magento\Framework\Object $buyRequest + * @param \Magento\Framework\DataObject $buyRequest * @param \Magento\Catalog\Model\Product $product * @param string $processMode * @return \Magento\Framework\Phrase|array|string * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - protected function _prepareProduct(\Magento\Framework\Object $buyRequest, $product, $processMode) + protected function _prepareProduct(\Magento\Framework\DataObject $buyRequest, $product, $processMode) { $attributes = $buyRequest->getSuperAttribute(); if ($attributes || !$this->_isStrictProcessMode($processMode)) { @@ -783,7 +783,7 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType $subProduct = true; if ($this->_isStrictProcessMode($processMode)) { foreach ($this->getConfigurableAttributes($product) as $attributeItem) { - /* @var $attributeItem \Magento\Framework\Object */ + /* @var $attributeItem \Magento\Framework\DataObject */ $attrId = $attributeItem->getData('attribute_id'); if (!isset($attributes[$attrId]) || empty($attributes[$attrId])) { $subProduct = null; @@ -860,7 +860,7 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType parent::checkProductBuyState($product); $option = $product->getCustomOption('info_buyRequest'); if ($option instanceof \Magento\Quote\Model\Quote\Item\Option) { - $buyRequest = new \Magento\Framework\Object(unserialize($option->getValue())); + $buyRequest = new \Magento\Framework\DataObject(unserialize($option->getValue())); $attributes = $buyRequest->getSuperAttribute(); if (is_array($attributes)) { foreach ($attributes as $key => $val) { @@ -1028,7 +1028,7 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType * Prepare selected options for configurable product * * @param \Magento\Catalog\Model\Product $product - * @param \Magento\Framework\Object $buyRequest + * @param \Magento\Framework\DataObject $buyRequest * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -1097,7 +1097,11 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType $this->duplicateImagesForVariations($productsData); foreach ($productsData as $simpleProductData) { $newSimpleProduct = $this->productFactory->create(); - $configurableAttribute = $this->jsonHelper->jsonDecode($simpleProductData['configurable_attribute']); + $configurableAttribute = []; + $attributeData = $simpleProductData['configurable_attribute']; + if ($attributeData) { + $configurableAttribute = $this->jsonHelper->jsonDecode($attributeData); + } unset($simpleProductData['configurable_attribute']); $this->_fillSimpleProductData( diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Validator/Plugin.php b/app/code/Magento/ConfigurableProduct/Model/Product/Validator/Plugin.php index 7b9feeb1d1a..784366aa2a2 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Validator/Plugin.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Validator/Plugin.php @@ -54,7 +54,7 @@ class Plugin * @param Closure $proceed * @param Product $product * @param RequestInterface $request - * @param \Magento\Framework\Object $response + * @param \Magento\Framework\DataObject $response * @return bool * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -63,7 +63,7 @@ class Plugin Closure $proceed, \Magento\Catalog\Model\Product $product, \Magento\Framework\App\RequestInterface $request, - \Magento\Framework\Object $response + \Magento\Framework\DataObject $response ) { $result = $proceed($product, $request, $response); $variationProducts = (array)$request->getPost('variations-matrix'); @@ -108,7 +108,11 @@ class Plugin $product->addData($this->getRequiredDataFromProduct($parentProduct)); $product->addData($productData); $product->setCollectExceptionMessages(true); - $configurableAttribute = $this->jsonHelper->jsonDecode($productData['configurable_attribute']); + $configurableAttribute = []; + $encodedData = $productData['configurable_attribute']; + if ($encodedData) { + $configurableAttribute = $this->jsonHelper->jsonDecode($encodedData); + } $configurableAttribute = implode('-', $configurableAttribute); $errorAttributes = $product->validate(); diff --git a/app/code/Magento/ConfigurableProduct/Plugin/Model/Resource/Product.php b/app/code/Magento/ConfigurableProduct/Plugin/Model/Resource/Product.php index 92f5c034338..bc44f0dbf38 100644 --- a/app/code/Magento/ConfigurableProduct/Plugin/Model/Resource/Product.php +++ b/app/code/Magento/ConfigurableProduct/Plugin/Model/Resource/Product.php @@ -14,14 +14,14 @@ class Product * We need reset attribute set id to attribute after related simple product was saved * * @param \Magento\Catalog\Model\Resource\Product $subject - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return void * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function beforeSave( \Magento\Catalog\Model\Resource\Product $subject, - \Magento\Framework\Object $object + \Magento\Framework\DataObject $object ) { /** @var \Magento\Catalog\Model\Product $object */ if ($object->getTypeId() == Configurable::TYPE_CODE) { diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Helper/DataTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Helper/DataTest.php index 031dac827c8..114edd102e9 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Helper/DataTest.php @@ -93,10 +93,10 @@ class DataTest extends \PHPUnit_Framework_TestCase $attributes = []; for ($i = 1; $i < $attributesCount; $i++) { $attribute = $this->getMock( - 'Magento\Framework\Object', ['getProductAttribute'], [], '', false + 'Magento\Framework\DataObject', ['getProductAttribute'], [], '', false ); $productAttribute = $this->getMock( - 'Magento\Framework\Object', + 'Magento\Framework\DataObject', ['getId', 'getAttributeCode'], [], '', diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ConfigurableAttributeDataTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ConfigurableAttributeDataTest.php index 9222fca4687..1f7336d7e23 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ConfigurableAttributeDataTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ConfigurableAttributeDataTest.php @@ -131,7 +131,7 @@ class ConfigurableAttributeDataTest extends \PHPUnit_Framework_TestCase ->with($this->product) ->willReturn([$attributeMock]); - $configuredValueMock = $this->getMockBuilder('Magento\Framework\Object') + $configuredValueMock = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->getMock(); $configuredValueMock->expects($this->any()) diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Entity/Product/Attribute/Group/AttributeMapper/PluginTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Entity/Product/Attribute/Group/AttributeMapper/PluginTest.php index c42fc770637..ca17ddfc60b 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Entity/Product/Attribute/Group/AttributeMapper/PluginTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Entity/Product/Attribute/Group/AttributeMapper/PluginTest.php @@ -31,7 +31,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase private $attribute; /** - * @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject */ private $magentoObject; @@ -58,7 +58,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $this->magentoObject = $this->getMockBuilder('Magento\Framework\Object') + $this->magentoObject = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods(['getId']) ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php index 66d1b14ab1c..e6314ed70bd 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php @@ -281,7 +281,7 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase public function testGetRelationInfo() { $info = $this->_model->getRelationInfo(); - $this->assertInstanceOf('Magento\Framework\Object', $info); + $this->assertInstanceOf('Magento\Framework\DataObject', $info); $this->assertEquals('catalog_product_super_link', $info->getData('table')); $this->assertEquals('parent_id', $info->getData('parent_field_name')); $this->assertEquals('product_id', $info->getData('child_field_name')); diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Validator/PluginTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Validator/PluginTest.php index 7cc93defea6..b90019dbb80 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Validator/PluginTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Validator/PluginTest.php @@ -89,7 +89,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase false ); $this->responseMock = $this->getMock( - 'Magento\Framework\Object', + 'Magento\Framework\DataObject', ['setError', 'setMessage', 'setAttributes'], [], '', diff --git a/app/code/Magento/Contact/Controller/Index/Post.php b/app/code/Magento/Contact/Controller/Index/Post.php index c5dd05cb5d5..b6fae4cad8a 100644 --- a/app/code/Magento/Contact/Controller/Index/Post.php +++ b/app/code/Magento/Contact/Controller/Index/Post.php @@ -24,7 +24,7 @@ class Post extends \Magento\Contact\Controller\Index $this->inlineTranslation->suspend(); try { - $postObject = new \Magento\Framework\Object(); + $postObject = new \Magento\Framework\DataObject(); $postObject->setData($post); $error = false; diff --git a/app/code/Magento/Contact/Model/System/Config/Backend/Links.php b/app/code/Magento/Contact/Model/System/Config/Backend/Links.php index f64ddf298b7..f410dbe4f65 100644 --- a/app/code/Magento/Contact/Model/System/Config/Backend/Links.php +++ b/app/code/Magento/Contact/Model/System/Config/Backend/Links.php @@ -5,10 +5,12 @@ */ namespace Magento\Contact\Model\System\Config\Backend; +use Magento\Config\Model\Config\Backend\Cache; + /** * Cache cleaner backend model */ -class Links extends \Magento\Config\Model\Config\Backend\Cache implements \Magento\Framework\Object\IdentityInterface +class Links extends Cache implements \Magento\Framework\DataObject\IdentityInterface { /** * Cache tags to clean diff --git a/app/code/Magento/Cookie/Controller/Index/NoCookies.php b/app/code/Magento/Cookie/Controller/Index/NoCookies.php index 076582b6de9..c8ce45e0a38 100644 --- a/app/code/Magento/Cookie/Controller/Index/NoCookies.php +++ b/app/code/Magento/Cookie/Controller/Index/NoCookies.php @@ -15,7 +15,7 @@ class NoCookies extends \Magento\Framework\App\Action\Action */ public function execute() { - $redirect = new \Magento\Framework\Object(); + $redirect = new \Magento\Framework\DataObject(); $this->_eventManager->dispatch( 'controller_action_nocookies', ['action' => $this, 'redirect' => $redirect] diff --git a/app/code/Magento/Cookie/Helper/Cookie.php b/app/code/Magento/Cookie/Helper/Cookie.php index 5714806172e..e7555c5af88 100644 --- a/app/code/Magento/Cookie/Helper/Cookie.php +++ b/app/code/Magento/Cookie/Helper/Cookie.php @@ -95,8 +95,11 @@ class Cookie extends \Magento\Framework\App\Helper\AbstractHelper */ protected function _getAcceptedSaveCookiesWebsites() { + $unSerializedList = null; $serializedList = $this->_request->getCookie(self::IS_USER_ALLOWED_SAVE_COOKIE, false); - $unSerializedList = json_decode($serializedList, true); + if ($serializedList) { + $unSerializedList = json_decode($serializedList, true); + } return is_array($unSerializedList) ? $unSerializedList : []; } diff --git a/app/code/Magento/Cookie/Test/Unit/Controller/Index/NoCookiesTest.php b/app/code/Magento/Cookie/Test/Unit/Controller/Index/NoCookiesTest.php index ca47c6b695b..7e2db7aeaf5 100644 --- a/app/code/Magento/Cookie/Test/Unit/Controller/Index/NoCookiesTest.php +++ b/app/code/Magento/Cookie/Test/Unit/Controller/Index/NoCookiesTest.php @@ -79,7 +79,7 @@ class NoCookiesTest extends \PHPUnit_Framework_TestCase $this->callback( function ($dataArray) { $redirect = $dataArray['redirect']; - $this->assertInstanceOf('Magento\Framework\Object', $redirect); + $this->assertInstanceOf('Magento\Framework\DataObject', $redirect); $redirect->setRedirectUrl(self::REDIRECT_URL); return true; } @@ -108,7 +108,7 @@ class NoCookiesTest extends \PHPUnit_Framework_TestCase $this->callback( function ($dataArray) { $redirect = $dataArray['redirect']; - $this->assertInstanceOf('Magento\Framework\Object', $redirect); + $this->assertInstanceOf('Magento\Framework\DataObject', $redirect); $redirect->setArguments(self::REDIRECT_ARGUMENTS); $redirect->setPath(self::REDIRECT_PATH); $redirect->setRedirect(self::REDIRECT_URL); diff --git a/app/code/Magento/Cron/Test/Unit/Model/ObserverTest.php b/app/code/Magento/Cron/Test/Unit/Model/ObserverTest.php index 825c8d38ac5..7d648de7abc 100644 --- a/app/code/Magento/Cron/Test/Unit/Model/ObserverTest.php +++ b/app/code/Magento/Cron/Test/Unit/Model/ObserverTest.php @@ -487,7 +487,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $schedule->expects($this->any())->method('getJobCode')->will($this->returnValue('job_code1')); $schedule->expects($this->once())->method('getScheduledAt')->will($this->returnValue('* * * * *')); - $this->_collection->addItem(new \Magento\Framework\Object()); + $this->_collection->addItem(new \Magento\Framework\DataObject()); $this->_collection->addItem($schedule); $this->_cache->expects($this->any())->method('save'); @@ -561,7 +561,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $schedule->expects($this->any())->method('unsScheduleId')->will($this->returnSelf()); $schedule->expects($this->any())->method('trySchedule')->will($this->returnSelf()); - $this->_collection->addItem(new \Magento\Framework\Object()); + $this->_collection->addItem(new \Magento\Framework\DataObject()); $this->_collection->addItem($schedule); $this->_cache->expects($this->any())->method('save'); diff --git a/app/code/Magento/CurrencySymbol/Test/Unit/Model/ObserverTest.php b/app/code/Magento/CurrencySymbol/Test/Unit/Model/ObserverTest.php index 71fcf4aad47..688aa6d8ea2 100644 --- a/app/code/Magento/CurrencySymbol/Test/Unit/Model/ObserverTest.php +++ b/app/code/Magento/CurrencySymbol/Test/Unit/Model/ObserverTest.php @@ -79,7 +79,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase public function testCurrencyDisplayOptionsEmpty() { - $sampleCurrencyOptionObject = new \Magento\Framework\Object; + $sampleCurrencyOptionObject = new \Magento\Framework\DataObject; //Return invalid value $this->mockEvent->expects($this->once())->method('getBaseCode')->willReturn(null); $this->mockEvent->expects($this->once())->method('getCurrencyOptions')->willReturn($sampleCurrencyOptionObject); @@ -93,7 +93,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase public function testCurrencyDisplayOptions() { - $sampleCurrencyOptionObject = new \Magento\Framework\Object; + $sampleCurrencyOptionObject = new \Magento\Framework\DataObject; $sampleCurrency = 'USD'; $sampleCurrencySymbol = '$'; diff --git a/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php b/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php index ddcd8755b30..20ac4dd71f0 100644 --- a/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php +++ b/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php @@ -18,7 +18,7 @@ class DefaultRenderer extends AbstractBlock implements RendererInterface /** * Format type object * - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $_type; @@ -71,7 +71,7 @@ class DefaultRenderer extends AbstractBlock implements RendererInterface /** * Retrieve format type object * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getType() { @@ -81,10 +81,10 @@ class DefaultRenderer extends AbstractBlock implements RendererInterface /** * Retrieve format type object * - * @param \Magento\Framework\Object $type + * @param \Magento\Framework\DataObject $type * @return $this */ - public function setType(\Magento\Framework\Object $type) + public function setType(\Magento\Framework\DataObject $type) { $this->_type = $type; return $this; diff --git a/app/code/Magento/Customer/Block/Address/Renderer/RendererInterface.php b/app/code/Magento/Customer/Block/Address/Renderer/RendererInterface.php index 837ec1036fb..9331838c59b 100644 --- a/app/code/Magento/Customer/Block/Address/Renderer/RendererInterface.php +++ b/app/code/Magento/Customer/Block/Address/Renderer/RendererInterface.php @@ -18,15 +18,15 @@ interface RendererInterface /** * Set format type object * - * @param \Magento\Framework\Object $type + * @param \Magento\Framework\DataObject $type * @return void */ - public function setType(\Magento\Framework\Object $type); + public function setType(\Magento\Framework\DataObject $type); /** * Retrieve format type object * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getType(); diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php index bd316dfcddb..70ef31361e0 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php @@ -32,10 +32,10 @@ class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstract } /** - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $actions = []; @@ -72,7 +72,7 @@ class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstract protected function _actionsToHtml(array $actions) { $html = []; - $attributesObject = new \Magento\Framework\Object(); + $attributesObject = new \Magento\Framework\DataObject(); foreach ($actions as $action) { $attributesObject->setData($action['@']); $html[] = '<a ' . $attributesObject->serialize() . '>' . $action['#'] . '</a>'; diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Status.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Status.php index eb8e8dba07b..35b7934ac12 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Status.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Status.php @@ -33,10 +33,10 @@ class Status extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstract } /** - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return \Magento\Framework\Phrase */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { return __($this->getStatus($row->getQueueStatus())); } diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders.php index 8387043fc15..93effab82be 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders.php @@ -154,7 +154,7 @@ class Orders extends \Magento\Backend\Block\Widget\Grid\Extended /** * Retrieve the Url for a specified sales order row. * - * @param \Magento\Sales\Model\Order|\Magento\Framework\Object $row + * @param \Magento\Sales\Model\Order|\Magento\Framework\DataObject $row * @return string */ public function getRowUrl($row) diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Grid/Renderer/Item.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Grid/Renderer/Item.php index 2d80c04bce1..7f2d1d1afa6 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Grid/Renderer/Item.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Grid/Renderer/Item.php @@ -115,10 +115,10 @@ class Item extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRe /** * Renders item product name and its configuration * - * @param \Magento\Catalog\Model\Product\Configuration\Item\ItemInterface|\Magento\Framework\Object $item + * @param \Magento\Catalog\Model\Product\Configuration\Item\ItemInterface|\Magento\Framework\DataObject $item * @return string */ - public function render(\Magento\Framework\Object $item) + public function render(\Magento\Framework\DataObject $item) { $this->setItem($item); $product = $this->getProduct(); diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Sales.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Sales.php index c736fce50c5..1866a1a0b1c 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Sales.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Sales.php @@ -159,7 +159,7 @@ class Sales extends \Magento\Backend\Block\Template } /** - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getTotals() { diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Wishlist/Grid/Renderer/Description.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Wishlist/Grid/Renderer/Description.php index 40a8ddf9bf5..7bbf141ed61 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Wishlist/Grid/Renderer/Description.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Wishlist/Grid/Renderer/Description.php @@ -13,10 +13,10 @@ class Description extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abs /** * Render the description of given row. * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { return nl2br(htmlspecialchars($row->getData($this->getColumn()->getIndex()))); } diff --git a/app/code/Magento/Customer/Block/Adminhtml/Grid/Renderer/Multiaction.php b/app/code/Magento/Customer/Block/Adminhtml/Grid/Renderer/Multiaction.php index e0a1eaf33a5..3617ac2d3d2 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Grid/Renderer/Multiaction.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Grid/Renderer/Multiaction.php @@ -15,10 +15,10 @@ class Multiaction extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Act /** * Renders column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $html = ''; $actions = $this->getColumn()->getActions(); @@ -46,10 +46,10 @@ class Multiaction extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Act * Render single action as link html * * @param array $action - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string|false */ - protected function _toLinkHtml($action, \Magento\Framework\Object $row) + protected function _toLinkHtml($action, \Magento\Framework\DataObject $row) { $product = $row->getProduct(); diff --git a/app/code/Magento/Customer/Block/Form/Register.php b/app/code/Magento/Customer/Block/Form/Register.php index e6113253164..0750e664966 100644 --- a/app/code/Magento/Customer/Block/Form/Register.php +++ b/app/code/Magento/Customer/Block/Form/Register.php @@ -120,7 +120,7 @@ class Register extends \Magento\Directory\Block\Data $data = $this->getData('form_data'); if ($data === null) { $formData = $this->_customerSession->getCustomerFormData(true); - $data = new \Magento\Framework\Object(); + $data = new \Magento\Framework\DataObject(); if ($formData) { $data->addData($formData); $data->setCustomerData(1); diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart/Configure.php b/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart/Configure.php index dbc2461c170..c74520cb965 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart/Configure.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart/Configure.php @@ -15,7 +15,7 @@ class Configure extends \Magento\Customer\Controller\Adminhtml\Cart\Product\Comp */ public function execute() { - $configureResult = new \Magento\Framework\Object(); + $configureResult = new \Magento\Framework\DataObject(); try { $this->_initData(); diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart/Update.php b/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart/Update.php index a77e904edbe..42f9ee513a8 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart/Update.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart/Update.php @@ -15,11 +15,11 @@ class Update extends \Magento\Customer\Controller\Adminhtml\Cart\Product\Composi */ public function execute() { - $updateResult = new \Magento\Framework\Object(); + $updateResult = new \Magento\Framework\DataObject(); try { $this->_initData(); - $buyRequest = new \Magento\Framework\Object($this->getRequest()->getParams()); + $buyRequest = new \Magento\Framework\DataObject($this->getRequest()->getParams()); $this->_quote->updateItem($this->_quoteItem->getId(), $buyRequest); $this->_quote->collectTotals(); $this->quoteRepository->save($this->_quote); diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Customer/InvalidateToken.php b/app/code/Magento/Customer/Controller/Adminhtml/Customer/InvalidateToken.php index 044dfb7524f..a4191a86d45 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Customer/InvalidateToken.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Customer/InvalidateToken.php @@ -14,7 +14,7 @@ use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Api\Data\AddressInterfaceFactory; use Magento\Customer\Api\Data\CustomerInterfaceFactory; use Magento\Customer\Model\Address\Mapper; -use Magento\Framework\ObjectFactory; +use Magento\Framework\DataObjectFactory; use Magento\Framework\Api\DataObjectHelper; /** @@ -53,7 +53,7 @@ class InvalidateToken extends \Magento\Customer\Controller\Adminhtml\Index * @param \Magento\Customer\Model\Customer\Mapper $customerMapper * @param \Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor * @param DataObjectHelper $dataObjectHelper - * @param ObjectFactory $objectFactory + * @param DataObjectFactory $objectFactory * @param \Magento\Framework\View\LayoutFactory $layoutFactory * @param \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory @@ -82,7 +82,7 @@ class InvalidateToken extends \Magento\Customer\Controller\Adminhtml\Index \Magento\Customer\Model\Customer\Mapper $customerMapper, \Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor, DataObjectHelper $dataObjectHelper, - ObjectFactory $objectFactory, + DataObjectFactory $objectFactory, \Magento\Framework\View\LayoutFactory $layoutFactory, \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory, \Magento\Framework\View\Result\PageFactory $resultPageFactory, diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index.php b/app/code/Magento/Customer/Controller/Adminhtml/Index.php index 05d87fcaa8b..dd1eff1f0ef 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index.php @@ -13,7 +13,7 @@ use Magento\Customer\Api\Data\CustomerInterfaceFactory; use Magento\Customer\Controller\RegistryConstants; use Magento\Customer\Model\Address\Mapper; use Magento\Framework\Message\Error; -use Magento\Framework\ObjectFactory; +use Magento\Framework\DataObjectFactory as ObjectFactory; use Magento\Framework\Api\DataObjectHelper; /** @@ -70,7 +70,7 @@ abstract class Index extends \Magento\Backend\App\Action /** @var \Magento\Framework\Math\Random */ protected $_random; - /** @var \Magento\Framework\ObjectFactory */ + /** @var ObjectFactory */ protected $_objectFactory; /** diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/Validate.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/Validate.php index 35439a7e3cf..bd7230f1aa1 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index/Validate.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/Validate.php @@ -13,7 +13,7 @@ class Validate extends \Magento\Customer\Controller\Adminhtml\Index /** * Customer validation * - * @param \Magento\Framework\Object $response + * @param \Magento\Framework\DataObject $response * @return CustomerInterface|null */ protected function _validateCustomer($response) @@ -71,7 +71,7 @@ class Validate extends \Magento\Customer\Controller\Adminhtml\Index /** * Customer address validation. * - * @param \Magento\Framework\Object $response + * @param \Magento\Framework\DataObject $response * @return void */ protected function _validateCustomerAddress($response) @@ -109,7 +109,7 @@ class Validate extends \Magento\Customer\Controller\Adminhtml\Index */ public function execute() { - $response = new \Magento\Framework\Object(); + $response = new \Magento\Framework\DataObject(); $response->setError(0); $customer = $this->_validateCustomer($response); diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/Viewfile.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/Viewfile.php index aeb28057de1..52a8ea95f94 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index/Viewfile.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/Viewfile.php @@ -13,7 +13,7 @@ use Magento\Customer\Api\Data\CustomerInterfaceFactory; use Magento\Customer\Model\Address\Mapper; use Magento\Framework\Exception\NotFoundException; use Magento\Framework\App\Filesystem\DirectoryList; -use Magento\Framework\ObjectFactory; +use Magento\Framework\DataObjectFactory; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -50,7 +50,7 @@ class Viewfile extends \Magento\Customer\Controller\Adminhtml\Index * @param \Magento\Customer\Model\Customer\Mapper $customerMapper * @param \Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor * @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper - * @param ObjectFactory $objectFactory + * @param DataObjectFactory $objectFactory * @param \Magento\Framework\View\LayoutFactory $layoutFactory * @param \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory @@ -81,7 +81,7 @@ class Viewfile extends \Magento\Customer\Controller\Adminhtml\Index \Magento\Customer\Model\Customer\Mapper $customerMapper, \Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor, \Magento\Framework\Api\DataObjectHelper $dataObjectHelper, - ObjectFactory $objectFactory, + DataObjectFactory $objectFactory, \Magento\Framework\View\LayoutFactory $layoutFactory, \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory, \Magento\Framework\View\Result\PageFactory $resultPageFactory, diff --git a/app/code/Magento/Customer/Controller/Adminhtml/System/Config/Validatevat.php b/app/code/Magento/Customer/Controller/Adminhtml/System/Config/Validatevat.php index 8e903542a7c..4179049b44f 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/System/Config/Validatevat.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/System/Config/Validatevat.php @@ -15,7 +15,7 @@ abstract class Validatevat extends \Magento\Backend\App\Action /** * Perform customer VAT ID validation * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function _validate() { diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Wishlist/Product/Composite/Wishlist/Configure.php b/app/code/Magento/Customer/Controller/Adminhtml/Wishlist/Product/Composite/Wishlist/Configure.php index 6b3997dcdea..6101483eb98 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Wishlist/Product/Composite/Wishlist/Configure.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Wishlist/Product/Composite/Wishlist/Configure.php @@ -17,7 +17,7 @@ class Configure extends \Magento\Customer\Controller\Adminhtml\Wishlist\Product\ */ public function execute() { - $configureResult = new \Magento\Framework\Object(); + $configureResult = new \Magento\Framework\DataObject(); try { $this->_initData(); diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Wishlist/Product/Composite/Wishlist/Update.php b/app/code/Magento/Customer/Controller/Adminhtml/Wishlist/Product/Composite/Wishlist/Update.php index c1e7e8307c8..cb895085d7f 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Wishlist/Product/Composite/Wishlist/Update.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Wishlist/Product/Composite/Wishlist/Update.php @@ -18,11 +18,11 @@ class Update extends \Magento\Customer\Controller\Adminhtml\Wishlist\Product\Com public function execute() { // Update wishlist item - $updateResult = new \Magento\Framework\Object(); + $updateResult = new \Magento\Framework\DataObject(); try { $this->_initData(); - $buyRequest = new \Magento\Framework\Object($this->getRequest()->getParams()); + $buyRequest = new \Magento\Framework\DataObject($this->getRequest()->getParams()); $this->_wishlist->updateItem($this->_wishlistItem->getId(), $buyRequest)->save(); diff --git a/app/code/Magento/Customer/Model/AccountManagement.php b/app/code/Magento/Customer/Model/AccountManagement.php index aa5a30ea4c5..d17ced215ce 100644 --- a/app/code/Magento/Customer/Model/AccountManagement.php +++ b/app/code/Magento/Customer/Model/AccountManagement.php @@ -32,7 +32,7 @@ use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Exception\State\ExpiredException; use Magento\Framework\Exception\State\InputMismatchException; use Magento\Framework\Exception\State\InvalidTransitionException; -use Magento\Framework\ObjectFactory; +use Magento\Framework\DataObjectFactory as ObjectFactory; use Magento\Framework\Registry; use Psr\Log\LoggerInterface as PsrLogger; use Magento\Framework\Exception\MailException; @@ -40,7 +40,7 @@ use Magento\Framework\Mail\Template\TransportBuilder; use Magento\Framework\Math\Random; use Magento\Framework\Reflection\DataObjectProcessor; use Magento\Framework\Stdlib\DateTime; -use Magento\Framework\Stdlib\String as StringHelper; +use Magento\Framework\Stdlib\StringUtils as StringHelper; use Magento\Store\Model\StoreManagerInterface; /** @@ -189,7 +189,7 @@ class AccountManagement implements AccountManagementInterface protected $dateTime; /** - * @var \Magento\Framework\ObjectFactory + * @var ObjectFactory */ protected $objectFactory; diff --git a/app/code/Magento/Customer/Model/Address/AbstractAddress.php b/app/code/Magento/Customer/Model/Address/AbstractAddress.php index 590a0cb6d08..527cbd7bece 100644 --- a/app/code/Magento/Customer/Model/Address/AbstractAddress.php +++ b/app/code/Magento/Customer/Model/Address/AbstractAddress.php @@ -257,7 +257,7 @@ class AbstractAddress extends AbstractExtensibleModel implements AddressModelInt * * @param array|string $key * @param null $value - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function setData($key, $value = null) { diff --git a/app/code/Magento/Customer/Model/Address/Config.php b/app/code/Magento/Customer/Model/Address/Config.php index 02ed401adfe..afcaba9adfc 100644 --- a/app/code/Magento/Customer/Model/Address/Config.php +++ b/app/code/Magento/Customer/Model/Address/Config.php @@ -115,7 +115,7 @@ class Config extends \Magento\Framework\Config\Data $this->_types[$storeId] = []; foreach ($this->get() as $typeCode => $typeConfig) { $path = sprintf('%s%s', self::XML_PATH_ADDRESS_TEMPLATE, $typeCode); - $type = new \Magento\Framework\Object(); + $type = new \Magento\Framework\DataObject(); if (isset( $typeConfig['escapeHtml'] ) && ($typeConfig['escapeHtml'] == 'true' || $typeConfig['escapeHtml'] == '1') @@ -152,14 +152,14 @@ class Config extends \Magento\Framework\Config\Data /** * Retrieve default address format * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function _getDefaultFormat() { $store = $this->getStore(); $storeId = $store->getId(); if (!isset($this->_defaultTypes[$storeId])) { - $this->_defaultTypes[$storeId] = new \Magento\Framework\Object(); + $this->_defaultTypes[$storeId] = new \Magento\Framework\DataObject(); $this->_defaultTypes[$storeId]->setCode( 'default' )->setDefaultFormat( @@ -183,7 +183,7 @@ class Config extends \Magento\Framework\Config\Data * Retrieve address format by code * * @param string $typeCode - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getFormatByCode($typeCode) { diff --git a/app/code/Magento/Customer/Model/AttributeMetadataDataProvider.php b/app/code/Magento/Customer/Model/AttributeMetadataDataProvider.php index 7de20fc8acf..bdf27d3dfe8 100644 --- a/app/code/Magento/Customer/Model/AttributeMetadataDataProvider.php +++ b/app/code/Magento/Customer/Model/AttributeMetadataDataProvider.php @@ -70,7 +70,7 @@ class AttributeMetadataDataProvider if (null === $storeId) { $storeId = $this->storeManager->getStore()->getId(); } - $object = new \Magento\Framework\Object( + $object = new \Magento\Framework\DataObject( [ 'store_id' => $storeId, 'attribute_set_id' => $attributeSetId, diff --git a/app/code/Magento/Customer/Model/Config/Source/Group.php b/app/code/Magento/Customer/Model/Config/Source/Group.php index 68a71e4b8e9..ab5aec8eb91 100644 --- a/app/code/Magento/Customer/Model/Config/Source/Group.php +++ b/app/code/Magento/Customer/Model/Config/Source/Group.php @@ -20,17 +20,17 @@ class Group implements \Magento\Framework\Option\ArrayInterface protected $_groupManagement; /** - * @var \Magento\Framework\Convert\Object + * @var \Magento\Framework\Convert\DataObject */ protected $_converter; /** * @param GroupManagementInterface $groupManagement - * @param \Magento\Framework\Convert\Object $converter + * @param \Magento\Framework\Convert\DataObject $converter */ public function __construct( GroupManagementInterface $groupManagement, - \Magento\Framework\Convert\Object $converter + \Magento\Framework\Convert\DataObject $converter ) { $this->_groupManagement = $groupManagement; $this->_converter = $converter; diff --git a/app/code/Magento/Customer/Model/Config/Source/Group/Multiselect.php b/app/code/Magento/Customer/Model/Config/Source/Group/Multiselect.php index 7a31642027f..9ed9959c5e2 100644 --- a/app/code/Magento/Customer/Model/Config/Source/Group/Multiselect.php +++ b/app/code/Magento/Customer/Model/Config/Source/Group/Multiselect.php @@ -22,17 +22,17 @@ class Multiselect implements \Magento\Framework\Option\ArrayInterface protected $_groupManagement; /** - * @var \Magento\Framework\Convert\Object + * @var \Magento\Framework\Convert\DataObject */ protected $_converter; /** * @param GroupManagementInterface $groupManagement - * @param \Magento\Framework\Convert\Object $converter + * @param \Magento\Framework\Convert\DataObject $converter */ public function __construct( GroupManagementInterface $groupManagement, - \Magento\Framework\Convert\Object $converter + \Magento\Framework\Convert\DataObject $converter ) { $this->_groupManagement = $groupManagement; $this->_converter = $converter; diff --git a/app/code/Magento/Customer/Model/Customer.php b/app/code/Magento/Customer/Model/Customer.php index 9d5282327fd..c607dcbd62f 100644 --- a/app/code/Magento/Customer/Model/Customer.php +++ b/app/code/Magento/Customer/Model/Customer.php @@ -496,7 +496,7 @@ class Customer extends \Magento\Framework\Model\AbstractModel /** * Retrieve customer address array * - * @return \Magento\Framework\Object[] + * @return \Magento\Framework\DataObject[] */ public function getAddresses() { @@ -990,7 +990,7 @@ class Customer extends \Magento\Framework\Model\AbstractModel $errors[] = __('Please enter a gender.'); } - $transport = new \Magento\Framework\Object( + $transport = new \Magento\Framework\DataObject( ['errors' => $errors] ); $this->_eventManager->dispatch('customer_validate', ['customer' => $this, 'transport' => $transport]); diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Billing.php b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Billing.php index f48ddc8968b..eea4a3388ed 100644 --- a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Billing.php +++ b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Billing.php @@ -13,7 +13,7 @@ namespace Magento\Customer\Model\Customer\Attribute\Backend; class Billing extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend { /** - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return void */ public function beforeSave($object) @@ -25,7 +25,7 @@ class Billing extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacken } /** - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return void */ public function afterSave($object) diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php index 59d183ee651..398f360d90e 100644 --- a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php +++ b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php @@ -20,14 +20,14 @@ class Password extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacke /** * Magento string lib * - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; /** - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string */ - public function __construct(\Magento\Framework\Stdlib\String $string) + public function __construct(\Magento\Framework\Stdlib\StringUtils $string) { $this->string = $string; } @@ -37,7 +37,7 @@ class Password extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacke * a) check some rules for password * b) transform temporary attribute 'password' into real attribute 'password_hash' * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return void * @throws \Magento\Framework\Exception\LocalizedException */ @@ -62,7 +62,7 @@ class Password extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacke } /** - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return bool */ public function validate($object) diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Shipping.php b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Shipping.php index 9a372860de3..73c575c694a 100644 --- a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Shipping.php +++ b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Shipping.php @@ -13,7 +13,7 @@ namespace Magento\Customer\Model\Customer\Attribute\Backend; class Shipping extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend { /** - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return void */ public function beforeSave($object) @@ -25,7 +25,7 @@ class Shipping extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacke } /** - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return void */ public function afterSave($object) diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Store.php b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Store.php index a7932d37dda..204c70f32d5 100644 --- a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Store.php +++ b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Store.php @@ -28,7 +28,7 @@ class Store extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Before save * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function beforeSave($object) diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Website.php b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Website.php index 688be581107..6ae367242cf 100644 --- a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Website.php +++ b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Website.php @@ -28,7 +28,7 @@ class Website extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacken /** * Before save * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function beforeSave($object) diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Source/Group.php b/app/code/Magento/Customer/Model/Customer/Attribute/Source/Group.php index 17b2ae319c9..48c1f680dee 100644 --- a/app/code/Magento/Customer/Model/Customer/Attribute/Source/Group.php +++ b/app/code/Magento/Customer/Model/Customer/Attribute/Source/Group.php @@ -20,7 +20,7 @@ class Group extends \Magento\Eav\Model\Entity\Attribute\Source\Table protected $_groupManagement; /** - * @var \Magento\Framework\Convert\Object + * @var \Magento\Framework\Convert\DataObject */ protected $_converter; @@ -28,13 +28,13 @@ class Group extends \Magento\Eav\Model\Entity\Attribute\Source\Table * @param \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory $attrOptionFactory * @param GroupManagementInterface $groupManagement - * @param \Magento\Framework\Convert\Object $converter + * @param \Magento\Framework\Convert\DataObject $converter */ public function __construct( \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory, \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory $attrOptionFactory, GroupManagementInterface $groupManagement, - \Magento\Framework\Convert\Object $converter + \Magento\Framework\Convert\DataObject $converter ) { $this->_groupManagement = $groupManagement; $this->_converter = $converter; diff --git a/app/code/Magento/Customer/Model/Data/CustomerSecure.php b/app/code/Magento/Customer/Model/Data/CustomerSecure.php index ae5e4fc71a3..f98f9827456 100644 --- a/app/code/Magento/Customer/Model/Data/CustomerSecure.php +++ b/app/code/Magento/Customer/Model/Data/CustomerSecure.php @@ -18,6 +18,6 @@ namespace Magento\Customer\Model\Data; * @method setPasswordHash(string $hashedPassword) * @method setDeleteable(bool $deleteable) */ -class CustomerSecure extends \Magento\Framework\Object +class CustomerSecure extends \Magento\Framework\DataObject { } diff --git a/app/code/Magento/Customer/Model/Metadata/ElementFactory.php b/app/code/Magento/Customer/Model/Metadata/ElementFactory.php index a6f9b33d4be..6894f5dd5da 100644 --- a/app/code/Magento/Customer/Model/Metadata/ElementFactory.php +++ b/app/code/Magento/Customer/Model/Metadata/ElementFactory.php @@ -32,15 +32,15 @@ class ElementFactory protected $_objectManager; /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $_string; /** * @param \Magento\Framework\ObjectManagerInterface $objectManager - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string */ - public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager, \Magento\Framework\Stdlib\String $string) + public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager, \Magento\Framework\Stdlib\StringUtils $string) { $this->_objectManager = $objectManager; $this->_string = $string; diff --git a/app/code/Magento/Customer/Model/Metadata/Form/Text.php b/app/code/Magento/Customer/Model/Metadata/Form/Text.php index 3b4d02a7d6f..592eb4f51cc 100644 --- a/app/code/Magento/Customer/Model/Metadata/Form/Text.php +++ b/app/code/Magento/Customer/Model/Metadata/Form/Text.php @@ -12,7 +12,7 @@ use Magento\Framework\Api\ArrayObjectSearch; class Text extends AbstractData { /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $_string; @@ -24,7 +24,7 @@ class Text extends AbstractData * @param string $value * @param string $entityTypeCode * @param bool $isAjax - * @param \Magento\Framework\Stdlib\String $stringHelper + * @param \Magento\Framework\Stdlib\StringUtils $stringHelper */ public function __construct( \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, @@ -34,7 +34,7 @@ class Text extends AbstractData $value, $entityTypeCode, $isAjax, - \Magento\Framework\Stdlib\String $stringHelper + \Magento\Framework\Stdlib\StringUtils $stringHelper ) { parent::__construct($localeDate, $logger, $attribute, $localeResolver, $value, $entityTypeCode, $isAjax); $this->_string = $stringHelper; diff --git a/app/code/Magento/Customer/Model/Metadata/Validator.php b/app/code/Magento/Customer/Model/Metadata/Validator.php index 7b7978c212b..ffb8220cac7 100644 --- a/app/code/Magento/Customer/Model/Metadata/Validator.php +++ b/app/code/Magento/Customer/Model/Metadata/Validator.php @@ -29,12 +29,12 @@ class Validator extends \Magento\Eav\Model\Validator\Attribute\Data /** * Validate EAV model attributes with data models * - * @param \Magento\Framework\Object|array $entityData Data set from the Model attributes + * @param \Magento\Framework\DataObject|array $entityData Data set from the Model attributes * @return bool */ public function isValid($entityData) { - if ($entityData instanceof \Magento\Framework\Object) { + if ($entityData instanceof \Magento\Framework\DataObject) { $this->_entityData = $entityData->getData(); } else { $this->_entityData = $entityData; diff --git a/app/code/Magento/Customer/Model/Resource/Address.php b/app/code/Magento/Customer/Model/Resource/Address.php index 2b1adcc1259..b6739d3d100 100644 --- a/app/code/Magento/Customer/Model/Resource/Address.php +++ b/app/code/Magento/Customer/Model/Resource/Address.php @@ -68,10 +68,10 @@ class Address extends \Magento\Eav\Model\Entity\VersionControl\AbstractEntity /** * Check customer address before saving * - * @param \Magento\Framework\Object $address + * @param \Magento\Framework\DataObject $address * @return $this */ - protected function _beforeSave(\Magento\Framework\Object $address) + protected function _beforeSave(\Magento\Framework\DataObject $address) { parent::_beforeSave($address); @@ -83,7 +83,7 @@ class Address extends \Magento\Eav\Model\Entity\VersionControl\AbstractEntity /** * Validate customer address entity * - * @param \Magento\Framework\Object $address + * @param \Magento\Framework\DataObject $address * @return void * @throws \Magento\Framework\Validator\Exception When validation failed */ @@ -113,7 +113,7 @@ class Address extends \Magento\Eav\Model\Entity\VersionControl\AbstractEntity /** * {@inheritdoc} */ - protected function _afterDelete(\Magento\Framework\Object $address) + protected function _afterDelete(\Magento\Framework\DataObject $address) { if ($address->getId()) { $customer = $this->customerRepository->getById($address->getCustomerId()); diff --git a/app/code/Magento/Customer/Model/Resource/Address/Attribute/Backend/Region.php b/app/code/Magento/Customer/Model/Resource/Address/Attribute/Backend/Region.php index 12271e09595..ac8d8e119fb 100644 --- a/app/code/Magento/Customer/Model/Resource/Address/Attribute/Backend/Region.php +++ b/app/code/Magento/Customer/Model/Resource/Address/Attribute/Backend/Region.php @@ -28,7 +28,7 @@ class Region extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Prepare object for save * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function beforeSave($object) diff --git a/app/code/Magento/Customer/Model/Resource/Customer.php b/app/code/Magento/Customer/Model/Resource/Customer.php index 7a793a489ac..d66d2e0b356 100644 --- a/app/code/Magento/Customer/Model/Resource/Customer.php +++ b/app/code/Magento/Customer/Model/Resource/Customer.php @@ -84,13 +84,13 @@ class Customer extends \Magento\Eav\Model\Entity\VersionControl\AbstractEntity /** * Check customer scope, email and confirmation key before saving * - * @param \Magento\Framework\Object $customer + * @param \Magento\Framework\DataObject $customer * @return $this * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - protected function _beforeSave(\Magento\Framework\Object $customer) + protected function _beforeSave(\Magento\Framework\DataObject $customer) { /** @var \Magento\Customer\Model\Customer $customer */ if ($customer->getStoreId() === null) { @@ -168,10 +168,10 @@ class Customer extends \Magento\Eav\Model\Entity\VersionControl\AbstractEntity /** * Save customer addresses and set default addresses in attributes backend * - * @param \Magento\Framework\Object $customer + * @param \Magento\Framework\DataObject $customer * @return $this */ - protected function _afterSave(\Magento\Framework\Object $customer) + protected function _afterSave(\Magento\Framework\DataObject $customer) { return parent::_afterSave($customer); } @@ -179,7 +179,7 @@ class Customer extends \Magento\Eav\Model\Entity\VersionControl\AbstractEntity /** * Retrieve select object for loading base entity row * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @param string|int $rowId * @return \Magento\Framework\DB\Select */ @@ -319,10 +319,10 @@ class Customer extends \Magento\Eav\Model\Entity\VersionControl\AbstractEntity /** * Custom setter of increment ID if its needed * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ - public function setNewIncrementId(\Magento\Framework\Object $object) + public function setNewIncrementId(\Magento\Framework\DataObject $object) { if ($this->_scopeConfig->getValue( \Magento\Customer\Model\Customer::XML_PATH_GENERATE_HUMAN_FRIENDLY_ID, diff --git a/app/code/Magento/Customer/Model/Resource/Customer/Collection.php b/app/code/Magento/Customer/Model/Resource/Customer/Collection.php index 2353c59e91c..7700d8dd0e6 100644 --- a/app/code/Magento/Customer/Model/Resource/Customer/Collection.php +++ b/app/code/Magento/Customer/Model/Resource/Customer/Collection.php @@ -19,7 +19,7 @@ class Collection extends \Magento\Eav\Model\Entity\Collection\VersionControl\Abs const CUSTOMER_MODEL_NAME = 'Magento\Customer\Model\Customer'; /** - * @var \Magento\Framework\Object\Copy\Config + * @var \Magento\Framework\DataObject\Copy\Config */ protected $_fieldsetConfig; @@ -39,7 +39,7 @@ class Collection extends \Magento\Eav\Model\Entity\Collection\VersionControl\Abs * @param \Magento\Eav\Model\Resource\Helper $resourceHelper * @param \Magento\Framework\Validator\UniversalFactory $universalFactory * @param \Magento\Framework\Model\Resource\Db\VersionControl\Snapshot $entitySnapshot - * @param \Magento\Framework\Object\Copy\Config $fieldsetConfig + * @param \Magento\Framework\DataObject\Copy\Config $fieldsetConfig * @param \Zend_Db_Adapter_Abstract $connection * @param string $modelName * @@ -56,7 +56,7 @@ class Collection extends \Magento\Eav\Model\Entity\Collection\VersionControl\Abs \Magento\Eav\Model\Resource\Helper $resourceHelper, \Magento\Framework\Validator\UniversalFactory $universalFactory, \Magento\Framework\Model\Resource\Db\VersionControl\Snapshot $entitySnapshot, - \Magento\Framework\Object\Copy\Config $fieldsetConfig, + \Magento\Framework\DataObject\Copy\Config $fieldsetConfig, $connection = null, $modelName = self::CUSTOMER_MODEL_NAME ) { diff --git a/app/code/Magento/Customer/Model/Resource/Customer/Grid/ServiceCollection.php b/app/code/Magento/Customer/Model/Resource/Customer/Grid/ServiceCollection.php index f5b62b1baa7..de8f7aa1bf3 100644 --- a/app/code/Magento/Customer/Model/Resource/Customer/Grid/ServiceCollection.php +++ b/app/code/Magento/Customer/Model/Resource/Customer/Grid/ServiceCollection.php @@ -64,7 +64,7 @@ class ServiceCollection extends AbstractServiceCollection * Creates a collection item that represents a customer for the customer Grid. * * @param CustomerInterface $customer Input data for creating the item. - * @return \Magento\Framework\Object Collection item that represents a customer + * @return \Magento\Framework\DataObject Collection item that represents a customer */ protected function createCustomerItem(CustomerInterface $customer) { @@ -75,7 +75,7 @@ class ServiceCollection extends AbstractServiceCollection $customer->getLastname(), $customer->getSuffix(), ]; - $customerItem = new \Magento\Framework\Object(); + $customerItem = new \Magento\Framework\DataObject(); $customerItem->setId($customer->getId()); $customerItem->setEntityId($customer->getId()); // All parts of the customer name must be displayed in the name column of the grid diff --git a/app/code/Magento/Customer/Model/Resource/Group/Grid/ServiceCollection.php b/app/code/Magento/Customer/Model/Resource/Group/Grid/ServiceCollection.php index ceb01adf18d..dee81e8af82 100644 --- a/app/code/Magento/Customer/Model/Resource/Group/Grid/ServiceCollection.php +++ b/app/code/Magento/Customer/Model/Resource/Group/Grid/ServiceCollection.php @@ -70,7 +70,7 @@ class ServiceCollection extends AbstractServiceCollection /** @var GroupInterface[] $groups */ $groups = $searchResults->getItems(); foreach ($groups as $group) { - $groupItem = new \Magento\Framework\Object(); + $groupItem = new \Magento\Framework\DataObject(); $groupItem->addData($this->simpleDataObjectConverter->toFlatArray($group, '\Magento\Customer\Api\Data\GroupInterface')); $this->_addItem($groupItem); } diff --git a/app/code/Magento/Customer/Model/Vat.php b/app/code/Magento/Customer/Model/Vat.php index 0930595e675..2ff016ba96c 100644 --- a/app/code/Magento/Customer/Model/Vat.php +++ b/app/code/Magento/Customer/Model/Vat.php @@ -118,7 +118,7 @@ class Vat * Retrieve customer group ID based on his VAT number * * @param string $customerCountryCode - * @param \Magento\Framework\Object $vatValidationResult + * @param \Magento\Framework\DataObject $vatValidationResult * @param \Magento\Store\Model\Store|string|int $store * @return null|int */ @@ -163,12 +163,12 @@ class Vat * @param string $requesterCountryCode * @param string $requesterVatNumber * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function checkVatNumber($countryCode, $vatNumber, $requesterCountryCode = '', $requesterVatNumber = '') { // Default response - $gatewayResponse = new \Magento\Framework\Object( + $gatewayResponse = new \Magento\Framework\DataObject( ['is_valid' => false, 'request_date' => '', 'request_identifier' => '', 'request_success' => false] ); @@ -252,7 +252,7 @@ class Vat * Get VAT class * * @param string $customerCountryCode - * @param \Magento\Framework\Object $vatValidationResult + * @param \Magento\Framework\DataObject $vatValidationResult * @param \Magento\Store\Model\Store|string|int|null $store * @return null|string */ diff --git a/app/code/Magento/Customer/Test/Unit/Block/Form/RegisterTest.php b/app/code/Magento/Customer/Test/Unit/Block/Form/RegisterTest.php index 2daa6ff1978..604df29a48b 100644 --- a/app/code/Magento/Customer/Test/Unit/Block/Form/RegisterTest.php +++ b/app/code/Magento/Customer/Test/Unit/Block/Form/RegisterTest.php @@ -139,18 +139,18 @@ class RegisterTest extends \PHPUnit_Framework_TestCase */ public function testGetFormDataNotNullFormData() { - $data = new \Magento\Framework\Object(); + $data = new \Magento\Framework\DataObject(); $this->_block->setData(self::FORM_DATA, $data); $this->assertSame($data, $this->_block->getFormData()); } /** * Form data has not been set on the block and there is no customer data in the customer session. So - * we expect an empty \Magento\Framework\Object. + * we expect an empty \Magento\Framework\DataObject. */ public function testGetFormDataNullFormData() { - $data = new \Magento\Framework\Object(); + $data = new \Magento\Framework\DataObject(); $this->_customerSession->expects($this->once())->method('getCustomerFormData')->will($this->returnValue(null)); $this->assertEquals($data, $this->_block->getFormData()); $this->assertEquals($data, $this->_block->getData(self::FORM_DATA)); @@ -162,7 +162,7 @@ class RegisterTest extends \PHPUnit_Framework_TestCase */ public function testGetFormDataNullFormDataCustomerFormData() { - $data = new \Magento\Framework\Object(); + $data = new \Magento\Framework\DataObject(); $data->setFirstname('John'); $data->setCustomerData(1); $customerFormData = ['firstname' => 'John']; @@ -183,7 +183,7 @@ class RegisterTest extends \PHPUnit_Framework_TestCase */ public function testGetFormDataCustomerFormDataRegionId() { - $data = new \Magento\Framework\Object(); + $data = new \Magento\Framework\DataObject(); $data->setRegionId(self::REGION_ID_ATTRIBUTE_VALUE); $data->setCustomerData(1); $data[self::REGION_ID_ATTRIBUTE_CODE] = (int)self::REGION_ID_ATTRIBUTE_VALUE; @@ -207,7 +207,7 @@ class RegisterTest extends \PHPUnit_Framework_TestCase */ public function testGetCountryIdFormData() { - $formData = new \Magento\Framework\Object(); + $formData = new \Magento\Framework\DataObject(); $formData->setCountryId(self::COUNTRY_ID); $this->_block->setData(self::FORM_DATA, $formData); $this->assertEquals(self::COUNTRY_ID, $this->_block->getCountryId()); @@ -245,7 +245,7 @@ class RegisterTest extends \PHPUnit_Framework_TestCase */ public function testGetRegionByRegion() { - $formData = new \Magento\Framework\Object(); + $formData = new \Magento\Framework\DataObject(); $formData->setRegion(self::REGION_ATTRIBUTE_VALUE); $this->_block->setData(self::FORM_DATA, $formData); $this->assertSame(self::REGION_ATTRIBUTE_VALUE, $this->_block->getRegion()); @@ -257,7 +257,7 @@ class RegisterTest extends \PHPUnit_Framework_TestCase */ public function testGetRegionByRegionId() { - $formData = new \Magento\Framework\Object(); + $formData = new \Magento\Framework\DataObject(); $formData->setRegionId(self::REGION_ID_ATTRIBUTE_VALUE); $this->_block->setData(self::FORM_DATA, $formData); $this->assertSame(self::REGION_ID_ATTRIBUTE_VALUE, $this->_block->getRegion()); @@ -269,7 +269,7 @@ class RegisterTest extends \PHPUnit_Framework_TestCase */ public function testGetRegionNull() { - $formData = new \Magento\Framework\Object(); + $formData = new \Magento\Framework\DataObject(); $this->_block->setData(self::FORM_DATA, $formData); $this->assertNull($this->_block->getRegion()); } @@ -308,7 +308,7 @@ class RegisterTest extends \PHPUnit_Framework_TestCase */ public function testRestoreSessionData() { - $data = new \Magento\Framework\Object(); + $data = new \Magento\Framework\DataObject(); $data->setRegionId(self::REGION_ID_ATTRIBUTE_VALUE); $data->setCustomerData(1); $data[self::REGION_ID_ATTRIBUTE_CODE] = (int)self::REGION_ID_ATTRIBUTE_VALUE; diff --git a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/SaveTest.php b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/SaveTest.php index 6811c22265c..7e3d4e502d2 100644 --- a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/SaveTest.php +++ b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/SaveTest.php @@ -71,7 +71,7 @@ class SaveTest extends \PHPUnit_Framework_TestCase protected $formFactoryMock; /** - * @var \Magento\Framework\ObjectFactory|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObjectFactory|\PHPUnit_Framework_MockObject_MockObject */ protected $objectFactoryMock; @@ -165,7 +165,7 @@ class SaveTest extends \PHPUnit_Framework_TestCase $this->formFactoryMock = $this->getMockBuilder('Magento\Customer\Model\Metadata\FormFactory') ->disableOriginalConstructor() ->getMock(); - $this->objectFactoryMock = $this->getMockBuilder('Magento\Framework\ObjectFactory') + $this->objectFactoryMock = $this->getMockBuilder('Magento\Framework\DataObjectFactory') ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); @@ -380,8 +380,8 @@ class SaveTest extends \PHPUnit_Framework_TestCase ] ); - /** @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject $objectMock */ - $objectMock = $this->getMockBuilder('Magento\Framework\Object') + /** @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject $objectMock */ + $objectMock = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->getMock(); @@ -641,8 +641,8 @@ class SaveTest extends \PHPUnit_Framework_TestCase ] ); - /** @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject $objectMock */ - $objectMock = $this->getMockBuilder('Magento\Framework\Object') + /** @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject $objectMock */ + $objectMock = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->getMock(); @@ -827,8 +827,8 @@ class SaveTest extends \PHPUnit_Framework_TestCase ->with($this->requestMock, 'customer') ->willReturn($filteredData); - /** @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject $objectMock */ - $objectMock = $this->getMockBuilder('Magento\Framework\Object') + /** @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject $objectMock */ + $objectMock = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->getMock(); @@ -967,8 +967,8 @@ class SaveTest extends \PHPUnit_Framework_TestCase ->with($this->requestMock, 'customer') ->willReturn($filteredData); - /** @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject $objectMock */ - $objectMock = $this->getMockBuilder('Magento\Framework\Object') + /** @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject $objectMock */ + $objectMock = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->getMock(); @@ -1107,8 +1107,8 @@ class SaveTest extends \PHPUnit_Framework_TestCase ->with($this->requestMock, 'customer') ->willReturn($filteredData); - /** @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject $objectMock */ - $objectMock = $this->getMockBuilder('Magento\Framework\Object') + /** @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject $objectMock */ + $objectMock = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/ViewfileTest.php b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/ViewfileTest.php index 3021161364b..afa437c58ac 100644 --- a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/ViewfileTest.php +++ b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/ViewfileTest.php @@ -32,10 +32,15 @@ class ViewfileTest extends \PHPUnit_Framework_TestCase protected $contextMock; /** - * @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */ protected $objectManager; + /** + * @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $objectManagerMock; + /** * @var \Magento\MediaStorage\Helper\File\Storage|\PHPUnit_Framework_MockObject_MockObject */ @@ -63,6 +68,7 @@ class ViewfileTest extends \PHPUnit_Framework_TestCase public function setUp() { + $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->requestMock = $this->getMock('Magento\Framework\App\RequestInterface', [], [], '', false); $this->responseMock = $this->getMock('Magento\Framework\App\ResponseInterface', [], [], '', false); $this->directoryMock = $this->getMock( @@ -74,12 +80,12 @@ class ViewfileTest extends \PHPUnit_Framework_TestCase ); $this->fileSystemMock = $this->getMock('Magento\Framework\Filesystem', [], [], '', false); $this->storage = $this->getMock('Magento\MediaStorage\Helper\File\Storage', [], [], '', false); - $this->objectManager = $this->getMock('Magento\Framework\ObjectManagerInterface', [], [], '', false); + $this->objectManagerMock = $this->getMock('Magento\Framework\ObjectManagerInterface', [], [], '', false); $this->contextMock = $this->getMock('Magento\Backend\App\Action\Context', [], [], '', false); $this->contextMock->expects($this->any())->method('getRequest')->willReturn($this->requestMock); $this->contextMock->expects($this->any())->method('getResponse')->willReturn($this->responseMock); - $this->contextMock->expects($this->any())->method('getObjectManager')->willReturn($this->objectManager); + $this->contextMock->expects($this->any())->method('getObjectManager')->willReturn($this->objectManagerMock); $this->urlDecoderMock = $this->getMock('Magento\Framework\Url\DecoderInterface', [], [], '', false); $this->resultRawMock = $this->getMock('Magento\Framework\Controller\Result\Raw', [], [], '', false); @@ -100,8 +106,7 @@ class ViewfileTest extends \PHPUnit_Framework_TestCase public function testExecuteNoParamsShouldThrowException() { /** @var \Magento\Customer\Controller\Adminhtml\Index\Viewfile $controller */ - $controller = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this)) - ->getObject('Magento\Customer\Controller\Adminhtml\Index\Viewfile'); + $controller = $this->objectManager->getObject('Magento\Customer\Controller\Adminhtml\Index\Viewfile'); $controller->execute(); } @@ -122,7 +127,7 @@ class ViewfileTest extends \PHPUnit_Framework_TestCase $this->storage->expects($this->once())->method('processStorageFile')->with($path)->willReturn(true); - $this->objectManager->expects($this->any())->method('get') + $this->objectManagerMock->expects($this->any())->method('get') ->willReturnMap( [ ['Magento\Framework\Filesystem', $this->fileSystemMock], @@ -141,7 +146,7 @@ class ViewfileTest extends \PHPUnit_Framework_TestCase )->willReturn($fileResponse); /** @var \Magento\Customer\Controller\Adminhtml\Index\Viewfile $controller */ - $controller = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this))->getObject( + $controller = $this->objectManager->getObject( 'Magento\Customer\Controller\Adminhtml\Index\Viewfile', [ 'context' => $this->contextMock, @@ -172,7 +177,7 @@ class ViewfileTest extends \PHPUnit_Framework_TestCase $this->storage->expects($this->once())->method('processStorageFile')->with($path)->willReturn(true); - $this->objectManager->expects($this->any())->method('get') + $this->objectManagerMock->expects($this->any())->method('get') ->willReturnMap( [ ['Magento\Framework\Filesystem', $this->fileSystemMock], @@ -204,7 +209,7 @@ class ViewfileTest extends \PHPUnit_Framework_TestCase $this->resultRawFactoryMock->expects($this->once())->method('create')->willReturn($this->resultRawMock); /** @var \Magento\Customer\Controller\Adminhtml\Index\Viewfile $controller */ - $controller = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this))->getObject( + $controller = $this->objectManager->getObject( 'Magento\Customer\Controller\Adminhtml\Index\Viewfile', [ 'context' => $this->contextMock, diff --git a/app/code/Magento/Customer/Test/Unit/Helper/AddressTest.php b/app/code/Magento/Customer/Test/Unit/Helper/AddressTest.php index 40c54306505..6402cbae6f4 100644 --- a/app/code/Magento/Customer/Test/Unit/Helper/AddressTest.php +++ b/app/code/Magento/Customer/Test/Unit/Helper/AddressTest.php @@ -326,7 +326,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase ->method('getFormatByCode') ->with($code) ->will($this->returnValue( - new \Magento\Framework\Object($result !== null ? ['renderer' => $result] : []) + new \Magento\Framework\DataObject($result !== null ? ['renderer' => $result] : []) )); $this->assertEquals($result, $this->helper->getFormatTypeRenderer($code)); } @@ -359,7 +359,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase ->method('getFormatByCode') ->with($code) ->will($this->returnValue( - new \Magento\Framework\Object(!empty($result) ? ['renderer' => $renderer] : []) + new \Magento\Framework\DataObject(!empty($result) ? ['renderer' => $renderer] : []) )); $this->assertEquals($result, $this->helper->getFormat($code)); diff --git a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php index 1a7355c6a87..9dcfff73718 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php @@ -58,7 +58,7 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Customer\Model\Config\Share|\PHPUnit_Framework_MockObject_MockObject */ protected $share; - /** @var \Magento\Framework\Stdlib\String|\PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Framework\Stdlib\StringUtils|\PHPUnit_Framework_MockObject_MockObject */ protected $string; /** @var \Magento\Customer\Api\CustomerRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject */ @@ -85,7 +85,7 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Customer\Model\Customer|\PHPUnit_Framework_MockObject_MockObject */ protected $customer; - /** @var \Magento\Framework\ObjectFactory|\PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Framework\DataObjectFactory|\PHPUnit_Framework_MockObject_MockObject */ protected $objectFactory; /** @var \Magento\Framework\Api\ExtensibleDataObjectConverter|\PHPUnit_Framework_MockObject_MockObject */ @@ -127,7 +127,7 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase $this->logger = $this->getMock('Psr\Log\LoggerInterface'); $this->encryptor = $this->getMock('Magento\Framework\Encryption\EncryptorInterface'); $this->share = $this->getMock('Magento\Customer\Model\Config\Share', [], [], '', false); - $this->string = $this->getMock('Magento\Framework\Stdlib\String'); + $this->string = $this->getMock('Magento\Framework\Stdlib\StringUtils'); $this->customerRepository = $this->getMock('Magento\Customer\Api\CustomerRepositoryInterface'); $this->scopeConfig = $this->getMock('Magento\Framework\App\Config\ScopeConfigInterface'); $this->transportBuilder = $this->getMock( @@ -148,7 +148,7 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase $this->customerViewHelper = $this->getMock('Magento\Customer\Helper\View', [], [], '', false); $this->dateTime = $this->getMock('Magento\Framework\Stdlib\DateTime'); $this->customer = $this->getMock('Magento\Customer\Model\Customer', [], [], '', false); - $this->objectFactory = $this->getMock('Magento\Framework\ObjectFactory', [], [], '', false); + $this->objectFactory = $this->getMock('Magento\Framework\DataObjectFactory', [], [], '', false); $this->extensibleDataObjectConverter = $this->getMock( 'Magento\Framework\Api\ExtensibleDataObjectConverter', [], diff --git a/app/code/Magento/Customer/Test/Unit/Model/Address/AbstractAddressTest.php b/app/code/Magento/Customer/Test/Unit/Model/Address/AbstractAddressTest.php index 8138ed140e7..86bb7c3d157 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Address/AbstractAddressTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Address/AbstractAddressTest.php @@ -281,11 +281,11 @@ class AbstractAddressTest extends \PHPUnit_Framework_TestCase public function testSetDataWithObject() { $value = [ - 'key' => new \Magento\Framework\Object(), + 'key' => new \Magento\Framework\DataObject(), ]; $expected = [ 'key' => [ - 'key' => new \Magento\Framework\Object() + 'key' => new \Magento\Framework\DataObject() ] ]; $this->model->setData('key', $value); diff --git a/app/code/Magento/Customer/Test/Unit/Model/Address/ConfigTest.php b/app/code/Magento/Customer/Test/Unit/Model/Address/ConfigTest.php index 48b1d82a598..4e2c83e90ed 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Address/ConfigTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Address/ConfigTest.php @@ -123,7 +123,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->_scopeConfigMock->expects($this->any())->method('getValue')->will($this->returnValue('someValue')); - $rendererMock = $this->getMock('Magento\Framework\Object'); + $rendererMock = $this->getMock('Magento\Framework\DataObject'); $this->_addressHelperMock->expects( $this->any() @@ -133,7 +133,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->returnValue($rendererMock) ); - $firstExpected = new \Magento\Framework\Object(); + $firstExpected = new \Magento\Framework\DataObject(); $firstExpected->setCode( 'format_one' )->setTitle( @@ -146,7 +146,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase null ); - $secondExpected = new \Magento\Framework\Object(); + $secondExpected = new \Magento\Framework\DataObject(); $secondExpected->setCode( 'format_two' )->setTitle( diff --git a/app/code/Magento/Customer/Test/Unit/Model/Backend/CustomerTest.php b/app/code/Magento/Customer/Test/Unit/Model/Backend/CustomerTest.php index 1158cc18247..9388e86b09a 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Backend/CustomerTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Backend/CustomerTest.php @@ -43,7 +43,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase { if ($websiteId * 1) { $this->_model->setWebsiteId($websiteId); - $website = new \Magento\Framework\Object(['store_ids' => [$websiteStoreId]]); + $website = new \Magento\Framework\DataObject(['store_ids' => [$websiteStoreId]]); $this->_storeManager->expects($this->once())->method('getWebsite')->will($this->returnValue($website)); } else { $this->_model->setStoreId($storeId); diff --git a/app/code/Magento/Customer/Test/Unit/Model/Config/Source/Group/MultiselectTest.php b/app/code/Magento/Customer/Test/Unit/Model/Config/Source/Group/MultiselectTest.php index 77195deee71..769a1f12372 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Config/Source/Group/MultiselectTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Config/Source/Group/MultiselectTest.php @@ -26,7 +26,7 @@ class MultiselectTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->groupServiceMock = $this->getMock('\Magento\Customer\Api\GroupManagementInterface'); - $this->converterMock = $this->getMock('\Magento\Framework\Convert\Object', [], [], '', false); + $this->converterMock = $this->getMock('\Magento\Framework\Convert\DataObject', [], [], '', false); $this->model = new \Magento\Customer\Model\Config\Source\Group\Multiselect($this->groupServiceMock, $this->converterMock); } diff --git a/app/code/Magento/Customer/Test/Unit/Model/Config/Source/GroupTest.php b/app/code/Magento/Customer/Test/Unit/Model/Config/Source/GroupTest.php index 4f0090e869c..1a11875c491 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Config/Source/GroupTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Config/Source/GroupTest.php @@ -26,7 +26,7 @@ class GroupTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->groupServiceMock = $this->getMock('\Magento\Customer\Api\GroupManagementInterface'); - $this->converterMock = $this->getMock('\Magento\Framework\Convert\Object', [], [], '', false); + $this->converterMock = $this->getMock('\Magento\Framework\Convert\DataObject', [], [], '', false); $this->model = new \Magento\Customer\Model\Config\Source\Group($this->groupServiceMock, $this->converterMock); } diff --git a/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Backend/BillingTest.php b/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Backend/BillingTest.php index 9480ce5ac6d..32ef1d1c6c1 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Backend/BillingTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Backend/BillingTest.php @@ -23,14 +23,14 @@ class BillingTest extends \PHPUnit_Framework_TestCase public function testBeforeSave() { - $object = $this->getMockBuilder('Magento\Framework\Object') + $object = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->setMethods(['getDefaultBilling', 'unsetDefaultBilling']) ->getMock(); $object->expects($this->once())->method('getDefaultBilling')->will($this->returnValue(null)); $object->expects($this->once())->method('unsetDefaultBilling')->will($this->returnSelf()); - /** @var \Magento\Framework\Object $object */ + /** @var \Magento\Framework\DataObject $object */ $this->testable->beforeSave($object); } @@ -40,12 +40,12 @@ class BillingTest extends \PHPUnit_Framework_TestCase $addressId = 1; $attributeCode = 'attribute_code'; $defaultBilling = 'default billing address'; - $object = $this->getMockBuilder('Magento\Framework\Object') + $object = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->setMethods(['getDefaultBilling', 'getAddresses', 'setDefaultBilling']) ->getMock(); - $address = $this->getMockBuilder('Magento\Framework\Object') + $address = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->setMethods(['getPostIndex', 'getId']) ->getMock(); @@ -68,7 +68,7 @@ class BillingTest extends \PHPUnit_Framework_TestCase $object->expects($this->once())->method('getDefaultBilling')->will($this->returnValue($defaultBilling)); $object->expects($this->once())->method('setDefaultBilling')->with($addressId)->will($this->returnSelf()); $object->expects($this->once())->method('getAddresses')->will($this->returnValue([$address])); - /** @var \Magento\Framework\Object $object */ + /** @var \Magento\Framework\DataObject $object */ /** @var \Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute */ $this->testable->setAttribute($attribute); diff --git a/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Backend/PasswordTest.php b/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Backend/PasswordTest.php index 28a0d8f3121..da47d31b9b6 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Backend/PasswordTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Backend/PasswordTest.php @@ -6,7 +6,7 @@ namespace Magento\Customer\Test\Unit\Model\Customer\Attribute\Backend; -use Magento\Framework\Stdlib\String; +use Magento\Framework\Stdlib\StringUtils; use Magento\Customer\Model\Customer\Attribute\Backend\Password; class PasswordTest extends \PHPUnit_Framework_TestCase @@ -18,21 +18,21 @@ class PasswordTest extends \PHPUnit_Framework_TestCase public function setUp() { - $string = new String(); + $string = new StringUtils(); $this->testable = new \Magento\Customer\Model\Customer\Attribute\Backend\Password($string); } public function testValidatePositive() { $password = 'password'; - $object = $this->getMockBuilder('Magento\Framework\Object') + $object = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->setMethods(['getPassword', 'getPasswordConfirm']) ->getMock(); $object->expects($this->once())->method('getPassword')->will($this->returnValue($password)); $object->expects($this->once())->method('getPasswordConfirm')->will($this->returnValue($password)); - /** @var \Magento\Framework\Object $object */ + /** @var \Magento\Framework\DataObject $object */ $this->assertTrue($this->testable->validate($object)); } @@ -52,13 +52,13 @@ class PasswordTest extends \PHPUnit_Framework_TestCase */ public function testBeforeSaveNegative($password) { - $object = $this->getMockBuilder('Magento\Framework\Object') + $object = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->setMethods(['getPassword']) ->getMock(); $object->expects($this->once())->method('getPassword')->will($this->returnValue($password)); - /** @var \Magento\Framework\Object $object */ + /** @var \Magento\Framework\DataObject $object */ $this->testable->beforeSave($object); } @@ -67,7 +67,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase { $password = 'more-then-6'; $passwordHash = 'password-hash'; - $object = $this->getMockBuilder('Magento\Framework\Object') + $object = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->setMethods(['getPassword', 'setPasswordHash', 'hashPassword']) ->getMock(); @@ -75,7 +75,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase $object->expects($this->once())->method('getPassword')->will($this->returnValue($password)); $object->expects($this->once())->method('hashPassword')->will($this->returnValue($passwordHash)); $object->expects($this->once())->method('setPasswordHash')->with($passwordHash)->will($this->returnSelf()); - /** @var \Magento\Framework\Object $object */ + /** @var \Magento\Framework\DataObject $object */ $this->testable->beforeSave($object); } diff --git a/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Backend/ShippingTest.php b/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Backend/ShippingTest.php index 6074a540bd6..ce4937ba3bd 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Backend/ShippingTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Backend/ShippingTest.php @@ -24,14 +24,14 @@ class ShippingTest extends \PHPUnit_Framework_TestCase public function testBeforeSave() { - $object = $this->getMockBuilder('Magento\Framework\Object') + $object = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->setMethods(['getDefaultShipping', 'unsetDefaultShipping']) ->getMock(); $object->expects($this->once())->method('getDefaultShipping')->will($this->returnValue(null)); $object->expects($this->once())->method('unsetDefaultShipping')->will($this->returnSelf()); - /** @var \Magento\Framework\Object $object */ + /** @var \Magento\Framework\DataObject $object */ $this->testable->beforeSave($object); } @@ -41,12 +41,12 @@ class ShippingTest extends \PHPUnit_Framework_TestCase $addressId = 1; $attributeCode = 'attribute_code'; $defaultShipping = 'default Shipping address'; - $object = $this->getMockBuilder('Magento\Framework\Object') + $object = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->setMethods(['getDefaultShipping', 'getAddresses', 'setDefaultShipping']) ->getMock(); - $address = $this->getMockBuilder('Magento\Framework\Object') + $address = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->setMethods(['getPostIndex', 'getId']) ->getMock(); @@ -69,7 +69,7 @@ class ShippingTest extends \PHPUnit_Framework_TestCase $object->expects($this->once())->method('getDefaultShipping')->will($this->returnValue($defaultShipping)); $object->expects($this->once())->method('setDefaultShipping')->with($addressId)->will($this->returnSelf()); $object->expects($this->once())->method('getAddresses')->will($this->returnValue([$address])); - /** @var \Magento\Framework\Object $object */ + /** @var \Magento\Framework\DataObject $object */ /** @var \Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute */ $this->testable->setAttribute($attribute); diff --git a/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Backend/StoreTest.php b/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Backend/StoreTest.php index f5904c30bb5..b77a6c0f366 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Backend/StoreTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Backend/StoreTest.php @@ -30,13 +30,13 @@ class StoreTest extends \PHPUnit_Framework_TestCase public function testBeforeSaveWithId() { - $object = $this->getMockBuilder('Magento\Framework\Object') + $object = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->setMethods(['getId']) ->getMock(); $object->expects($this->once())->method('getId')->will($this->returnValue(1)); - /** @var \Magento\Framework\Object $object */ + /** @var \Magento\Framework\DataObject $object */ $this->assertInstanceOf( 'Magento\Customer\Model\Customer\Attribute\Backend\Store', @@ -48,12 +48,12 @@ class StoreTest extends \PHPUnit_Framework_TestCase { $storeId = 1; $storeName = 'store'; - $object = $this->getMockBuilder('Magento\Framework\Object') + $object = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->setMethods(['getId', 'hasStoreId', 'setStoreId', 'hasData', 'setData', 'getStoreId']) ->getMock(); - $store = $this->getMockBuilder('Magento\Framework\Object')->setMethods(['getId', 'getName'])->getMock(); + $store = $this->getMockBuilder('Magento\Framework\DataObject')->setMethods(['getId', 'getName'])->getMock(); $store->expects($this->once())->method('getId')->will($this->returnValue($storeId)); $store->expects($this->once())->method('getName')->will($this->returnValue($storeName)); @@ -70,7 +70,7 @@ class StoreTest extends \PHPUnit_Framework_TestCase ->method('setData') ->with($this->logicalOr('created_in', $storeName)) ->will($this->returnSelf()); - /** @var \Magento\Framework\Object $object */ + /** @var \Magento\Framework\DataObject $object */ $this->assertInstanceOf( 'Magento\Customer\Model\Customer\Attribute\Backend\Store', diff --git a/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Backend/WebsiteTest.php b/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Backend/WebsiteTest.php index 2e2bea6ab4e..3b9307503d0 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Backend/WebsiteTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Backend/WebsiteTest.php @@ -30,13 +30,13 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase public function testBeforeSaveWithId() { - $object = $this->getMockBuilder('Magento\Framework\Object') + $object = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->setMethods(['getId']) ->getMock(); $object->expects($this->once())->method('getId')->will($this->returnValue(1)); - /** @var \Magento\Framework\Object $object */ + /** @var \Magento\Framework\DataObject $object */ $this->assertInstanceOf( 'Magento\Customer\Model\Customer\Attribute\Backend\Website', @@ -47,12 +47,12 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase public function testBeforeSave() { $websiteId = 1; - $object = $this->getMockBuilder('Magento\Framework\Object') + $object = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->setMethods(['hasData', 'setData']) ->getMock(); - $store = $this->getMockBuilder('Magento\Framework\Object')->setMethods(['getWebsiteId'])->getMock(); + $store = $this->getMockBuilder('Magento\Framework\DataObject')->setMethods(['getWebsiteId'])->getMock(); $store->expects($this->once())->method('getWebsiteId')->will($this->returnValue($websiteId)); $this->storeManager->expects($this->once()) @@ -64,7 +64,7 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase ->method('setData') ->with($this->logicalOr('website_id', $websiteId)) ->will($this->returnSelf()); - /** @var \Magento\Framework\Object $object */ + /** @var \Magento\Framework\DataObject $object */ $this->assertInstanceOf( 'Magento\Customer\Model\Customer\Attribute\Backend\Website', diff --git a/app/code/Magento/Customer/Test/Unit/Model/CustomerTest.php b/app/code/Magento/Customer/Test/Unit/Model/CustomerTest.php index a1a684f9c71..ac9dedaebdc 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/CustomerTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/CustomerTest.php @@ -92,7 +92,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase false ); $this->resourceMock = $this->getMock( - '\Magento\Customer\Model\Resource\Customer', //'\Magento\Framework\Object', + '\Magento\Customer\Model\Resource\Customer', //'\Magento\Framework\DataObject', ['getIdFieldName'], [], '', diff --git a/app/code/Magento/Customer/Test/Unit/Model/Metadata/ElementFactoryTest.php b/app/code/Magento/Customer/Test/Unit/Model/Metadata/ElementFactoryTest.php index e987b7948f2..434be172b39 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Metadata/ElementFactoryTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Metadata/ElementFactoryTest.php @@ -5,6 +5,8 @@ */ namespace Magento\Customer\Test\Unit\Model\Metadata; +use Magento\Customer\Model\Metadata\ElementFactory; + class ElementFactoryTest extends \PHPUnit_Framework_TestCase { /** @var \Magento\Framework\ObjectManagerInterface | \PHPUnit_Framework_MockObject_MockObject */ @@ -29,7 +31,7 @@ class ElementFactoryTest extends \PHPUnit_Framework_TestCase '', false ); - $this->_elementFactory = new \Magento\Customer\Model\Metadata\ElementFactory($this->_objectManager, new \Magento\Framework\Stdlib\String()); + $this->_elementFactory = new ElementFactory($this->_objectManager, new \Magento\Framework\Stdlib\StringUtils()); } /** TODO fix when Validation is implemented MAGETWO-17341 */ diff --git a/app/code/Magento/Customer/Test/Unit/Model/Metadata/Form/TextTest.php b/app/code/Magento/Customer/Test/Unit/Model/Metadata/Form/TextTest.php index 058fcb51af6..5cc2666f445 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Metadata/Form/TextTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Metadata/Form/TextTest.php @@ -11,13 +11,13 @@ use Magento\Customer\Model\Metadata\Form\Text; class TextTest extends AbstractFormTestCase { - /** @var \Magento\Framework\Stdlib\String */ + /** @var \Magento\Framework\Stdlib\StringUtils */ protected $stringHelper; protected function setUp() { parent::setUp(); - $this->stringHelper = new \Magento\Framework\Stdlib\String(); + $this->stringHelper = new \Magento\Framework\Stdlib\StringUtils(); } /** diff --git a/app/code/Magento/Customer/Test/Unit/Model/Metadata/ValidatorTest.php b/app/code/Magento/Customer/Test/Unit/Model/Metadata/ValidatorTest.php index 77e03c47288..7a0bac7f1a3 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Metadata/ValidatorTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Metadata/ValidatorTest.php @@ -59,7 +59,7 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase $this->validator->setData(['something']); $this->assertTrue($this->validator->isValid(['entity'])); $this->validator->setData([]); - $this->assertTrue($this->validator->isValid(new \Magento\Framework\Object([]))); + $this->assertTrue($this->validator->isValid(new \Magento\Framework\DataObject([]))); } /** @@ -76,7 +76,7 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase $this->validator->setData($data); $this->assertEquals($isValid, $this->validator->isValid(['ENTITY'])); $this->validator->setData([]); - $this->assertEquals($isValid, $this->validator->isValid(new \Magento\Framework\Object($data))); + $this->assertEquals($isValid, $this->validator->isValid(new \Magento\Framework\DataObject($data))); } public function trueFalseDataProvider() diff --git a/app/code/Magento/Customer/Test/Unit/Model/ObserverTest.php b/app/code/Magento/Customer/Test/Unit/Model/ObserverTest.php index 0826550e516..d02337fe6bc 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/ObserverTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/ObserverTest.php @@ -532,7 +532,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $validationResult = $this->getMockBuilder('Magento\Framework\Object') + $validationResult = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->setMethods([ 'getIsValid', diff --git a/app/code/Magento/Customer/Test/Unit/Model/Renderer/RegionTest.php b/app/code/Magento/Customer/Test/Unit/Model/Renderer/RegionTest.php index c28afe00a4f..b15abcc3bfa 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Renderer/RegionTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Renderer/RegionTest.php @@ -116,8 +116,8 @@ class RegionTest extends \PHPUnit_Framework_TestCase 'with no defined regions' => [[]], 'with defined regions' => [ [ - new \Magento\Framework\Object(['value' => 'Bavaria']), - new \Magento\Framework\Object(['value' => 'Saxony']), + new \Magento\Framework\DataObject(['value' => 'Bavaria']), + new \Magento\Framework\DataObject(['value' => 'Saxony']), ], ] ]; diff --git a/app/code/Magento/Customer/Test/Unit/Model/Resource/Address/Attribute/Backend/RegionTest.php b/app/code/Magento/Customer/Test/Unit/Model/Resource/Address/Attribute/Backend/RegionTest.php index 2b3d123338e..e14242b4ebd 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Resource/Address/Attribute/Backend/RegionTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Resource/Address/Attribute/Backend/RegionTest.php @@ -16,7 +16,7 @@ class RegionTest extends \PHPUnit_Framework_TestCase /** @var Region */ protected $model; - /** @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject */ protected $object; /** @var \Magento\Directory\Model\Region|\PHPUnit_Framework_MockObject_MockObject */ @@ -34,7 +34,7 @@ class RegionTest extends \PHPUnit_Framework_TestCase ); $this->model = new Region($this->regionFactory); $this->object = $this->getMock( - 'Magento\Framework\Object', + 'Magento\Framework\DataObject', ['getData', 'getCountryId', 'setRegionId', 'setRegion'], [], '', diff --git a/app/code/Magento/Customer/Test/Unit/Model/VisitorTest.php b/app/code/Magento/Customer/Test/Unit/Model/VisitorTest.php index 1acfdd190fe..48ae8de81dc 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/VisitorTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/VisitorTest.php @@ -104,18 +104,18 @@ class VisitorTest extends \PHPUnit_Framework_TestCase 'ignores' => ['test_route_name' => true] ] ); - $request = new \Magento\Framework\Object(['route_name' => 'test_route_name']); - $action = new \Magento\Framework\Object(['request' => $request]); - $event = new \Magento\Framework\Object(['controller_action' => $action]); - $observer = new \Magento\Framework\Object(['event' => $event]); + $request = new \Magento\Framework\DataObject(['route_name' => 'test_route_name']); + $action = new \Magento\Framework\DataObject(['request' => $request]); + $event = new \Magento\Framework\DataObject(['controller_action' => $action]); + $observer = new \Magento\Framework\DataObject(['event' => $event]); $this->assertTrue($this->visitor->isModuleIgnored($observer)); } public function testBindCustomerLogin() { - $customer = new \Magento\Framework\Object(['id' => '1']); - $observer = new \Magento\Framework\Object([ - 'event' => new \Magento\Framework\Object(['customer' => $customer]), + $customer = new \Magento\Framework\DataObject(['id' => '1']); + $observer = new \Magento\Framework\DataObject([ + 'event' => new \Magento\Framework\DataObject(['customer' => $customer]), ]); $this->visitor->bindCustomerLogin($observer); @@ -131,7 +131,7 @@ class VisitorTest extends \PHPUnit_Framework_TestCase public function testBindCustomerLogout() { - $observer = new \Magento\Framework\Object(); + $observer = new \Magento\Framework\DataObject(); $this->visitor->setCustomerId('1'); $this->visitor->bindCustomerLogout($observer); @@ -144,9 +144,9 @@ class VisitorTest extends \PHPUnit_Framework_TestCase public function testBindQuoteCreate() { - $quote = new \Magento\Framework\Object(['id' => '1', 'is_checkout_cart' => true]); - $observer = new \Magento\Framework\Object([ - 'event' => new \Magento\Framework\Object(['quote' => $quote]), + $quote = new \Magento\Framework\DataObject(['id' => '1', 'is_checkout_cart' => true]); + $observer = new \Magento\Framework\DataObject([ + 'event' => new \Magento\Framework\DataObject(['quote' => $quote]), ]); $this->visitor->bindQuoteCreate($observer); $this->assertTrue($this->visitor->getDoQuoteCreate()); @@ -154,9 +154,9 @@ class VisitorTest extends \PHPUnit_Framework_TestCase public function testBindQuoteDestroy() { - $quote = new \Magento\Framework\Object(['id' => '1']); - $observer = new \Magento\Framework\Object([ - 'event' => new \Magento\Framework\Object(['quote' => $quote]), + $quote = new \Magento\Framework\DataObject(['id' => '1']); + $observer = new \Magento\Framework\DataObject([ + 'event' => new \Magento\Framework\DataObject(['quote' => $quote]), ]); $this->visitor->bindQuoteDestroy($observer); $this->assertTrue($this->visitor->getDoQuoteDestroy()); diff --git a/app/code/Magento/Customer/etc/fieldset.xml b/app/code/Magento/Customer/etc/fieldset.xml index 07fbb6d7acc..c2d875d7175 100644 --- a/app/code/Magento/Customer/etc/fieldset.xml +++ b/app/code/Magento/Customer/etc/fieldset.xml @@ -6,7 +6,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Object/etc/fieldset.xsd"> + xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/DataObject/etc/fieldset.xsd"> <scope id="global"> <fieldset id="customer_account"> <field name="prefix"> diff --git a/app/code/Magento/CustomerImportExport/Model/Import/AbstractCustomer.php b/app/code/Magento/CustomerImportExport/Model/Import/AbstractCustomer.php index 1c20c89fe1a..df00c55a695 100644 --- a/app/code/Magento/CustomerImportExport/Model/Import/AbstractCustomer.php +++ b/app/code/Magento/CustomerImportExport/Model/Import/AbstractCustomer.php @@ -69,7 +69,7 @@ abstract class AbstractCustomer extends \Magento\ImportExport\Model\Import\Entit protected $masterAttributeCode = '_email'; /** - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\ImportExport\Model\ImportFactory $importFactory * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper @@ -82,7 +82,7 @@ abstract class AbstractCustomer extends \Magento\ImportExport\Model\Import\Entit * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, diff --git a/app/code/Magento/CustomerImportExport/Model/Import/Address.php b/app/code/Magento/CustomerImportExport/Model/Import/Address.php index bad0fde1d88..d0eef32fc18 100644 --- a/app/code/Magento/CustomerImportExport/Model/Import/Address.php +++ b/app/code/Magento/CustomerImportExport/Model/Import/Address.php @@ -213,7 +213,7 @@ class Address extends AbstractCustomer protected $dateTime; /** - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\ImportExport\Model\ImportFactory $importFactory * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper @@ -233,7 +233,7 @@ class Address extends AbstractCustomer * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, diff --git a/app/code/Magento/CustomerImportExport/Model/Import/Customer.php b/app/code/Magento/CustomerImportExport/Model/Import/Customer.php index 40c8bbf49cc..a92fb906bd2 100644 --- a/app/code/Magento/CustomerImportExport/Model/Import/Customer.php +++ b/app/code/Magento/CustomerImportExport/Model/Import/Customer.php @@ -118,7 +118,7 @@ class Customer extends AbstractCustomer protected $masterAttributeCode = 'email'; /** - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\ImportExport\Model\ImportFactory $importFactory * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper @@ -133,7 +133,7 @@ class Customer extends AbstractCustomer * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, diff --git a/app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php b/app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php index cf72499845d..5ab9b3e042b 100644 --- a/app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php +++ b/app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php @@ -129,7 +129,7 @@ class CustomerComposite extends \Magento\ImportExport\Model\Import\AbstractEntit protected $masterAttributeCode = 'email'; /** - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\ImportExport\Model\ImportFactory $importFactory * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper @@ -142,7 +142,7 @@ class CustomerComposite extends \Magento\ImportExport\Model\Import\AbstractEntit * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, @@ -285,7 +285,7 @@ class CustomerComposite extends \Magento\ImportExport\Model\Import\AbstractEntit // Add new customer data into customer storage for address entity instance $websiteId = $this->_customerEntity->getWebsiteId($this->_currentWebsiteCode); if (!$this->_addressEntity->getCustomerStorage()->getCustomerId($this->_currentEmail, $websiteId)) { - $customerData = new \Magento\Framework\Object( + $customerData = new \Magento\Framework\DataObject( [ 'id' => $this->_nextCustomerId, 'email' => $this->_currentEmail, diff --git a/app/code/Magento/CustomerImportExport/Model/Resource/Import/Customer/Storage.php b/app/code/Magento/CustomerImportExport/Model/Resource/Import/Customer/Storage.php index 36b9c38a16a..0d79a11cacb 100644 --- a/app/code/Magento/CustomerImportExport/Model/Resource/Import/Customer/Storage.php +++ b/app/code/Magento/CustomerImportExport/Model/Resource/Import/Customer/Storage.php @@ -94,10 +94,10 @@ class Storage /** * Add customer to array * - * @param \Magento\Framework\Object|\Magento\Customer\Model\Customer $customer + * @param \Magento\Framework\DataObject|\Magento\Customer\Model\Customer $customer * @return $this */ - public function addCustomer(\Magento\Framework\Object $customer) + public function addCustomer(\Magento\Framework\DataObject $customer) { $email = strtolower(trim($customer->getEmail())); if (!isset($this->_customerIds[$email])) { diff --git a/app/code/Magento/CustomerImportExport/Test/Unit/Model/Export/AddressTest.php b/app/code/Magento/CustomerImportExport/Test/Unit/Model/Export/AddressTest.php index ebc2e782689..ba9d067a69e 100644 --- a/app/code/Magento/CustomerImportExport/Test/Unit/Model/Export/AddressTest.php +++ b/app/code/Magento/CustomerImportExport/Test/Unit/Model/Export/AddressTest.php @@ -199,7 +199,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase continue; } $websiteData = ['id' => $id, 'code' => $code]; - $websites[$id] = new \Magento\Framework\Object($websiteData); + $websites[$id] = new \Magento\Framework\DataObject($websiteData); } return $websites; diff --git a/app/code/Magento/CustomerImportExport/Test/Unit/Model/Export/CustomerTest.php b/app/code/Magento/CustomerImportExport/Test/Unit/Model/Export/CustomerTest.php index 69980ac8e37..89bd751e83a 100644 --- a/app/code/Magento/CustomerImportExport/Test/Unit/Model/Export/CustomerTest.php +++ b/app/code/Magento/CustomerImportExport/Test/Unit/Model/Export/CustomerTest.php @@ -154,7 +154,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase continue; } $websiteData = ['id' => $id, 'code' => $code]; - $websites[$id] = new \Magento\Framework\Object($websiteData); + $websites[$id] = new \Magento\Framework\DataObject($websiteData); } return $websites; @@ -177,7 +177,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase continue; } $storeData = ['id' => $id, 'code' => $code]; - $stores[$id] = new \Magento\Framework\Object($storeData); + $stores[$id] = new \Magento\Framework\DataObject($storeData); } return $stores; diff --git a/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AbstractCustomerTest.php b/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AbstractCustomerTest.php index 9cec088afd5..ce747c47d4e 100644 --- a/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AbstractCustomerTest.php +++ b/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AbstractCustomerTest.php @@ -72,7 +72,7 @@ class AbstractCustomerTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\Framework\Data\Collection\EntityFactory', [], [], '', false) ); foreach ($this->_customers as $customer) { - $customerCollection->addItem(new \Magento\Framework\Object($customer)); + $customerCollection->addItem(new \Magento\Framework\DataObject($customer)); } $modelMock = $this->getMockBuilder('Magento\CustomerImportExport\Model\Import\AbstractCustomer') diff --git a/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AddressTest.php b/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AddressTest.php index f7c815c5e73..5234e871462 100644 --- a/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AddressTest.php +++ b/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AddressTest.php @@ -96,7 +96,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase protected $_customBehaviour = ['update_id' => 1, 'delete_id' => 2]; /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $_stringLib; @@ -111,7 +111,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_objectManagerMock = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->_stringLib = new \Magento\Framework\Stdlib\String(); + $this->_stringLib = new \Magento\Framework\Stdlib\StringUtils(); $this->_storeManager = $this->getMockBuilder('Magento\Store\Model\StoreManager') ->disableOriginalConstructor() ->setMethods(['getWebsites']) @@ -146,14 +146,14 @@ class AddressTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\Framework\Data\Collection\EntityFactory', [], [], '', false) ); foreach ($this->_addresses as $address) { - $addressCollection->addItem(new \Magento\Framework\Object($address)); + $addressCollection->addItem(new \Magento\Framework\DataObject($address)); } $regionCollection = new \Magento\Framework\Data\Collection( $this->getMock('Magento\Framework\Data\Collection\EntityFactory', [], [], '', false) ); foreach ($this->_regions as $region) { - $regionCollection->addItem(new \Magento\Framework\Object($region)); + $regionCollection->addItem(new \Magento\Framework\DataObject($region)); } $data = [ @@ -292,7 +292,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase continue; } $websiteData = ['id' => $id, 'code' => $code]; - $websites[$id] = new \Magento\Framework\Object($websiteData); + $websites[$id] = new \Magento\Framework\DataObject($websiteData); } return $websites; diff --git a/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/CustomerCompositeTest.php b/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/CustomerCompositeTest.php index 78738cb40ff..085a36afdb8 100644 --- a/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/CustomerCompositeTest.php +++ b/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/CustomerCompositeTest.php @@ -34,7 +34,7 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase protected $_addressAttributes = ['city', 'country', 'street']; /** - * @var \Magento\Framework\Stdlib\String|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Stdlib\StringUtils|\PHPUnit_Framework_MockObject_MockObject */ protected $_string; @@ -112,7 +112,7 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\Framework\App\Helper\Context', ['getTranslateInline'], [], '', false); $context->expects($this->any())->method('getTranslateInline')->will($this->returnValue($translateInline)); - $this->_string = new \Magento\Framework\Stdlib\String(); + $this->_string = new \Magento\Framework\Stdlib\StringUtils(); $this->_importFactory = $this->getMock( 'Magento\ImportExport\Model\ImportFactory', @@ -274,7 +274,7 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $attributeList = []; foreach ($this->_customerAttributes as $code) { - $attribute = new \Magento\Framework\Object(['attribute_code' => $code]); + $attribute = new \Magento\Framework\DataObject(['attribute_code' => $code]); $attributeList[] = $attribute; } $customerEntity->expects( @@ -309,7 +309,7 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $attributeList = []; foreach ($this->_addressAttributes as $code) { - $attribute = new \Magento\Framework\Object(['attribute_code' => $code]); + $attribute = new \Magento\Framework\DataObject(['attribute_code' => $code]); $attributeList[] = $attribute; } $addressEntity->expects( diff --git a/app/code/Magento/CustomerImportExport/Test/Unit/Model/Resource/Import/Customer/StorageTest.php b/app/code/Magento/CustomerImportExport/Test/Unit/Model/Resource/Import/Customer/StorageTest.php index 5b2403f8259..f74e35e22f5 100644 --- a/app/code/Magento/CustomerImportExport/Test/Unit/Model/Resource/Import/Customer/StorageTest.php +++ b/app/code/Magento/CustomerImportExport/Test/Unit/Model/Resource/Import/Customer/StorageTest.php @@ -60,7 +60,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase ->setMethods(['load', 'removeAttributeToSelect', 'getResource', 'getSelect']) ->getMock(); - $resourceStub = new \Magento\Framework\Object(); + $resourceStub = new \Magento\Framework\DataObject(); $resourceStub->setEntityTable($this->_entityTable); $customerCollection->expects($this->once())->method('getResource')->will($this->returnValue($resourceStub)); @@ -134,11 +134,11 @@ class StorageTest extends \PHPUnit_Framework_TestCase } /** - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function _addCustomerToStorage() { - $customer = new \Magento\Framework\Object(['id' => 1, 'website_id' => 1, 'email' => 'test@test.com']); + $customer = new \Magento\Framework\DataObject(['id' => 1, 'website_id' => 1, 'email' => 'test@test.com']); $this->_model->addCustomer($customer); return $customer; diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/Content.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/Content.php index 8810ee75c59..7de0e26ffd5 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/Content.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/Content.php @@ -29,7 +29,7 @@ class Content extends \Magento\Theme\Block\Adminhtml\Wysiwyg\Files\Content */ public function getFilebrowserSetupObject() { - $setupObject = new \Magento\Framework\Object(); + $setupObject = new \Magento\Framework\DataObject(); $setupObject->setData( [ diff --git a/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/ImageUploader.php b/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/ImageUploader.php index 6ce20cca1d2..b7b4d0595fb 100644 --- a/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/ImageUploader.php +++ b/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/ImageUploader.php @@ -10,7 +10,7 @@ use Magento\Framework\App\Filesystem\DirectoryList; /** * Quick style file uploader */ -class ImageUploader extends \Magento\Framework\Object +class ImageUploader extends \Magento\Framework\DataObject { /** * Quick style images path prefix diff --git a/app/code/Magento/DesignEditor/Test/Unit/Model/Editor/QuickStyles/RendererTest.php b/app/code/Magento/DesignEditor/Test/Unit/Model/Editor/QuickStyles/RendererTest.php index 85bcacce8cb..b51b6927356 100644 --- a/app/code/Magento/DesignEditor/Test/Unit/Model/Editor/QuickStyles/RendererTest.php +++ b/app/code/Magento/DesignEditor/Test/Unit/Model/Editor/QuickStyles/RendererTest.php @@ -25,7 +25,7 @@ class RendererTest extends \PHPUnit_Framework_TestCase false ); - $objectManager = $this->getMock('Magento\Framework\Object', ['get', 'toCss'], [], '', false); + $objectManager = $this->getMock('Magento\Framework\DataObject', ['get', 'toCss'], [], '', false); $objectManager->expects($this->exactly(4))->method('get')->will($this->returnValue($objectManager)); diff --git a/app/code/Magento/Developer/Model/View/Page/Config/ClientSideLessCompilation/Renderer.php b/app/code/Magento/Developer/Model/View/Page/Config/ClientSideLessCompilation/Renderer.php index edfbdcb5f63..25b2ef03049 100644 --- a/app/code/Magento/Developer/Model/View/Page/Config/ClientSideLessCompilation/Renderer.php +++ b/app/code/Magento/Developer/Model/View/Page/Config/ClientSideLessCompilation/Renderer.php @@ -22,7 +22,7 @@ class Renderer extends Config\Renderer * @param \Magento\Framework\View\Asset\MergeService $assetMergeService * @param \Magento\Framework\UrlInterface $urlBuilder * @param \Magento\Framework\Escaper $escaper - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Psr\Log\LoggerInterface $logger * @param \Magento\Framework\View\Asset\Repository $assetRepo */ @@ -31,7 +31,7 @@ class Renderer extends Config\Renderer \Magento\Framework\View\Asset\MergeService $assetMergeService, \Magento\Framework\UrlInterface $urlBuilder, \Magento\Framework\Escaper $escaper, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Psr\Log\LoggerInterface $logger, \Magento\Framework\View\Asset\Repository $assetRepo ) { diff --git a/app/code/Magento/Dhl/Model/Carrier.php b/app/code/Magento/Dhl/Model/Carrier.php index 498842814bd..7e29e2490a4 100644 --- a/app/code/Magento/Dhl/Model/Carrier.php +++ b/app/code/Magento/Dhl/Model/Carrier.php @@ -141,7 +141,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin /** * Core string * - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -209,7 +209,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * @param \Magento\Framework\Stdlib\DateTime\DateTime $coreDate * @param \Magento\Framework\Module\Dir\Reader $configReader * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\Math\Division $mathDivision * @param \Magento\Framework\Filesystem $filesystem * @param \Magento\Framework\Stdlib\DateTime $dateTime @@ -237,7 +237,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin \Magento\Framework\Stdlib\DateTime\DateTime $coreDate, \Magento\Framework\Module\Dir\Reader $configReader, \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\Math\Division $mathDivision, \Magento\Framework\Filesystem $filesystem, \Magento\Framework\Stdlib\DateTime $dateTime, @@ -299,10 +299,10 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin /** * Collect and get rates * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return bool|Result|null */ - public function collectRates(\Magento\Framework\Object $request) + public function collectRates(\Magento\Framework\DataObject $request) { if (!$this->getConfigFlag($this->_activeFlag)) { return false; @@ -360,10 +360,10 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin /** * Fills request object with Dhl config parameters * - * @param \Magento\Framework\Object $requestObject - * @return \Magento\Framework\Object + * @param \Magento\Framework\DataObject $requestObject + * @return \Magento\Framework\DataObject */ - protected function _addParams(\Magento\Framework\Object $requestObject) + protected function _addParams(\Magento\Framework\DataObject $requestObject) { foreach ($this->_requestVariables as $code => $objectCode) { if ($this->_request->getDhlId()) { @@ -379,17 +379,17 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin /** * Prepare and set request in property of current instance * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return $this * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - public function setRequest(\Magento\Framework\Object $request) + public function setRequest(\Magento\Framework\DataObject $request) { $this->_request = $request; $this->setStore($request->getStoreId()); - $requestObject = new \Magento\Framework\Object(); + $requestObject = new \Magento\Framework\DataObject(); $requestObject->setIsGenerateLabelReturn($request->getIsGenerateLabelReturn()); @@ -1027,7 +1027,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * Parse response from DHL web service * * @param string $response - * @return bool|\Magento\Framework\Object|Result|Error + * @return bool|\Magento\Framework\DataObject|Result|Error * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) @@ -1223,7 +1223,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * Get Country Params by Country Code * * @param string $countryCode - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject * * @see $countryCode ISO 3166 Codes (Countries) A2 */ @@ -1236,18 +1236,18 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin $this->_countryParams = $this->_xmlElFactory->create(['data' => $countriesXml]); } if (isset($this->_countryParams->{$countryCode})) { - $countryParams = new \Magento\Framework\Object($this->_countryParams->{$countryCode}->asArray()); + $countryParams = new \Magento\Framework\DataObject($this->_countryParams->{$countryCode}->asArray()); } - return isset($countryParams) ? $countryParams : new \Magento\Framework\Object(); + return isset($countryParams) ? $countryParams : new \Magento\Framework\DataObject(); } /** * Do shipment request to carrier web service, obtain Print Shipping Labels and process errors in response * - * @param \Magento\Framework\Object $request - * @return \Magento\Framework\Object + * @param \Magento\Framework\DataObject $request + * @return \Magento\Framework\DataObject */ - protected function _doShipmentRequest(\Magento\Framework\Object $request) + protected function _doShipmentRequest(\Magento\Framework\DataObject $request) { $this->_prepareShipmentRequest($request); $this->_mapRequestToShipment($request); @@ -1259,10 +1259,10 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin /** * Processing additional validation to check is carrier applicable. * - * @param \Magento\Framework\Object $request - * @return $this|\Magento\Framework\Object|boolean + * @param \Magento\Framework\DataObject $request + * @return $this|\Magento\Framework\DataObject|boolean */ - public function proccessAdditionalValidation(\Magento\Framework\Object $request) + public function proccessAdditionalValidation(\Magento\Framework\DataObject $request) { //Skip by item validation if there is no items in request if (!count($this->getAllItems($request))) { @@ -1312,11 +1312,11 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin /** * Return container types of carrier * - * @param \Magento\Framework\Object|null $params + * @param \Magento\Framework\DataObject|null $params * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function getContainerTypes(\Magento\Framework\Object $params = null) + public function getContainerTypes(\Magento\Framework\DataObject $params = null) { return [ self::DHL_CONTENT_TYPE_DOC => __('Documents'), @@ -1327,11 +1327,11 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin /** * Map request to shipment * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return void * @throws \Magento\Framework\Exception\LocalizedException */ - protected function _mapRequestToShipment(\Magento\Framework\Object $request) + protected function _mapRequestToShipment(\Magento\Framework\DataObject $request) { $request->setOrigCountryId($request->getShipperAddressCountryCode()); $this->setRawRequest($request); @@ -1382,7 +1382,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin /** * Do rate request and handle errors * - * @return Result|\Magento\Framework\Object + * @return Result|\Magento\Framework\DataObject * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) @@ -1878,7 +1878,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * Do request to shipment * * @param \Magento\Shipping\Model\Shipment\Request $request - * @return array|\Magento\Framework\Object + * @return array|\Magento\Framework\DataObject * @throws \Magento\Framework\Exception\LocalizedException */ public function requestToShipment($request) @@ -1889,7 +1889,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin } $result = $this->_doShipmentRequest($request); - $response = new \Magento\Framework\Object( + $response = new \Magento\Framework\DataObject( [ 'info' => [ [ @@ -1931,12 +1931,12 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * Prepare shipping label data * * @param \SimpleXMLElement $xml - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject * @throws \Magento\Framework\Exception\LocalizedException */ protected function _prepareShippingLabelContent(\SimpleXMLElement $xml) { - $result = new \Magento\Framework\Object(); + $result = new \Magento\Framework\DataObject(); try { if (!isset($xml->AirwayBillNumber) || !isset($xml->LabelImage->OutputImage)) { throw new \Magento\Framework\Exception\LocalizedException(__('Unable to retrieve shipping label')); diff --git a/app/code/Magento/Dhl/Model/Plugin/Rma/Block/Adminhtml/Rma/Edit/Tab/General/Shippingmethod.php b/app/code/Magento/Dhl/Model/Plugin/Rma/Block/Adminhtml/Rma/Edit/Tab/General/Shippingmethod.php index 572e64674b6..92045318ab8 100644 --- a/app/code/Magento/Dhl/Model/Plugin/Rma/Block/Adminhtml/Rma/Edit/Tab/General/Shippingmethod.php +++ b/app/code/Magento/Dhl/Model/Plugin/Rma/Block/Adminhtml/Rma/Edit/Tab/General/Shippingmethod.php @@ -24,11 +24,11 @@ class Shippingmethod } /** - * @param \Magento\Framework\Object $subject + * @param \Magento\Framework\DataObject $subject * @param bool $result * @return bool */ - public function afterCanDisplayCustomValue(\Magento\Framework\Object $subject, $result) + public function afterCanDisplayCustomValue(\Magento\Framework\DataObject $subject, $result) { $carrierCode = $subject->getShipment()->getCarrierCode(); if (!$carrierCode) { diff --git a/app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php b/app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php index d6cb174acf2..210100e9372 100644 --- a/app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php +++ b/app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php @@ -221,7 +221,7 @@ class CarrierTest extends \PHPUnit_Framework_TestCase /** * @param \SimpleXMLElement $xml - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function _invokePrepareShippingLabelContent(\SimpleXMLElement $xml) { diff --git a/app/code/Magento/Directory/Model/Country.php b/app/code/Magento/Directory/Model/Country.php index 3ba9d8ca20c..49553dec548 100644 --- a/app/code/Magento/Directory/Model/Country.php +++ b/app/code/Magento/Directory/Model/Country.php @@ -115,11 +115,11 @@ class Country extends \Magento\Framework\Model\AbstractModel } /** - * @param \Magento\Framework\Object $address + * @param \Magento\Framework\DataObject $address * @param bool $html * @return string */ - public function formatAddress(\Magento\Framework\Object $address, $html = false) + public function formatAddress(\Magento\Framework\DataObject $address, $html = false) { //TODO: is it still used? $address->getRegion(); diff --git a/app/code/Magento/Directory/Test/Unit/Helper/DataTest.php b/app/code/Magento/Directory/Test/Unit/Helper/DataTest.php index 922c288c996..8828b7cdbd7 100644 --- a/app/code/Magento/Directory/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/Directory/Test/Unit/Helper/DataTest.php @@ -103,8 +103,8 @@ class DataTest extends \PHPUnit_Framework_TestCase public function testGetRegionJson() { $countries = [ - new \Magento\Framework\Object(['country_id' => 'Country1']), - new \Magento\Framework\Object(['country_id' => 'Country2']) + new \Magento\Framework\DataObject(['country_id' => 'Country1']), + new \Magento\Framework\DataObject(['country_id' => 'Country2']) ]; $countryIterator = new \ArrayIterator($countries); $this->_countryCollection->expects( @@ -116,13 +116,13 @@ class DataTest extends \PHPUnit_Framework_TestCase ); $regions = [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( ['country_id' => 'Country1', 'region_id' => 'r1', 'code' => 'r1-code', 'name' => 'r1-name'] ), - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( ['country_id' => 'Country1', 'region_id' => 'r2', 'code' => 'r2-code', 'name' => 'r2-name'] ), - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( ['country_id' => 'Country2', 'region_id' => 'r3', 'code' => 'r3-code', 'name' => 'r3-name'] ) ]; diff --git a/app/code/Magento/Directory/Test/Unit/Model/Resource/Country/CollectionTest.php b/app/code/Magento/Directory/Test/Unit/Model/Resource/Country/CollectionTest.php index 4fc709b9878..8a117265702 100644 --- a/app/code/Magento/Directory/Test/Unit/Model/Resource/Country/CollectionTest.php +++ b/app/code/Magento/Directory/Test/Unit/Model/Resource/Country/CollectionTest.php @@ -79,7 +79,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase public function testToOptionArray($optionsArray, $emptyLabel, $foregroundCountries, $expectedResults) { foreach ($optionsArray as $itemData) { - $this->_model->addItem(new \Magento\Framework\Object($itemData)); + $this->_model->addItem(new \Magento\Framework\DataObject($itemData)); } $this->_model->setForegroundCountries($foregroundCountries); diff --git a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php index 1d2de7b95f9..1436fe67436 100644 --- a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php +++ b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php @@ -20,7 +20,7 @@ class Downloadable extends \Magento\Backend\Block\Widget implements \Magento\Bac protected $_product = null; /** - * @var \Magento\Framework\Object|null + * @var \Magento\Framework\DataObject|null */ protected $_config = null; diff --git a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php index bb986e14a26..224233a9035 100644 --- a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php +++ b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php @@ -16,7 +16,7 @@ class Links extends \Magento\Backend\Block\Template /** * Block config data * - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $_config; @@ -332,7 +332,7 @@ class Links extends \Magento\Backend\Block\Template if ($this->getProduct()->getStoreId() && $priceWebsiteScope) { $tmpLinkItem['website_price'] = $item->getWebsitePrice(); } - $linkArr[] = new \Magento\Framework\Object($tmpLinkItem); + $linkArr[] = new \Magento\Framework\DataObject($tmpLinkItem); } return $linkArr; } @@ -436,12 +436,12 @@ class Links extends \Magento\Backend\Block\Template /** * Retrieve config object * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getConfig() { if ($this->_config === null) { - $this->_config = new \Magento\Framework\Object(); + $this->_config = new \Magento\Framework\DataObject(); } return $this->_config; diff --git a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php index 2b91bbc55a3..ce2e80e7d33 100644 --- a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php +++ b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php @@ -15,7 +15,7 @@ class Samples extends \Magento\Backend\Block\Widget /** * Block config data * - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $_config; @@ -179,7 +179,7 @@ class Samples extends \Magento\Backend\Block\Widget if ($this->getProduct() && $item->getStoreTitle()) { $tmpSampleItem['store_title'] = $item->getStoreTitle(); } - $samplesArr[] = new \Magento\Framework\Object($tmpSampleItem); + $samplesArr[] = new \Magento\Framework\DataObject($tmpSampleItem); } return $samplesArr; @@ -264,12 +264,12 @@ class Samples extends \Magento\Backend\Block\Widget /** * Retrieve config object * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getConfig() { if ($this->_config === null) { - $this->_config = new \Magento\Framework\Object(); + $this->_config = new \Magento\Framework\DataObject(); } return $this->_config; diff --git a/app/code/Magento/Downloadable/Block/Sales/Order/Item/Renderer/Downloadable.php b/app/code/Magento/Downloadable/Block/Sales/Order/Item/Renderer/Downloadable.php index 7176465cae4..e7333af9fcd 100644 --- a/app/code/Magento/Downloadable/Block/Sales/Order/Item/Renderer/Downloadable.php +++ b/app/code/Magento/Downloadable/Block/Sales/Order/Item/Renderer/Downloadable.php @@ -32,7 +32,7 @@ class Downloadable extends \Magento\Sales\Block\Order\Item\Renderer\DefaultRende /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory * @param \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory * @param \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory @@ -40,7 +40,7 @@ class Downloadable extends \Magento\Sales\Block\Order\Item\Renderer\DefaultRende */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, diff --git a/app/code/Magento/Downloadable/Model/Observer.php b/app/code/Magento/Downloadable/Model/Observer.php index 68dc8f018d7..d360b69e220 100644 --- a/app/code/Magento/Downloadable/Model/Observer.php +++ b/app/code/Magento/Downloadable/Model/Observer.php @@ -50,7 +50,7 @@ class Observer protected $_itemsFactory; /** - * @var \Magento\Framework\Object\Copy + * @var \Magento\Framework\DataObject\Copy */ protected $_objectCopyService; @@ -61,7 +61,7 @@ class Observer * @param \Magento\Downloadable\Model\Link\Purchased\ItemFactory $itemFactory * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory - * @param \Magento\Framework\Object\Copy $objectCopyService + * @param \Magento\Framework\DataObject\Copy $objectCopyService */ public function __construct( \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, @@ -70,7 +70,7 @@ class Observer \Magento\Downloadable\Model\Link\Purchased\ItemFactory $itemFactory, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, - \Magento\Framework\Object\Copy $objectCopyService + \Magento\Framework\DataObject\Copy $objectCopyService ) { $this->_scopeConfig = $scopeConfig; $this->_purchasedFactory = $purchasedFactory; @@ -84,7 +84,7 @@ class Observer /** * Prepare product to save * - * @param \Magento\Framework\Object $observer + * @param \Magento\Framework\DataObject $observer * @return $this */ public function prepareProductSave($observer) @@ -102,7 +102,7 @@ class Observer /** * Save data from order to purchased links * - * @param \Magento\Framework\Object $observer + * @param \Magento\Framework\DataObject $observer * @return $this * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) @@ -197,7 +197,7 @@ class Observer /** * Set checkout session flag if order has downloadable product(s) * - * @param \Magento\Framework\Object $observer + * @param \Magento\Framework\DataObject $observer * @return $this */ public function setHasDownloadableProducts($observer) @@ -223,7 +223,7 @@ class Observer /** * Set status of link * - * @param \Magento\Framework\Object $observer + * @param \Magento\Framework\DataObject $observer * @return $this * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) diff --git a/app/code/Magento/Downloadable/Model/Product/Type.php b/app/code/Magento/Downloadable/Model/Product/Type.php index e34c9bdf1b5..5f3ae6140d7 100644 --- a/app/code/Magento/Downloadable/Model/Product/Type.php +++ b/app/code/Magento/Downloadable/Model/Product/Type.php @@ -268,7 +268,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\Virtual parent::checkProductBuyState($product); $option = $product->getCustomOption('info_buyRequest'); if ($option instanceof \Magento\Quote\Model\Quote\Item\Option) { - $buyRequest = new \Magento\Framework\Object(unserialize($option->getValue())); + $buyRequest = new \Magento\Framework\DataObject(unserialize($option->getValue())); if (!$buyRequest->hasLinks()) { if (!$product->getLinksPurchasedSeparately()) { $allLinksIds = $this->_linksFactory->create()->addProductToFilter($product->getId())->getAllIds(); @@ -381,7 +381,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\Virtual * Prepare selected options for downloadable product * * @param \Magento\Catalog\Model\Product $product - * @param \Magento\Framework\Object $buyRequest + * @param \Magento\Framework\DataObject $buyRequest * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -451,14 +451,14 @@ class Type extends \Magento\Catalog\Model\Product\Type\Virtual * Prepare product and its configuration to be added to some products list. * Perform standard preparation process and then prepare options for downloadable links. * - * @param \Magento\Framework\Object $buyRequest + * @param \Magento\Framework\DataObject $buyRequest * @param \Magento\Catalog\Model\Product $product * @param string $processMode * @return \Magento\Framework\Phrase|array|string * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - protected function _prepareProduct(\Magento\Framework\Object $buyRequest, $product, $processMode) + protected function _prepareProduct(\Magento\Framework\DataObject $buyRequest, $product, $processMode) { $result = parent::_prepareProduct($buyRequest, $product, $processMode); diff --git a/app/code/Magento/Downloadable/Model/Product/TypeHandler/AbstractTypeHandler.php b/app/code/Magento/Downloadable/Model/Product/TypeHandler/AbstractTypeHandler.php index 0285320b2d2..604cdef2de5 100644 --- a/app/code/Magento/Downloadable/Model/Product/TypeHandler/AbstractTypeHandler.php +++ b/app/code/Magento/Downloadable/Model/Product/TypeHandler/AbstractTypeHandler.php @@ -133,9 +133,10 @@ abstract class AbstractTypeHandler */ protected function getFiles(array $item) { - $files = isset($item[self::FIELD_FILE]) - ? $this->jsonHelper->jsonDecode($item[self::FIELD_FILE]) - : []; + $files = []; + if (isset($item[self::FIELD_FILE]) && $item[self::FIELD_FILE]) { + $files = $this->jsonHelper->jsonDecode($item[self::FIELD_FILE]); + } return $files; } diff --git a/app/code/Magento/Downloadable/Model/Product/TypeHandler/Link.php b/app/code/Magento/Downloadable/Model/Product/TypeHandler/Link.php index a67390b2e3e..959d620e1d1 100644 --- a/app/code/Magento/Downloadable/Model/Product/TypeHandler/Link.php +++ b/app/code/Magento/Downloadable/Model/Product/TypeHandler/Link.php @@ -163,7 +163,7 @@ class Link extends AbstractTypeHandler $model->setSampleUrl($this->sampleItem['url']); } $model->setSampleType($this->sampleItem['type']); - if (isset($this->sampleItem['file'])) { + if (isset($this->sampleItem['file']) && $this->sampleItem['file']) { $sampleFile = $this->jsonHelper->jsonDecode($this->sampleItem['file']); } } diff --git a/app/code/Magento/Downloadable/Model/Product/TypeTransitionManager/Plugin/Downloadable.php b/app/code/Magento/Downloadable/Model/Product/TypeTransitionManager/Plugin/Downloadable.php index 8c9735e32a5..19cc68b641a 100644 --- a/app/code/Magento/Downloadable/Model/Product/TypeTransitionManager/Plugin/Downloadable.php +++ b/app/code/Magento/Downloadable/Model/Product/TypeTransitionManager/Plugin/Downloadable.php @@ -57,7 +57,7 @@ class Downloadable foreach ($data as $rowData) { if (empty($rowData['is_delete'])) { $hasDownloadableData = true; - break; + break 2; } } } diff --git a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php index 98b2f5cdc1c..09b443ba426 100644 --- a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php +++ b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php @@ -11,7 +11,7 @@ namespace Magento\Downloadable\Model\Sales\Order\Pdf\Items; class Creditmemo extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\AbstractItems { /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -24,7 +24,7 @@ class Creditmemo extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Abstr * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory * @param \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection * @param array $data @@ -39,7 +39,7 @@ class Creditmemo extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Abstr \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [] diff --git a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php index 61732c5695a..a6f4343bace 100644 --- a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php +++ b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php @@ -11,7 +11,7 @@ namespace Magento\Downloadable\Model\Sales\Order\Pdf\Items; class Invoice extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\AbstractItems { /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -24,7 +24,7 @@ class Invoice extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Abstract * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory * @param \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection * @param array $data @@ -39,7 +39,7 @@ class Invoice extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Abstract \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [] diff --git a/app/code/Magento/Downloadable/Test/Unit/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinksTest.php b/app/code/Magento/Downloadable/Test/Unit/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinksTest.php index a634cb3f4af..55d6a01d9da 100644 --- a/app/code/Magento/Downloadable/Test/Unit/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinksTest.php +++ b/app/code/Magento/Downloadable/Test/Unit/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinksTest.php @@ -134,11 +134,11 @@ class LinksTest extends \PHPUnit_Framework_TestCase } /** - * Test that getConfig method retrieve \Magento\Framework\Object object + * Test that getConfig method retrieve \Magento\Framework\DataObject object */ public function testGetConfig() { - $this->assertInstanceOf('Magento\Framework\Object', $this->block->getConfig()); + $this->assertInstanceOf('Magento\Framework\DataObject', $this->block->getConfig()); } public function testGetLinkData() diff --git a/app/code/Magento/Downloadable/Test/Unit/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/SamplesTest.php b/app/code/Magento/Downloadable/Test/Unit/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/SamplesTest.php index c07b49221d9..136385e6138 100644 --- a/app/code/Magento/Downloadable/Test/Unit/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/SamplesTest.php +++ b/app/code/Magento/Downloadable/Test/Unit/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/SamplesTest.php @@ -123,11 +123,11 @@ class SamplesTest extends \PHPUnit_Framework_TestCase } /** - * Test that getConfig method retrieve \Magento\Framework\Object object + * Test that getConfig method retrieve \Magento\Framework\DataObject object */ public function testGetConfig() { - $this->assertInstanceOf('Magento\Framework\Object', $this->block->getConfig()); + $this->assertInstanceOf('Magento\Framework\DataObject', $this->block->getConfig()); } public function testGetSampleData() diff --git a/app/code/Magento/Downloadable/Test/Unit/Model/ObserverTest.php b/app/code/Magento/Downloadable/Test/Unit/Model/ObserverTest.php index e6b4a44cd5d..fa9d0358ebe 100644 --- a/app/code/Magento/Downloadable/Test/Unit/Model/ObserverTest.php +++ b/app/code/Magento/Downloadable/Test/Unit/Model/ObserverTest.php @@ -53,17 +53,17 @@ class ObserverTest extends \PHPUnit_Framework_TestCase private $itemsFactory; /** - * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Object\Copy + * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\DataObject\Copy */ private $objectCopyService; /** - * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Object + * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\DataObject */ private $resultMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Object + * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\DataObject */ private $storeMock; @@ -114,16 +114,16 @@ class ObserverTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $this->objectCopyService = $this->getMockBuilder('\Magento\Framework\Object\Copy') + $this->objectCopyService = $this->getMockBuilder('\Magento\Framework\DataObject\Copy') ->disableOriginalConstructor() ->getMock(); - $this->resultMock = $this->getMockBuilder('\Magento\Framework\Object') + $this->resultMock = $this->getMockBuilder('\Magento\Framework\DataObject') ->disableOriginalConstructor() ->setMethods(['setIsAllowed']) ->getMock(); - $this->storeMock = $this->getMockBuilder('\Magento\Framework\Object') + $this->storeMock = $this->getMockBuilder('\Magento\Framework\DataObject') ->disableOriginalConstructor() ->getMock(); @@ -575,12 +575,12 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->purchasedFactory->expects($this->any()) ->method('create') ->willReturn($purchasedLink); - $event = new \Magento\Framework\Object( + $event = new \Magento\Framework\DataObject( [ 'item' => $itemMock, ] ); - $observer = new \Magento\Framework\Object( + $observer = new \Magento\Framework\DataObject( [ 'event' => $event ] @@ -602,12 +602,12 @@ class ObserverTest extends \PHPUnit_Framework_TestCase ->willReturn('simple'); $itemMock->expects($this->never()) ->method('getProduct'); - $event = new \Magento\Framework\Object( + $event = new \Magento\Framework\DataObject( [ 'item' => $itemMock, ] ); - $observer = new \Magento\Framework\Object( + $observer = new \Magento\Framework\DataObject( [ 'event' => $event ] @@ -623,12 +623,12 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $itemMock->expects($this->any()) ->method('getId') ->willReturn(null); - $event = new \Magento\Framework\Object( + $event = new \Magento\Framework\DataObject( [ 'item' => $itemMock, ] ); - $observer = new \Magento\Framework\Object( + $observer = new \Magento\Framework\DataObject( [ 'event' => $event ] @@ -664,12 +664,12 @@ class ObserverTest extends \PHPUnit_Framework_TestCase ->method('create') ->willReturn($purchasedLink); - $event = new \Magento\Framework\Object( + $event = new \Magento\Framework\DataObject( [ 'item' => $itemMock, ] ); - $observer = new \Magento\Framework\Object( + $observer = new \Magento\Framework\DataObject( [ 'event' => $event ] diff --git a/app/code/Magento/Downloadable/Test/Unit/Model/Sales/Order/Pdf/Items/CreditmemoTest.php b/app/code/Magento/Downloadable/Test/Unit/Model/Sales/Order/Pdf/Items/CreditmemoTest.php index 5cca484119b..022d621aa91 100644 --- a/app/code/Magento/Downloadable/Test/Unit/Model/Sales/Order/Pdf/Items/CreditmemoTest.php +++ b/app/code/Magento/Downloadable/Test/Unit/Model/Sales/Order/Pdf/Items/CreditmemoTest.php @@ -93,7 +93,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase $modelConstructorArgs = $objectManager->getConstructArguments( 'Magento\Downloadable\Model\Sales\Order\Pdf\Items\Creditmemo', - ['string' => new \Magento\Framework\Stdlib\String(), 'filterManager' => $filterManager] + ['string' => new \Magento\Framework\Stdlib\StringUtils(), 'filterManager' => $filterManager] ); $this->_model = $this->getMock( @@ -151,7 +151,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase ]; $this->_model->setItem( - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'name' => 'Downloadable Documentation', 'sku' => 'downloadable-documentation', @@ -160,7 +160,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase 'qty' => 1, 'tax_amount' => 2.00, 'discount_tax_compensation_amount' => 0.00, - 'order_item' => new \Magento\Framework\Object( + 'order_item' => new \Magento\Framework\DataObject( [ 'product_options' => [ 'options' => [['label' => 'Test Custom Option', 'value' => 'test value']], @@ -177,9 +177,9 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase 'getLinks' )->will( $this->returnValue( - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( ['purchased_items' => [ - new \Magento\Framework\Object(['link_title' => 'Magento User Guide']), ], + new \Magento\Framework\DataObject(['link_title' => 'Magento User Guide']), ], ] ) ) diff --git a/app/code/Magento/Downloadable/etc/fieldset.xml b/app/code/Magento/Downloadable/etc/fieldset.xml index b3a01b2a4d7..42dd53dc686 100644 --- a/app/code/Magento/Downloadable/etc/fieldset.xml +++ b/app/code/Magento/Downloadable/etc/fieldset.xml @@ -6,7 +6,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Object/etc/fieldset.xsd"> + xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/DataObject/etc/fieldset.xsd"> <scope id="global"> <fieldset id="downloadable_sales_copy_order"> <field name="entity_id"> diff --git a/app/code/Magento/Eav/Api/Data/AttributeValidationRuleInterface.php b/app/code/Magento/Eav/Api/Data/AttributeValidationRuleInterface.php index 45200a293cb..89fdf854cd0 100644 --- a/app/code/Magento/Eav/Api/Data/AttributeValidationRuleInterface.php +++ b/app/code/Magento/Eav/Api/Data/AttributeValidationRuleInterface.php @@ -6,6 +6,6 @@ */ namespace Magento\Eav\Api\Data; -interface AttributeValidationRuleInterface extends \Magento\Framework\Object\KeyValueObjectInterface +interface AttributeValidationRuleInterface extends \Magento\Framework\DataObject\KeyValueObjectInterface { } diff --git a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Options.php b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Options.php index d25fdcc5d8b..5e1578ba024 100644 --- a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Options.php +++ b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Options.php @@ -136,7 +136,7 @@ class Options extends \Magento\Backend\Block\Template $defaultValues ); foreach ($bunch as $value) { - $values[] = new \Magento\Framework\Object($value); + $values[] = new \Magento\Framework\DataObject($value); } } diff --git a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Grid/AbstractGrid.php b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Grid/AbstractGrid.php index 5c54828b740..2579c838524 100644 --- a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Grid/AbstractGrid.php +++ b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Grid/AbstractGrid.php @@ -96,7 +96,7 @@ abstract class AbstractGrid extends \Magento\Backend\Block\Widget\Grid\Extended /** * Return url of given row * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ public function getRowUrl($row) diff --git a/app/code/Magento/Eav/Model/Attribute/Data/Text.php b/app/code/Magento/Eav/Model/Attribute/Data/Text.php index 4826543c56f..f3a8ed17350 100644 --- a/app/code/Magento/Eav/Model/Attribute/Data/Text.php +++ b/app/code/Magento/Eav/Model/Attribute/Data/Text.php @@ -15,7 +15,7 @@ use Magento\Framework\App\RequestInterface; class Text extends \Magento\Eav\Model\Attribute\Data\AbstractData { /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $_string; @@ -23,13 +23,13 @@ class Text extends \Magento\Eav\Model\Attribute\Data\AbstractData * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Psr\Log\LoggerInterface $logger * @param \Magento\Framework\Locale\ResolverInterface $localeResolver - * @param \Magento\Framework\Stdlib\String $stringHelper + * @param \Magento\Framework\Stdlib\StringUtils $stringHelper */ public function __construct( \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Psr\Log\LoggerInterface $logger, \Magento\Framework\Locale\ResolverInterface $localeResolver, - \Magento\Framework\Stdlib\String $stringHelper + \Magento\Framework\Stdlib\StringUtils $stringHelper ) { parent::__construct($localeDate, $logger, $localeResolver); $this->_string = $stringHelper; @@ -129,6 +129,7 @@ class Text extends \Magento\Eav\Model\Attribute\Data\AbstractData * * @param string $format * @return string|array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function outputValue($format = \Magento\Eav\Model\AttributeDataFactory::OUTPUT_FORMAT_TEXT) { diff --git a/app/code/Magento/Eav/Model/AttributeDataFactory.php b/app/code/Magento/Eav/Model/AttributeDataFactory.php index 84e3a099faa..a3863f04027 100644 --- a/app/code/Magento/Eav/Model/AttributeDataFactory.php +++ b/app/code/Magento/Eav/Model/AttributeDataFactory.php @@ -42,15 +42,15 @@ class AttributeDataFactory protected $_objectManager; /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; /** * @param \Magento\Framework\ObjectManagerInterface $objectManager - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string */ - public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager, \Magento\Framework\Stdlib\String $string) + public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager, \Magento\Framework\Stdlib\StringUtils $string) { $this->_objectManager = $objectManager; $this->string = $string; diff --git a/app/code/Magento/Eav/Model/Config.php b/app/code/Magento/Eav/Model/Config.php index 96482c7bcbb..82979ba1850 100644 --- a/app/code/Magento/Eav/Model/Config.php +++ b/app/code/Magento/Eav/Model/Config.php @@ -459,7 +459,7 @@ class Config * Get codes of all entity type attributes * * @param mixed $entityType - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return array * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) @@ -469,7 +469,7 @@ class Config $entityType = $this->getEntityType($entityType); $attributeSetId = 0; $storeId = 0; - if ($object instanceof \Magento\Framework\Object) { + if ($object instanceof \Magento\Framework\DataObject) { $attributeSetId = $object->getAttributeSetId() ?: $attributeSetId; $storeId = $object->getStoreId() ?: $storeId; } diff --git a/app/code/Magento/Eav/Model/EavCustomAttributeTypeLocator.php b/app/code/Magento/Eav/Model/EavCustomAttributeTypeLocator.php index 2a5063d0d00..489d1c30489 100644 --- a/app/code/Magento/Eav/Model/EavCustomAttributeTypeLocator.php +++ b/app/code/Magento/Eav/Model/EavCustomAttributeTypeLocator.php @@ -21,7 +21,7 @@ class EavCustomAttributeTypeLocator implements CustomAttributeTypeLocatorInterfa private $attributeRepository; /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ private $stringUtility; @@ -39,7 +39,7 @@ class EavCustomAttributeTypeLocator implements CustomAttributeTypeLocatorInterfa * Initialize EavCustomAttributeTypeLocator * * @param AttributeRepositoryInterface $attributeRepository Attribute repository service - * @param \Magento\Framework\Stdlib\String $stringUtility + * @param \Magento\Framework\Stdlib\StringUtils $stringUtility * @param array $serviceEntityTypeMap Service Entity Map * <pre> * [ @@ -60,7 +60,7 @@ class EavCustomAttributeTypeLocator implements CustomAttributeTypeLocatorInterfa */ public function __construct( AttributeRepositoryInterface $attributeRepository, - \Magento\Framework\Stdlib\String $stringUtility, + \Magento\Framework\Stdlib\StringUtils $stringUtility, array $serviceEntityTypeMap = [], array $serviceBackendModelDataInterfaceMap = [] ) { diff --git a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php index 99ee114dd97..72ff523a36c 100644 --- a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php +++ b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php @@ -574,7 +574,7 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract /** * Retrieve configuration for all attributes * - * @param null|\Magento\Framework\Object $object + * @param null|\Magento\Framework\DataObject $object * @return $this */ public function loadAllAttributes($object = null) @@ -654,7 +654,7 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract /** * Check whether the attribute is Applicable to the object * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @param AbstractAttribute $attribute * @return bool * @SuppressWarnings(PHPMD.UnusedFormalParameter) @@ -898,7 +898,7 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract /** * Validate all object's attributes against configuration * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @throws \Magento\Eav\Model\Entity\Attribute\Exception * @return bool|array */ @@ -924,10 +924,10 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract /** * Set new increment id to object * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ - public function setNewIncrementId(\Magento\Framework\Object $object) + public function setNewIncrementId(\Magento\Framework\DataObject $object) { if ($object->getIncrementId()) { return $this; @@ -946,7 +946,7 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract * Check attribute unique value * * @param AbstractAttribute $attribute - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return bool */ public function checkAttributeUniqueValue(AbstractAttribute $attribute, $object) @@ -1104,7 +1104,7 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract /** * Retrieve select object for loading base entity row * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @param string|int $rowId * @return \Zend_Db_Select * @SuppressWarnings(PHPMD.UnusedFormalParameter) @@ -1124,7 +1124,7 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract /** * Retrieve select object for loading entity attributes values * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @param string $table * @return \Zend_Db_Select */ @@ -1144,7 +1144,7 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract /** * Initialize attribute value for object * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @param array $valueRow * @return $this */ @@ -1217,8 +1217,8 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract /** * Retrieve Object instance with original data * - * @param \Magento\Framework\Object $object - * @return \Magento\Framework\Object + * @param \Magento\Framework\DataObject $object + * @return \Magento\Framework\DataObject */ protected function _getOrigObject($object) { @@ -1457,7 +1457,7 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract /** * Process base row */ - $entityObject = new \Magento\Framework\Object($entityRow); + $entityObject = new \Magento\Framework\DataObject($entityRow); $entityRow = $this->_prepareDataForTable($entityObject, $entityTable); if ($insertEntity) { if (!empty($entityId)) { @@ -1512,7 +1512,7 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract /** * Insert entity attribute value * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @param AbstractAttribute $attribute * @param mixed $value * @return $this @@ -1525,7 +1525,7 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract /** * Update entity attribute value * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @param AbstractAttribute $attribute * @param mixed $valueId * @param mixed $value @@ -1620,10 +1620,10 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract /** * Delete entity attribute values * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @param string $table * @param array $info - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ protected function _deleteAttributes($object, $table, $info) @@ -1649,13 +1649,13 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract /** * Save attribute * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @param string $attributeCode * @return $this * @throws \Exception * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - public function saveAttribute(\Magento\Framework\Object $object, $attributeCode) + public function saveAttribute(\Magento\Framework\DataObject $object, $attributeCode) { $attribute = $this->getAttribute($attributeCode); $backend = $attribute->getBackend(); @@ -1701,8 +1701,8 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract /** * Return attribute row to prepare where statement * - * @param \Magento\Framework\Object $entity - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $entity + * @param \Magento\Framework\DataObject $object * @param \Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute * @return array */ @@ -1723,7 +1723,7 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract /** * Delete entity using current object's data * - * @param \Magento\Framework\Object|int|string $object + * @param \Magento\Framework\DataObject|int|string $object * @return $this * @throws \Exception * @SuppressWarnings(PHPMD.UnusedLocalVariable) @@ -1777,10 +1777,10 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract /** * After Load Entity process * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ - protected function _afterLoad(\Magento\Framework\Object $object) + protected function _afterLoad(\Magento\Framework\DataObject $object) { \Magento\Framework\Profiler::start('after_load'); $this->walkAttributes('backend/afterLoad', [$object]); @@ -1791,10 +1791,10 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract /** * Before delete Entity process * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ - protected function _beforeSave(\Magento\Framework\Object $object) + protected function _beforeSave(\Magento\Framework\DataObject $object) { $this->walkAttributes('backend/beforeSave', [$object]); return $this; @@ -1803,10 +1803,10 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract /** * After Save Entity process * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ - protected function _afterSave(\Magento\Framework\Object $object) + protected function _afterSave(\Magento\Framework\DataObject $object) { $this->walkAttributes('backend/afterSave', [$object]); return $this; @@ -1815,10 +1815,10 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract /** * Before Delete Entity process * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ - protected function _beforeDelete(\Magento\Framework\Object $object) + protected function _beforeDelete(\Magento\Framework\DataObject $object) { $this->walkAttributes('backend/beforeDelete', [$object]); return $this; @@ -1827,10 +1827,10 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract /** * After delete entity process * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ - protected function _afterDelete(\Magento\Framework\Object $object) + protected function _afterDelete(\Magento\Framework\DataObject $object) { $this->walkAttributes('backend/afterDelete', [$object]); return $this; diff --git a/app/code/Magento/Eav/Model/Entity/Attribute.php b/app/code/Magento/Eav/Model/Entity/Attribute.php index 12ee3803ffa..a672ffe8e2b 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute.php @@ -16,7 +16,7 @@ use Magento\Framework\Api\AttributeValueFactory; * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute implements - \Magento\Framework\Object\IdentityInterface + \Magento\Framework\DataObject\IdentityInterface { /** * Attribute code max length diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php index aa010892c64..f6e7433f084 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php @@ -152,7 +152,7 @@ abstract class AbstractBackend implements \Magento\Eav\Model\Entity\Attribute\Ba /** * Set entity value id * - * @param \Magento\Framework\Object $entity + * @param \Magento\Framework\DataObject $entity * @param int $valueId * @return $this */ @@ -179,7 +179,7 @@ abstract class AbstractBackend implements \Magento\Eav\Model\Entity\Attribute\Ba /** * Get entity value id * - * @param \Magento\Framework\Object $entity + * @param \Magento\Framework\DataObject $entity * @return int */ public function getEntityValueId($entity) @@ -212,7 +212,7 @@ abstract class AbstractBackend implements \Magento\Eav\Model\Entity\Attribute\Ba /** * Validate object * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return bool * @throws LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) @@ -246,7 +246,7 @@ abstract class AbstractBackend implements \Magento\Eav\Model\Entity\Attribute\Ba /** * After load method * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -258,7 +258,7 @@ abstract class AbstractBackend implements \Magento\Eav\Model\Entity\Attribute\Ba /** * Before save method * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function beforeSave($object) @@ -274,7 +274,7 @@ abstract class AbstractBackend implements \Magento\Eav\Model\Entity\Attribute\Ba /** * After save method * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -286,7 +286,7 @@ abstract class AbstractBackend implements \Magento\Eav\Model\Entity\Attribute\Ba /** * Before delete method * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -298,7 +298,7 @@ abstract class AbstractBackend implements \Magento\Eav\Model\Entity\Attribute\Ba /** * After delete method * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -310,7 +310,7 @@ abstract class AbstractBackend implements \Magento\Eav\Model\Entity\Attribute\Ba /** * Retrieve data for update attribute * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return array */ public function getAffectedFields($object) diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/ArrayBackend.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/ArrayBackend.php index 9f2fea9f055..7d1098fee93 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/ArrayBackend.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/ArrayBackend.php @@ -15,7 +15,7 @@ class ArrayBackend extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractB /** * Prepare data for save * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend */ public function beforeSave($object) diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/BackendInterface.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/BackendInterface.php index bd6b445bfc7..e3c260b8032 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/BackendInterface.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/BackendInterface.php @@ -46,31 +46,31 @@ interface BackendInterface public function getValueId(); /** - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function afterLoad($object); /** - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function beforeSave($object); /** - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function afterSave($object); /** - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function beforeDelete($object); /** - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function afterDelete($object); @@ -78,7 +78,7 @@ interface BackendInterface /** * Get entity value id * - * @param \Magento\Framework\Object $entity + * @param \Magento\Framework\DataObject $entity * @return int */ public function getEntityValueId($entity); @@ -86,7 +86,7 @@ interface BackendInterface /** * Set entity value id * - * @param \Magento\Framework\Object $entity + * @param \Magento\Framework\DataObject $entity * @param int $valueId * @return $this */ diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php index 44506721a83..179122454e5 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php @@ -29,7 +29,7 @@ class Datetime extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacke * Should set (bool, string) correct type for empty value from html form, * necessary for further process, else date string * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @throws \Magento\Framework\Exception\LocalizedException * @return $this */ diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Increment.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Increment.php index ed86ce2c5c0..5b56a83080f 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Increment.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Increment.php @@ -15,7 +15,7 @@ class Increment extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBack /** * Set new increment id * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function beforeSave($object) diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Serialized.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Serialized.php index 765ad3a9eed..b58198da1ef 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Serialized.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Serialized.php @@ -13,7 +13,7 @@ class Serialized extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBac /** * Serialize before saving * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function beforeSave($object) @@ -30,7 +30,7 @@ class Serialized extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBac /** * Unserialize after saving * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function afterSave($object) @@ -43,7 +43,7 @@ class Serialized extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBac /** * Unserialize after loading * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function afterLoad($object) @@ -56,10 +56,10 @@ class Serialized extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBac /** * Try to unserialize the attribute value * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ - protected function _unserialize(\Magento\Framework\Object $object) + protected function _unserialize(\Magento\Framework\DataObject $object) { $attrCode = $this->getAttribute()->getAttributeCode(); if ($object->getData($attrCode)) { diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Store.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Store.php index a9f56c983ac..a0d8c0dc32e 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Store.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Store.php @@ -23,7 +23,7 @@ class Store extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Prepare data before save * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ protected function _beforeSave($object) diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Updated.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Updated.php index d889eb031c5..83bc047f45c 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Updated.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Updated.php @@ -26,7 +26,7 @@ class Updated extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacken /** * Set modified date * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function beforeSave($object) diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php b/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php index 626ec8112cb..66dcb877caa 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php @@ -83,10 +83,10 @@ abstract class AbstractFrontend implements \Magento\Eav\Model\Entity\Attribute\F /** * Retrieve attribute value * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return mixed */ - public function getValue(\Magento\Framework\Object $object) + public function getValue(\Magento\Framework\DataObject $object) { $value = $object->getData($this->getAttribute()->getAttributeCode()); if (in_array($this->getConfigField('input'), ['select', 'boolean'])) { diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/Datetime.php b/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/Datetime.php index 715d8677614..ad53d8b6792 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/Datetime.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/Datetime.php @@ -30,10 +30,10 @@ class Datetime extends \Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFron /** * Retrieve attribute value * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return mixed */ - public function getValue(\Magento\Framework\Object $object) + public function getValue(\Magento\Framework\DataObject $object) { $data = ''; $value = parent::getValue($object); diff --git a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php index 8048bc59000..5927f6432bd 100644 --- a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php +++ b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php @@ -273,7 +273,7 @@ abstract class AbstractCollection extends AbstractDb implements SourceProviderIn /** * Set template object for the collection * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function setObject($object = null) @@ -289,11 +289,11 @@ abstract class AbstractCollection extends AbstractDb implements SourceProviderIn /** * Add an object to the collection * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this * @throws LocalizedException */ - public function addItem(\Magento\Framework\Object $object) + public function addItem(\Magento\Framework\DataObject $object) { if (!$object instanceof $this->_itemObjectClass) { throw new LocalizedException(__('Attempt to add an invalid object')); diff --git a/app/code/Magento/Eav/Model/Entity/Collection/VersionControl/AbstractCollection.php b/app/code/Magento/Eav/Model/Entity/Collection/VersionControl/AbstractCollection.php index 57e071e2f84..cd7e24dcc38 100644 --- a/app/code/Magento/Eav/Model/Entity/Collection/VersionControl/AbstractCollection.php +++ b/app/code/Magento/Eav/Model/Entity/Collection/VersionControl/AbstractCollection.php @@ -73,7 +73,7 @@ abstract class AbstractCollection extends \Magento\Eav\Model\Entity\Collection\A /** * @inheritdoc */ - protected function beforeAddLoadedItem(\Magento\Framework\Object $item) + protected function beforeAddLoadedItem(\Magento\Framework\DataObject $item) { $this->entitySnapshot->registerSnapshot($item); return $item; diff --git a/app/code/Magento/Eav/Model/Entity/Increment/AbstractIncrement.php b/app/code/Magento/Eav/Model/Entity/Increment/AbstractIncrement.php index 7f7fc8ed4a5..05e3b2d32cd 100644 --- a/app/code/Magento/Eav/Model/Entity/Increment/AbstractIncrement.php +++ b/app/code/Magento/Eav/Model/Entity/Increment/AbstractIncrement.php @@ -15,7 +15,7 @@ */ namespace Magento\Eav\Model\Entity\Increment; -abstract class AbstractIncrement extends \Magento\Framework\Object implements +abstract class AbstractIncrement extends \Magento\Framework\DataObject implements \Magento\Eav\Model\Entity\Increment\IncrementInterface { /** diff --git a/app/code/Magento/Eav/Model/Entity/VersionControl/AbstractEntity.php b/app/code/Magento/Eav/Model/Entity/VersionControl/AbstractEntity.php index 781c1baae9a..57e6f3b696c 100644 --- a/app/code/Magento/Eav/Model/Entity/VersionControl/AbstractEntity.php +++ b/app/code/Magento/Eav/Model/Entity/VersionControl/AbstractEntity.php @@ -41,7 +41,7 @@ abstract class AbstractEntity extends \Magento\Eav\Model\Entity\AbstractEntity /** * @inheritdoc */ - protected function _afterLoad(\Magento\Framework\Object $object) + protected function _afterLoad(\Magento\Framework\DataObject $object) { $this->entitySnapshot->registerSnapshot($object); return parent::_afterLoad($object); diff --git a/app/code/Magento/Eav/Model/Entity/VersionControl/Metadata.php b/app/code/Magento/Eav/Model/Entity/VersionControl/Metadata.php index c628f450b7a..a87d475c8ad 100644 --- a/app/code/Magento/Eav/Model/Entity/VersionControl/Metadata.php +++ b/app/code/Magento/Eav/Model/Entity/VersionControl/Metadata.php @@ -13,10 +13,10 @@ class Metadata extends \Magento\Framework\Model\Resource\Db\VersionControl\Metad /** * Returns list of entity fields that are applicable for persistence operations * - * @param \Magento\Framework\Object $entity + * @param \Magento\Framework\DataObject $entity * @return array */ - public function getFields(\Magento\Framework\Object $entity) + public function getFields(\Magento\Framework\DataObject $entity) { $entityClass = get_class($entity); if (!isset($this->metadataInfo[$entityClass])) { diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Store.php b/app/code/Magento/Eav/Model/Resource/Entity/Store.php index c9bcdee8551..f6a684f4e30 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Store.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Store.php @@ -6,7 +6,7 @@ namespace Magento\Eav\Model\Resource\Entity; use Magento\Framework\Model\AbstractModel; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Eav Entity store resource model diff --git a/app/code/Magento/Eav/Model/Validator/Attribute/Data.php b/app/code/Magento/Eav/Model/Validator/Attribute/Data.php index fcd3db3efff..883ca66f6a8 100644 --- a/app/code/Magento/Eav/Model/Validator/Attribute/Data.php +++ b/app/code/Magento/Eav/Model/Validator/Attribute/Data.php @@ -114,7 +114,7 @@ class Data extends \Magento\Framework\Validator\AbstractValidator $data = []; if ($this->_data) { $data = $this->_data; - } elseif ($entity instanceof \Magento\Framework\Object) { + } elseif ($entity instanceof \Magento\Framework\DataObject) { $data = $entity->getData(); } diff --git a/app/code/Magento/Eav/Test/Unit/Helper/DataTest.php b/app/code/Magento/Eav/Test/Unit/Helper/DataTest.php index 48b79461dc2..3e211cc8f4a 100644 --- a/app/code/Magento/Eav/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/Eav/Test/Unit/Helper/DataTest.php @@ -61,10 +61,10 @@ class DataTest extends \PHPUnit_Framework_TestCase public function testGetAttributeMetadata() { - $attribute = new \Magento\Framework\Object([ + $attribute = new \Magento\Framework\DataObject([ 'entity_type_id' => '1', 'attribute_id' => '2', - 'backend' => new \Magento\Framework\Object(['table' => 'customer_entity_varchar']), + 'backend' => new \Magento\Framework\DataObject(['table' => 'customer_entity_varchar']), 'backend_type' => 'varchar', ]); $this->eavConfig->expects($this->once()) diff --git a/app/code/Magento/Eav/Test/Unit/Model/Attribute/Data/AbstractDataTest.php b/app/code/Magento/Eav/Test/Unit/Model/Attribute/Data/AbstractDataTest.php index dea0ef0f1e4..b9f8df67497 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Attribute/Data/AbstractDataTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Attribute/Data/AbstractDataTest.php @@ -22,7 +22,7 @@ class AbstractDataTest extends \PHPUnit_Framework_TestCase $timezoneMock = $this->getMock('\Magento\Framework\Stdlib\DateTime\TimezoneInterface'); $loggerMock = $this->getMock('\Psr\Log\LoggerInterface', [], [], '', false); $localeResolverMock = $this->getMock('\Magento\Framework\Locale\ResolverInterface'); - $stringMock = $this->getMock('\Magento\Framework\Stdlib\String', [], [], '', false); + $stringMock = $this->getMock('\Magento\Framework\Stdlib\StringUtils', [], [], '', false); /* testing abstract model through its child */ $this->model = new Text($timezoneMock, $loggerMock, $localeResolverMock, $stringMock); diff --git a/app/code/Magento/Eav/Test/Unit/Model/Attribute/Data/MultilineTest.php b/app/code/Magento/Eav/Test/Unit/Model/Attribute/Data/MultilineTest.php index c4ec4af0505..128b15b1bc3 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Attribute/Data/MultilineTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Attribute/Data/MultilineTest.php @@ -22,7 +22,7 @@ class MultilineTest extends \PHPUnit_Framework_TestCase $timezoneMock = $this->getMock('\Magento\Framework\Stdlib\DateTime\TimezoneInterface'); $loggerMock = $this->getMock('\Psr\Log\LoggerInterface', [], [], '', false); $localeResolverMock = $this->getMock('\Magento\Framework\Locale\ResolverInterface'); - $this->stringMock = $this->getMock('\Magento\Framework\Stdlib\String', [], [], '', false); + $this->stringMock = $this->getMock('\Magento\Framework\Stdlib\StringUtils', [], [], '', false); $this->model = new \Magento\Eav\Model\Attribute\Data\Multiline( $timezoneMock, diff --git a/app/code/Magento/Eav/Test/Unit/Model/Attribute/Data/TextTest.php b/app/code/Magento/Eav/Test/Unit/Model/Attribute/Data/TextTest.php index ab5c732a100..f559db7a93b 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Attribute/Data/TextTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Attribute/Data/TextTest.php @@ -31,7 +31,7 @@ class TextTest extends \PHPUnit_Framework_TestCase false ); $logger = $this->getMock('Psr\Log\LoggerInterface'); - $helper = $this->getMock('Magento\Framework\Stdlib\String', [], [], '', false, false); + $helper = $this->getMock('Magento\Framework\Stdlib\StringUtils', [], [], '', false, false); $attributeData = [ 'store_label' => 'Test', diff --git a/app/code/Magento/Eav/Test/Unit/Model/ConfigTest.php b/app/code/Magento/Eav/Test/Unit/Model/ConfigTest.php index 2d5119df63c..dbf47f01cff 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/ConfigTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/ConfigTest.php @@ -6,7 +6,7 @@ namespace Magento\Eav\Test\Unit\Model; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Eav\Model\Config; class ConfigTest extends \PHPUnit_Framework_TestCase @@ -114,7 +114,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ->with(Config::ATTRIBUTES_CACHE_ID) ->willReturn($cachedValue); - $collectionStub = new Object([ + $collectionStub = new DataObject([ ['entity_type_code' => 'type_code_1', 'entity_type_id' => 1], ]); $this->collectionFactoryMock @@ -125,7 +125,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->typeFactoryMock ->expects($this->any()) ->method('create') - ->willReturn(new Object(['id' => 101])); + ->willReturn(new DataObject(['id' => 101])); $this->universalFactoryMock ->expects($this->atLeastOnce()) diff --git a/app/code/Magento/Eav/Test/Unit/Model/EavCustomAttributeTypeLocatorTest.php b/app/code/Magento/Eav/Test/Unit/Model/EavCustomAttributeTypeLocatorTest.php index 9dc2a03464e..2a7db2a3b38 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/EavCustomAttributeTypeLocatorTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/EavCustomAttributeTypeLocatorTest.php @@ -43,7 +43,7 @@ class EavCustomAttributeTypeLocatorTest extends \PHPUnit_Framework_TestCase * @param string $attributeCode * @param string $serviceClass * @param array $attributeRepositoryResponse - * @param \Magento\Framework\Stdlib\String $stringUtility, + * @param \Magento\Framework\Stdlib\StringUtils $stringUtility, * @param array $serviceEntityTypeMapData * @param array $serviceBackendModelDataInterfaceMapData * @param string $expected @@ -118,7 +118,7 @@ class EavCustomAttributeTypeLocatorTest extends \PHPUnit_Framework_TestCase ->method('getFrontendInput') ->willReturn('image'); - $stringUtility = new \Magento\Framework\Stdlib\String(); + $stringUtility = new \Magento\Framework\Stdlib\StringUtils(); return [ [ @@ -193,7 +193,7 @@ class EavCustomAttributeTypeLocatorTest extends \PHPUnit_Framework_TestCase $this->eavCustomAttributeTypeLocator = new EavCustomAttributeTypeLocator( $this->attributeRepository, - new \Magento\Framework\Stdlib\String(), + new \Magento\Framework\Stdlib\StringUtils(), [], [] ); @@ -205,7 +205,7 @@ class EavCustomAttributeTypeLocatorTest extends \PHPUnit_Framework_TestCase public function testGetAllServiceDataInterfaceEmpty() { - $stringUtility = new \Magento\Framework\Stdlib\String(); + $stringUtility = new \Magento\Framework\Stdlib\StringUtils(); $this->eavCustomAttributeTypeLocator = new EavCustomAttributeTypeLocator( $this->attributeRepository, $stringUtility @@ -220,7 +220,7 @@ class EavCustomAttributeTypeLocatorTest extends \PHPUnit_Framework_TestCase 'ServiceB' => ['BackendB' => 'ServiceDataInterfaceB', 'BackendC' => 'ServiceDataInterfaceC'], 'ServiceC' => ['BackendD' => 'ServiceDataInterfaceD'] ]; - $stringUtility = new \Magento\Framework\Stdlib\String(); + $stringUtility = new \Magento\Framework\Stdlib\StringUtils(); $this->eavCustomAttributeTypeLocator = new EavCustomAttributeTypeLocator( $this->attributeRepository, $stringUtility, [], $serviceBackendModelDataInterfaceMapData ); diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/AbstractEntityTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/AbstractEntityTest.php index cce1b9d07a0..1145e45ceb8 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/AbstractEntityTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/AbstractEntityTest.php @@ -221,7 +221,7 @@ class AbstractEntityTest extends \PHPUnit_Framework_TestCase } $object->expects($this->any())->method('getOrigData')->will($this->returnValue($productOrigData)); - $entityType = new \Magento\Framework\Object(); + $entityType = new \Magento\Framework\DataObject(); $entityType->setEntityTypeCode('test'); $entityType->setEntityTypeId(0); $entityType->setEntityTable('table'); diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Backend/AbstractTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Backend/AbstractTest.php index 37c9ed23639..afeffe631da 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Backend/AbstractTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Backend/AbstractTest.php @@ -42,7 +42,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $this->_model->setAttribute($attribute); - $object = new \Magento\Framework\Object(); + $object = new \Magento\Framework\DataObject(); $this->_model->setValueId($valueId); $this->assertEquals( diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Backend/ArrayTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Backend/ArrayTest.php index fb022688643..0144dc19ab9 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Backend/ArrayTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Backend/ArrayTest.php @@ -37,7 +37,7 @@ class ArrayTest extends \PHPUnit_Framework_TestCase public function testValidate($data) { $this->_attribute->expects($this->atLeastOnce())->method('getAttributeCode')->will($this->returnValue('code')); - $product = new \Magento\Framework\Object(['code' => $data]); + $product = new \Magento\Framework\DataObject(['code' => $data]); $this->_model->validate($product); $this->assertEquals('1,2,3', $product->getCode()); } diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Frontend/DatetimeTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Frontend/DatetimeTest.php index d7a86c6ad49..f28fe8386ee 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Frontend/DatetimeTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Frontend/DatetimeTest.php @@ -50,7 +50,7 @@ class DatetimeTest extends \PHPUnit_Framework_TestCase ); $this->attributeMock->expects($this->any())->method('getAttributeCode')->will($this->returnValue('datetime')); - $this->model = new \Magento\Eav\Model\Entity\Attribute\Frontend\Datetime($this->booleanFactoryMock, $this->localeDateMock); + $this->model = new Datetime($this->booleanFactoryMock, $this->localeDateMock); $this->model->setAttribute($this->attributeMock); } @@ -58,7 +58,7 @@ class DatetimeTest extends \PHPUnit_Framework_TestCase { $attributeValue = '11-11-2011'; $date = new \DateTime($attributeValue); - $object = new \Magento\Framework\Object(['datetime' => $attributeValue]); + $object = new \Magento\Framework\DataObject(['datetime' => $attributeValue]); $this->attributeMock->expects($this->any())->method('getData')->with('frontend_input') ->will($this->returnValue('text')); diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Collection/AbstractCollectionStub.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Collection/AbstractCollectionStub.php index d31d6cda259..edd9fe9c9f5 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Collection/AbstractCollectionStub.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Collection/AbstractCollectionStub.php @@ -11,7 +11,7 @@ class AbstractCollectionStub extends \Magento\Eav\Model\Entity\Collection\Abstra * Retrieve item by id * * @param mixed $id - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getItemById($id) { @@ -28,6 +28,6 @@ class AbstractCollectionStub extends \Magento\Eav\Model\Entity\Collection\Abstra */ protected function _construct() { - return $this->_init('Magento\Framework\Object', 'test_entity_model'); + return $this->_init('Magento\Framework\DataObject', 'test_entity_model'); } } diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Collection/AbstractCollectionTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Collection/AbstractCollectionTest.php index 4d89903528b..8613708656c 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Collection/AbstractCollectionTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Collection/AbstractCollectionTest.php @@ -219,6 +219,6 @@ class AbstractCollectionTest extends \PHPUnit_Framework_TestCase public function getMagentoObject() { - return new \Magento\Framework\Object(); + return new \Magento\Framework\DataObject(); } } diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Collection/VersionControl/AbstractCollectionStub.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Collection/VersionControl/AbstractCollectionStub.php index ab2aa4dacd9..3c95b84b1b4 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Collection/VersionControl/AbstractCollectionStub.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Collection/VersionControl/AbstractCollectionStub.php @@ -14,7 +14,7 @@ class AbstractCollectionStub extends \Magento\Eav\Model\Entity\Collection\Versio * Retrieve item by id * * @param mixed $id - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getItemById($id) { @@ -31,6 +31,6 @@ class AbstractCollectionStub extends \Magento\Eav\Model\Entity\Collection\Versio */ protected function _construct() { - return $this->_init('Magento\Framework\Object', 'test_entity_model'); + return $this->_init('Magento\Framework\DataObject', 'test_entity_model'); } } diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/VersionControl/AbstractEntityTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/VersionControl/AbstractEntityTest.php index 9c1865c483f..21c4102cfde 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/VersionControl/AbstractEntityTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/VersionControl/AbstractEntityTest.php @@ -70,7 +70,7 @@ class AbstractEntityTest extends \Magento\Eav\Test\Unit\Model\Entity\AbstractEnt } $object->expects($this->any())->method('getOrigData')->will($this->returnValue($productOrigData)); - $entityType = new \Magento\Framework\Object(); + $entityType = new \Magento\Framework\DataObject(); $entityType->setEntityTypeCode('test'); $entityType->setEntityTypeId(0); $entityType->setEntityTable('table'); diff --git a/app/code/Magento/Eav/Test/Unit/Model/FormTest.php b/app/code/Magento/Eav/Test/Unit/Model/FormTest.php index 7901d6a7dd6..0809087e219 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/FormTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/FormTest.php @@ -32,7 +32,7 @@ class FormTest extends \PHPUnit_Framework_TestCase protected $_userAttribute = null; /** - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $_entity = null; @@ -47,10 +47,10 @@ class FormTest extends \PHPUnit_Framework_TestCase ['_getFilteredFormAttributeCollection', '_getValidator', 'getEntity'] )->disableOriginalConstructor()->getMock(); - $this->_userAttribute = new \Magento\Framework\Object( + $this->_userAttribute = new \Magento\Framework\DataObject( ['is_user_defined' => true, 'attribute_code' => 'attribute_visible_user', 'is_visible' => true] ); - $this->_systemAttribute = new \Magento\Framework\Object( + $this->_systemAttribute = new \Magento\Framework\DataObject( ['is_user_defined' => false, 'attribute_code' => 'attribute_invisible_system', 'is_visible' => false] ); $this->_attributes = [$this->_userAttribute, $this->_systemAttribute]; @@ -62,7 +62,7 @@ class FormTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->_attributes) ); - $this->_entity = new \Magento\Framework\Object(['id' => 1, 'attribute_visible_user' => 'abc']); + $this->_entity = new \Magento\Framework\DataObject(['id' => 1, 'attribute_visible_user' => 'abc']); $this->_model->expects($this->any())->method('getEntity')->will($this->returnValue($this->_entity)); } diff --git a/app/code/Magento/Eav/Test/Unit/Model/Resource/Entity/AttributeTest.php b/app/code/Magento/Eav/Test/Unit/Model/Resource/Entity/AttributeTest.php index bcc3efc76a9..7b5a4f5d9ef 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Resource/Entity/AttributeTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Resource/Entity/AttributeTest.php @@ -254,8 +254,8 @@ class AttributeTest extends \PHPUnit_Framework_TestCase true )->will( $this->returnValue([ - new \Magento\Framework\Object(['id' => 0]), - new \Magento\Framework\Object(['id' => 1]), ] + new \Magento\Framework\DataObject(['id' => 0]), + new \Magento\Framework\DataObject(['id' => 1]), ] ) ); diff --git a/app/code/Magento/Eav/Test/Unit/Model/Validator/Attribute/BackendTest.php b/app/code/Magento/Eav/Test/Unit/Model/Validator/Attribute/BackendTest.php index 581864a62a5..fa9096a3c2c 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Validator/Attribute/BackendTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Validator/Attribute/BackendTest.php @@ -30,7 +30,7 @@ class BackendTest extends \PHPUnit_Framework_TestCase public function testisValidIfProvidedModelIsIncorrect() { $this->model->isValid( - $this->getMock('\Magento\Framework\Object', [], [], '', false) + $this->getMock('\Magento\Framework\DataObject', [], [], '', false) ); } @@ -40,7 +40,7 @@ class BackendTest extends \PHPUnit_Framework_TestCase */ public function testisValidIfProvidedResourceModelIsIncorrect() { - $resourceMock = $this->getMock('\Magento\Framework\Object', [], [], '', false); + $resourceMock = $this->getMock('\Magento\Framework\DataObject', [], [], '', false); $this->entityMock->expects($this->once())->method('getResource')->willReturn($resourceMock); $this->model->isValid($this->entityMock); } diff --git a/app/code/Magento/Eav/Test/Unit/Model/Validator/Attribute/DataTest.php b/app/code/Magento/Eav/Test/Unit/Model/Validator/Attribute/DataTest.php index 0f93917659d..e8c80df9efb 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Validator/Attribute/DataTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Validator/Attribute/DataTest.php @@ -36,7 +36,7 @@ class DataTest extends \PHPUnit_Framework_TestCase ['create'], [ 'objectManager' => $this->getMock('Magento\Framework\ObjectManagerInterface'), - 'string' => $this->getMock('Magento\Framework\Stdlib\String') + 'string' => $this->getMock('Magento\Framework\Stdlib\StringUtils') ] ); @@ -140,9 +140,9 @@ class DataTest extends \PHPUnit_Framework_TestCase 'frontend_input' => 'text', ] ); - $collection = $this->getMockBuilder('Magento\Framework\Object')->setMethods(['getItems'])->getMock(); + $collection = $this->getMockBuilder('Magento\Framework\DataObject')->setMethods(['getItems'])->getMock(); $collection->expects($this->once())->method('getItems')->will($this->returnValue([$attribute])); - $entityType = $this->getMockBuilder('Magento\Framework\Object') + $entityType = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods(['getAttributeCollection']) ->getMock(); $entityType->expects($this->once())->method('getAttributeCollection')->will($this->returnValue($collection)); @@ -155,7 +155,7 @@ class DataTest extends \PHPUnit_Framework_TestCase ['create'], [ 'objectManager' => $this->getMock('Magento\Framework\ObjectManagerInterface'), - 'string' => $this->getMock('Magento\Framework\Stdlib\String') + 'string' => $this->getMock('Magento\Framework\Stdlib\StringUtils') ] ); $attrDataFactory->expects( @@ -202,7 +202,7 @@ class DataTest extends \PHPUnit_Framework_TestCase ['create'], [ 'objectManager' => $this->getMock('Magento\Framework\ObjectManagerInterface'), - 'string' => $this->getMock('Magento\Framework\Stdlib\String') + 'string' => $this->getMock('Magento\Framework\Stdlib\StringUtils') ] ); $attrDataFactory->expects( @@ -244,7 +244,7 @@ class DataTest extends \PHPUnit_Framework_TestCase [], [ 'objectManager' => $this->getMock('Magento\Framework\ObjectManagerInterface'), - 'string' => $this->getMock('Magento\Framework\Stdlib\String') + 'string' => $this->getMock('Magento\Framework\Stdlib\StringUtils') ] ); $validator = new \Magento\Eav\Model\Validator\Attribute\Data($attrDataFactory); @@ -261,7 +261,7 @@ class DataTest extends \PHPUnit_Framework_TestCase [], [ 'objectManager' => $this->getMock('Magento\Framework\ObjectManagerInterface'), - 'string' => $this->getMock('Magento\Framework\Stdlib\String') + 'string' => $this->getMock('Magento\Framework\Stdlib\StringUtils') ] ); $validator = new \Magento\Eav\Model\Validator\Attribute\Data($attrDataFactory); @@ -295,7 +295,7 @@ class DataTest extends \PHPUnit_Framework_TestCase ['create'], [ 'objectManager' => $this->getMock('Magento\Framework\ObjectManagerInterface'), - 'string' => $this->getMock('Magento\Framework\Stdlib\String') + 'string' => $this->getMock('Magento\Framework\Stdlib\StringUtils') ] ); $validator = new \Magento\Eav\Model\Validator\Attribute\Data($factory); diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Action.php b/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Action.php index 241ad6c19fa..c397b8aeaee 100644 --- a/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Action.php +++ b/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Action.php @@ -15,10 +15,10 @@ class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Action /** * Render grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $actions = []; @@ -53,7 +53,7 @@ class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Action protected function _actionsToHtml(array $actions) { $html = []; - $attributesObject = new \Magento\Framework\Object(); + $attributesObject = new \Magento\Framework\DataObject(); foreach ($actions as $action) { $attributesObject->setData($action['@']); $html[] = '<a ' . $attributesObject->serialize() . '>' . $action['#'] . '</a>'; diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Sender.php b/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Sender.php index f6854cbfd29..24a157be401 100644 --- a/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Sender.php +++ b/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Sender.php @@ -15,10 +15,10 @@ class Sender extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstract /** * Render grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $str = ''; diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Type.php b/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Type.php index 1578c2db4ee..88a4ccc5dd7 100644 --- a/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Type.php +++ b/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Type.php @@ -25,10 +25,10 @@ class Type extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRe /** * Render grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return \Magento\Framework\Phrase */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $str = __('Unknown'); diff --git a/app/code/Magento/Email/Model/AbstractTemplate.php b/app/code/Magento/Email/Model/AbstractTemplate.php index 308e3273ea6..da78d861418 100644 --- a/app/code/Magento/Email/Model/AbstractTemplate.php +++ b/app/code/Magento/Email/Model/AbstractTemplate.php @@ -52,7 +52,7 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn /** * Configuration of design package for template * - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ private $designConfig; @@ -73,7 +73,7 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn /** * Configuration of emulated design package. * - * @var \Magento\Framework\Object|boolean + * @var \Magento\Framework\DataObject|boolean */ private $emulatedDesignConfig = false; @@ -576,7 +576,7 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn /** * Get design configuration data * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getDesignConfig() { @@ -587,7 +587,7 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn if ($this->store === null) { $this->store = $this->storeManager->getStore()->getId(); } - $this->designConfig = new \Magento\Framework\Object( + $this->designConfig = new \Magento\Framework\DataObject( ['area' => $this->area, 'store' => $this->store] ); } diff --git a/app/code/Magento/Email/Model/Template/Filter.php b/app/code/Magento/Email/Model/Template/Filter.php index 64946825a5c..793394c44a9 100644 --- a/app/code/Magento/Email/Model/Template/Filter.php +++ b/app/code/Magento/Email/Model/Template/Filter.php @@ -146,7 +146,7 @@ class Filter extends \Magento\Framework\Filter\Template protected $emogrifier; /** - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Psr\Log\LoggerInterface $logger * @param \Magento\Framework\Escaper $escaper * @param \Magento\Framework\View\Asset\Repository $assetRepo @@ -163,7 +163,7 @@ class Filter extends \Magento\Framework\Filter\Template * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Psr\Log\LoggerInterface $logger, \Magento\Framework\Escaper $escaper, \Magento\Framework\View\Asset\Repository $assetRepo, diff --git a/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/ActionTest.php b/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/ActionTest.php index b1c163befab..4e69e532aaf 100644 --- a/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/ActionTest.php +++ b/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/ActionTest.php @@ -41,7 +41,7 @@ class ActionTest extends \PHPUnit_Framework_TestCase ->method('getActions') ->willReturn(''); $this->action->setColumn($this->columnMock); - $row = new \Magento\Framework\Object(); + $row = new \Magento\Framework\DataObject(); $this->assertEquals(' ', $this->action->render($row)); } @@ -56,7 +56,7 @@ class ActionTest extends \PHPUnit_Framework_TestCase ->method('getActions') ->willReturn(['url', 'popup', 'caption']); $this->action->setColumn($this->columnMock); - $row = new \Magento\Framework\Object(); + $row = new \Magento\Framework\DataObject(); $row->setId(1); $this->assertContains('admin__control-select', $this->action->render($row)); } diff --git a/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/SenderTest.php b/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/SenderTest.php index 572b341759f..e42303f8901 100644 --- a/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/SenderTest.php +++ b/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/SenderTest.php @@ -26,7 +26,7 @@ class SenderTest extends \PHPUnit_Framework_TestCase */ public function testRenderName() { - $row = new \Magento\Framework\Object(); + $row = new \Magento\Framework\DataObject(); $row->setTemplateSenderName('Sender Name'); $this->assertEquals('Sender Name ', $this->sender->render($row)); } @@ -36,7 +36,7 @@ class SenderTest extends \PHPUnit_Framework_TestCase */ public function testRenderEmail() { - $row = new \Magento\Framework\Object(); + $row = new \Magento\Framework\DataObject(); $row->setTemplateSenderEmail('Sender Email'); $this->assertEquals('[Sender Email]', $this->sender->render($row)); } @@ -46,7 +46,7 @@ class SenderTest extends \PHPUnit_Framework_TestCase */ public function testRenderNameAndEmail() { - $row = new \Magento\Framework\Object(); + $row = new \Magento\Framework\DataObject(); $row->setTemplateSenderName('Sender Name'); $row->setTemplateSenderEmail('Sender Email'); $this->assertEquals('Sender Name [Sender Email]', $this->sender->render($row)); @@ -57,7 +57,7 @@ class SenderTest extends \PHPUnit_Framework_TestCase */ public function testRenderEmpty() { - $row = new \Magento\Framework\Object(); + $row = new \Magento\Framework\DataObject(); $this->assertEquals('---', $this->sender->render($row)); } } diff --git a/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/TypeTest.php b/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/TypeTest.php index 0e91708653a..0e7287ec082 100644 --- a/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/TypeTest.php +++ b/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/TypeTest.php @@ -26,7 +26,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase */ public function testRenderHtml() { - $row = new \Magento\Framework\Object(); + $row = new \Magento\Framework\DataObject(); $row->setTemplateType(\Magento\Framework\App\TemplateTypesInterface::TYPE_HTML); $this->assertEquals('HTML', $this->type->render($row)); } @@ -36,7 +36,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase */ public function testRenderText() { - $row = new \Magento\Framework\Object(); + $row = new \Magento\Framework\DataObject(); $row->setTemplateType(\Magento\Framework\App\TemplateTypesInterface::TYPE_TEXT); $this->assertEquals('Text', $this->type->render($row)); } @@ -46,7 +46,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase */ public function testRenderUnknown() { - $row = new \Magento\Framework\Object(); + $row = new \Magento\Framework\DataObject(); $row->setTemplateType('xx'); $this->assertEquals('Unknown', $this->type->render($row)); } diff --git a/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/PreviewTest.php b/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/PreviewTest.php index 6116a201304..599c1b81010 100644 --- a/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/PreviewTest.php +++ b/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/PreviewTest.php @@ -58,7 +58,7 @@ class PreviewTest extends \PHPUnit_Framework_TestCase ]; $template->expects($this->atLeastOnce()) ->method('getDesignConfig') - ->will($this->returnValue(new \Magento\Framework\Object( + ->will($this->returnValue(new \Magento\Framework\DataObject( $designConfigData ))); $emailFactory = $this->getMock('Magento\Email\Model\TemplateFactory', ['create'], [], '', false); diff --git a/app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php b/app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php index 5994d69332b..764b9cff0e5 100644 --- a/app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php +++ b/app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php @@ -16,7 +16,7 @@ class FilterTest extends \PHPUnit_Framework_TestCase private $objectManager; /** - * @var \Magento\Framework\Stdlib\String|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Stdlib\StringUtils|\PHPUnit_Framework_MockObject_MockObject */ private $string; @@ -79,7 +79,7 @@ class FilterTest extends \PHPUnit_Framework_TestCase { $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->string = $this->getMockBuilder('\Magento\Framework\Stdlib\String') + $this->string = $this->getMockBuilder('\Magento\Framework\Stdlib\StringUtils') ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Email/Test/Unit/Model/TemplateTest.php b/app/code/Magento/Email/Test/Unit/Model/TemplateTest.php index b216d421cc7..1214fad6405 100644 --- a/app/code/Magento/Email/Test/Unit/Model/TemplateTest.php +++ b/app/code/Magento/Email/Test/Unit/Model/TemplateTest.php @@ -180,7 +180,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase ->will($this->returnSelf()); $this->filterFactory->method('create') ->will($this->returnValue($filterTemplate)); - $designConfig = $this->getMockBuilder('Magento\Framework\Object') + $designConfig = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods(['getStore']) ->disableOriginalConstructor() ->getMock(); @@ -342,7 +342,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase 'setTemplateText', ]); - $designConfig = $this->getMockBuilder('Magento\Framework\Object') + $designConfig = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods(['getStore']) ->disableOriginalConstructor() ->getMock(); @@ -517,7 +517,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase $model->expects($this->once()) ->method('applyDesignConfig'); - $designConfig = $this->getMockBuilder('Magento\Framework\Object') + $designConfig = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods(['getStore']) ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Fedex/Model/Carrier.php b/app/code/Magento/Fedex/Model/Carrier.php index 69d52fead5b..3e13cd0a6f9 100644 --- a/app/code/Magento/Fedex/Model/Carrier.php +++ b/app/code/Magento/Fedex/Model/Carrier.php @@ -240,10 +240,10 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C /** * Collect and get rates * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return Result|bool|null */ - public function collectRates(\Magento\Framework\Object $request) + public function collectRates(\Magento\Framework\DataObject $request) { if (!$this->getConfigFlag($this->_activeFlag)) { return false; @@ -269,7 +269,7 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C { $this->_request = $request; - $r = new \Magento\Framework\Object(); + $r = new \Magento\Framework\DataObject(); if ($request->getLimitMethod()) { $r->setService($request->getLimitMethod()); @@ -983,7 +983,7 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C */ protected function setTrackingReqeust() { - $r = new \Magento\Framework\Object(); + $r = new \Magento\Framework\DataObject(); $account = $this->getConfigData('account'); $r->setAccount($account); @@ -1220,13 +1220,13 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C /** * Form array with appropriate structure for shipment request * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return array * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - protected function _formShipmentRequest(\Magento\Framework\Object $request) + protected function _formShipmentRequest(\Magento\Framework\DataObject $request) { if ($request->getReferenceData()) { $referenceData = $request->getReferenceData() . $request->getPackageId(); @@ -1250,7 +1250,7 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C $productIds = []; $packageItems = $request->getPackageItems(); foreach ($packageItems as $itemShipment) { - $item = new \Magento\Framework\Object(); + $item = new \Magento\Framework\DataObject(); $item->setData($itemShipment); $unitPrice += $item->getPrice(); @@ -1390,13 +1390,13 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C /** * Do shipment request to carrier web service, obtain Print Shipping Labels and process errors in response * - * @param \Magento\Framework\Object $request - * @return \Magento\Framework\Object + * @param \Magento\Framework\DataObject $request + * @return \Magento\Framework\DataObject */ - protected function _doShipmentRequest(\Magento\Framework\Object $request) + protected function _doShipmentRequest(\Magento\Framework\DataObject $request) { $this->_prepareShipmentRequest($request); - $result = new \Magento\Framework\Object(); + $result = new \Magento\Framework\DataObject(); $client = $this->_createShipSoapClient(); $requestClient = $this->_formShipmentRequest($request); $response = $client->processShipment($requestClient); @@ -1452,11 +1452,11 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C /** * Return container types of carrier * - * @param \Magento\Framework\Object|null $params + * @param \Magento\Framework\DataObject|null $params * @return array|bool * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - public function getContainerTypes(\Magento\Framework\Object $params = null) + public function getContainerTypes(\Magento\Framework\DataObject $params = null) { if ($params == null) { return $this->_getAllowedContainers($params); @@ -1517,11 +1517,11 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C /** * Return delivery confirmation types of carrier * - * @param \Magento\Framework\Object|null $params + * @param \Magento\Framework\DataObject|null $params * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function getDeliveryConfirmationTypes(\Magento\Framework\Object $params = null) + public function getDeliveryConfirmationTypes(\Magento\Framework\DataObject $params = null) { return $this->getCode('delivery_confirmation_types'); } diff --git a/app/code/Magento/Fedex/Model/Plugin/Rma/Block/Adminhtml/Rma/Edit/Tab/General/Shippingmethod.php b/app/code/Magento/Fedex/Model/Plugin/Rma/Block/Adminhtml/Rma/Edit/Tab/General/Shippingmethod.php index 9cdc90c4cea..d93ff85e1da 100644 --- a/app/code/Magento/Fedex/Model/Plugin/Rma/Block/Adminhtml/Rma/Edit/Tab/General/Shippingmethod.php +++ b/app/code/Magento/Fedex/Model/Plugin/Rma/Block/Adminhtml/Rma/Edit/Tab/General/Shippingmethod.php @@ -24,11 +24,11 @@ class Shippingmethod } /** - * @param \Magento\Framework\Object $subject + * @param \Magento\Framework\DataObject $subject * @param bool $result * @return bool */ - public function afterCanDisplayCustomValue(\Magento\Framework\Object $subject, $result) + public function afterCanDisplayCustomValue(\Magento\Framework\DataObject $subject, $result) { $carrierCode = $subject->getShipment()->getCarrierCode(); if (!$carrierCode) { diff --git a/app/code/Magento/Fedex/Test/Unit/Model/CarrierTest.php b/app/code/Magento/Fedex/Test/Unit/Model/CarrierTest.php index 37717163a59..aac91663200 100644 --- a/app/code/Magento/Fedex/Test/Unit/Model/CarrierTest.php +++ b/app/code/Magento/Fedex/Test/Unit/Model/CarrierTest.php @@ -5,7 +5,7 @@ */ namespace Magento\Fedex\Test\Unit\Model; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\Xml\Security; /** @@ -109,21 +109,21 @@ class CarrierTest extends \PHPUnit_Framework_TestCase public function testCollectRatesRateAmountOriginBased($amount, $rateType, $expected) { // @codingStandardsIgnoreStart - $netAmount = new \Magento\Framework\Object([]); + $netAmount = new \Magento\Framework\DataObject([]); $netAmount->Amount = $amount; - $totalNetCharge = new \Magento\Framework\Object([]); + $totalNetCharge = new \Magento\Framework\DataObject([]); $totalNetCharge->TotalNetCharge = $netAmount; $totalNetCharge->RateType = $rateType; - $ratedShipmentDetail = new \Magento\Framework\Object([]); + $ratedShipmentDetail = new \Magento\Framework\DataObject([]); $ratedShipmentDetail->ShipmentRateDetail = $totalNetCharge; - $rate = new \Magento\Framework\Object([]); + $rate = new \Magento\Framework\DataObject([]); $rate->ServiceType = 'ServiceType'; $rate->RatedShipmentDetails = [$ratedShipmentDetail]; - $response = new \Magento\Framework\Object([]); + $response = new \Magento\Framework\DataObject([]); $response->HighestSeverity = 'SUCCESS'; $response->RateReplyDetails = $rate; diff --git a/app/code/Magento/GiftMessage/Block/Message/Inline.php b/app/code/Magento/GiftMessage/Block/Message/Inline.php index 4a7640f3aa7..45b53e6a91f 100644 --- a/app/code/Magento/GiftMessage/Block/Message/Inline.php +++ b/app/code/Magento/GiftMessage/Block/Message/Inline.php @@ -323,7 +323,7 @@ class Inline extends \Magento\Framework\View\Element\Template /** * Check availability of giftmessages for specified entity item * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return bool */ public function isItemMessagesAvailable($item) diff --git a/app/code/Magento/GiftMessage/Block/Message/Multishipping/Plugin/ItemsBox.php b/app/code/Magento/GiftMessage/Block/Message/Multishipping/Plugin/ItemsBox.php index d940b7b8f09..339d330d4a6 100644 --- a/app/code/Magento/GiftMessage/Block/Message/Multishipping/Plugin/ItemsBox.php +++ b/app/code/Magento/GiftMessage/Block/Message/Multishipping/Plugin/ItemsBox.php @@ -32,7 +32,7 @@ class ItemsBox * * @param \Magento\Multishipping\Block\Checkout\Shipping $subject * @param callable $proceed - * @param \Magento\Framework\Object $addressEntity + * @param \Magento\Framework\DataObject $addressEntity * * @return string * @SuppressWarnings(PHPMD.UnusedFormalParameter) @@ -40,7 +40,7 @@ class ItemsBox public function aroundGetItemsBoxTextAfter( \Magento\Multishipping\Block\Checkout\Shipping $subject, \Closure $proceed, - \Magento\Framework\Object $addressEntity + \Magento\Framework\DataObject $addressEntity ) { $itemsBoxText = $proceed($addressEntity); return $itemsBoxText . $this->helper->getInline('multishipping_address', $addressEntity); diff --git a/app/code/Magento/GiftMessage/Helper/Message.php b/app/code/Magento/GiftMessage/Helper/Message.php index e2ab3e3eefa..a2e97fcfc79 100644 --- a/app/code/Magento/GiftMessage/Helper/Message.php +++ b/app/code/Magento/GiftMessage/Helper/Message.php @@ -103,11 +103,11 @@ class Message extends \Magento\Framework\App\Helper\AbstractHelper * Retrieve inline giftmessage edit form for specified entity * * @param string $type - * @param \Magento\Framework\Object $entity + * @param \Magento\Framework\DataObject $entity * @param bool $dontDisplayContainer * @return string */ - public function getInline($type, \Magento\Framework\Object $entity, $dontDisplayContainer = false) + public function getInline($type, \Magento\Framework\DataObject $entity, $dontDisplayContainer = false) { if (!$this->skipPage($type) && !$this->isMessagesAllowed($type, $entity)) { return ''; @@ -132,12 +132,12 @@ class Message extends \Magento\Framework\App\Helper\AbstractHelper * Check if giftmessages is allowed for specified entity. * * @param string $type - * @param \Magento\Framework\Object $entity + * @param \Magento\Framework\DataObject $entity * @param \Magento\Store\Model\Store|int|null $store * @return bool|string|null * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - public function isMessagesAllowed($type, \Magento\Framework\Object $entity, $store = null) + public function isMessagesAllowed($type, \Magento\Framework\DataObject $entity, $store = null) { if ($type == 'items') { $items = $entity->getAllItems(); @@ -213,10 +213,10 @@ class Message extends \Magento\Framework\App\Helper\AbstractHelper /** * Retrieve escaped and preformated gift message text for specified entity * - * @param \Magento\Framework\Object $entity + * @param \Magento\Framework\DataObject $entity * @return string|null */ - public function getEscapedGiftMessage(\Magento\Framework\Object $entity) + public function getEscapedGiftMessage(\Magento\Framework\DataObject $entity) { $message = $this->getGiftMessageForEntity($entity); if ($message) { @@ -228,10 +228,10 @@ class Message extends \Magento\Framework\App\Helper\AbstractHelper /** * Retrieve gift message for entity. If message not exists return null * - * @param \Magento\Framework\Object $entity + * @param \Magento\Framework\DataObject $entity * @return \Magento\GiftMessage\Model\Message */ - public function getGiftMessageForEntity(\Magento\Framework\Object $entity) + public function getGiftMessageForEntity(\Magento\Framework\DataObject $entity) { if ($entity->getGiftMessageId() && !$entity->getGiftMessage()) { $message = $this->getGiftMessage($entity->getGiftMessageId()); diff --git a/app/code/Magento/GiftMessage/Model/Observer.php b/app/code/Magento/GiftMessage/Model/Observer.php index 342bc8cb133..710238b986e 100644 --- a/app/code/Magento/GiftMessage/Model/Observer.php +++ b/app/code/Magento/GiftMessage/Model/Observer.php @@ -10,7 +10,7 @@ namespace Magento\GiftMessage\Model; * * @author Magento Core Team <core@magentocommerce.com> */ -class Observer extends \Magento\Framework\Object +class Observer extends \Magento\Framework\DataObject { /** * Gift message message diff --git a/app/code/Magento/GiftMessage/Model/Save.php b/app/code/Magento/GiftMessage/Model/Save.php index 7841e2f3786..798412e649e 100644 --- a/app/code/Magento/GiftMessage/Model/Save.php +++ b/app/code/Magento/GiftMessage/Model/Save.php @@ -10,7 +10,7 @@ namespace Magento\GiftMessage\Model; * * @author Magento Core Team <core@magentocommerce.com> */ -class Save extends \Magento\Framework\Object +class Save extends \Magento\Framework\DataObject { /** * @var bool @@ -162,7 +162,7 @@ class Save extends \Magento\Framework\Object /** * Delete a single gift message from entity * - * @param \Magento\Framework\Object $entityModel + * @param \Magento\Framework\DataObject $entityModel * @param \Magento\GiftMessage\Model\Message|null $giftmessageModel * @return $this */ @@ -240,7 +240,7 @@ class Save extends \Magento\Framework\Object /** * Checks allowed quote item for gift messages * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return bool * @SuppressWarnings(PHPMD.BooleanGetMethodName) */ @@ -260,7 +260,7 @@ class Save extends \Magento\Framework\Object /** * Retrieve is gift message available for item (product) * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return bool */ public function isGiftMessagesAvailable($item) diff --git a/app/code/Magento/GiftMessage/Test/Unit/Helper/MessageTest.php b/app/code/Magento/GiftMessage/Test/Unit/Helper/MessageTest.php index 9b1748b1052..c949729f29c 100644 --- a/app/code/Magento/GiftMessage/Test/Unit/Helper/MessageTest.php +++ b/app/code/Magento/GiftMessage/Test/Unit/Helper/MessageTest.php @@ -35,7 +35,7 @@ class MessageTest extends \PHPUnit_Framework_TestCase { $expectedHtml = '<a href="here">here</a>'; $layoutMock = $this->getMock('\Magento\Framework\View\Layout', [], [], '', false); - $entityMock = $this->getMock('\Magento\Framework\Object', [], [], '', false); + $entityMock = $this->getMock('\Magento\Framework\DataObject', [], [], '', false); $inlineMock = $this->getMock( 'Magento\GiftMessage\Block\Message\Inline', ['setId', 'setDontDisplayContainer', 'setEntity', 'setCheckoutType', 'toHtml'], diff --git a/app/code/Magento/GiftMessage/etc/fieldset.xml b/app/code/Magento/GiftMessage/etc/fieldset.xml index 6a29ef01f74..4883ee0129e 100644 --- a/app/code/Magento/GiftMessage/etc/fieldset.xml +++ b/app/code/Magento/GiftMessage/etc/fieldset.xml @@ -6,7 +6,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Object/etc/fieldset.xsd"> + xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/DataObject/etc/fieldset.xsd"> <scope id="global"> <fieldset id="quote_convert_address"> <field name="gift_message_id"> diff --git a/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php b/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php index f8d836a793d..b307a57a422 100644 --- a/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php +++ b/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php @@ -13,7 +13,7 @@ namespace Magento\GoogleAdwords\Model\Config\Backend; abstract class AbstractConversion extends \Magento\Framework\App\Config\Value { /** - * @var \Magento\Framework\Validator\Object + * @var \Magento\Framework\Validator\DataObject */ protected $_validatorComposite; @@ -26,7 +26,7 @@ abstract class AbstractConversion extends \Magento\Framework\App\Config\Value * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\App\Config\ScopeConfigInterface $config - * @param \Magento\Framework\Validator\ObjectFactory $validatorCompositeFactory + * @param \Magento\Framework\Validator\DataObjectFactory $validatorCompositeFactory * @param \Magento\GoogleAdwords\Model\Validator\Factory $validatorFactory * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection @@ -36,7 +36,7 @@ abstract class AbstractConversion extends \Magento\Framework\App\Config\Value \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\App\Config\ScopeConfigInterface $config, - \Magento\Framework\Validator\ObjectFactory $validatorCompositeFactory, + \Magento\Framework\Validator\DataObjectFactory $validatorCompositeFactory, \Magento\GoogleAdwords\Model\Validator\Factory $validatorFactory, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, diff --git a/app/code/Magento/GoogleAdwords/Model/Validator/Factory.php b/app/code/Magento/GoogleAdwords/Model/Validator/Factory.php index 5384960e41c..0afdeec7afe 100644 --- a/app/code/Magento/GoogleAdwords/Model/Validator/Factory.php +++ b/app/code/Magento/GoogleAdwords/Model/Validator/Factory.php @@ -8,7 +8,7 @@ */ namespace Magento\GoogleAdwords\Model\Validator; -use Magento\Framework\Validator\Int; +use Magento\Framework\Validator\IntUtils; use Magento\Framework\Validator\Regex; use Magento\Framework\Validator\UniversalFactory; @@ -83,12 +83,12 @@ class Factory [ 'alias' => 'Int', 'type' => '', - 'class' => 'Magento\Framework\Validator\Int', + 'class' => 'Magento\Framework\Validator\IntUtils', 'options' => [ 'methods' => [ [ 'method' => 'setMessages', - 'arguments' => [[Int::NOT_INT => $message, Int::INVALID => $message]], + 'arguments' => [[IntUtils::NOT_INT => $message, IntUtils::INVALID => $message]], ], ], ], diff --git a/app/code/Magento/GoogleAdwords/Test/Unit/Model/Validator/FactoryTest.php b/app/code/Magento/GoogleAdwords/Test/Unit/Model/Validator/FactoryTest.php index 43fd538e971..b4c05336a1d 100644 --- a/app/code/Magento/GoogleAdwords/Test/Unit/Model/Validator/FactoryTest.php +++ b/app/code/Magento/GoogleAdwords/Test/Unit/Model/Validator/FactoryTest.php @@ -6,7 +6,7 @@ */ namespace Magento\GoogleAdwords\Test\Unit\Model\Validator; -use Magento\Framework\Validator\Int; +use Magento\Framework\Validator\IntUtils; use Magento\Framework\Validator\Regex; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; @@ -135,12 +135,12 @@ class FactoryTest extends \PHPUnit_Framework_TestCase [ 'alias' => 'Int', 'type' => '', - 'class' => 'Magento\Framework\Validator\Int', + 'class' => 'Magento\Framework\Validator\IntUtils', 'options' => [ 'methods' => [ [ 'method' => 'setMessages', - 'arguments' => [[Int::NOT_INT => $message, Int::INVALID => $message]], + 'arguments' => [[IntUtils::NOT_INT => $message, IntUtils::INVALID => $message]], ], ], ], diff --git a/app/code/Magento/GoogleOptimizer/Block/Code/Category.php b/app/code/Magento/GoogleOptimizer/Block/Code/Category.php index 433e278db78..9350d7b6fce 100644 --- a/app/code/Magento/GoogleOptimizer/Block/Code/Category.php +++ b/app/code/Magento/GoogleOptimizer/Block/Code/Category.php @@ -10,7 +10,7 @@ namespace Magento\GoogleOptimizer\Block\Code; -class Category extends \Magento\GoogleOptimizer\Block\AbstractCode implements \Magento\Framework\Object\IdentityInterface +class Category extends \Magento\GoogleOptimizer\Block\AbstractCode implements \Magento\Framework\DataObject\IdentityInterface { /** * @var string Entity name in registry diff --git a/app/code/Magento/GoogleOptimizer/Block/Code/Product.php b/app/code/Magento/GoogleOptimizer/Block/Code/Product.php index 7c40e57e15b..257711fb7f4 100644 --- a/app/code/Magento/GoogleOptimizer/Block/Code/Product.php +++ b/app/code/Magento/GoogleOptimizer/Block/Code/Product.php @@ -10,7 +10,7 @@ namespace Magento\GoogleOptimizer\Block\Code; -class Product extends \Magento\GoogleOptimizer\Block\AbstractCode implements \Magento\Framework\Object\IdentityInterface +class Product extends \Magento\GoogleOptimizer\Block\AbstractCode implements \Magento\Framework\DataObject\IdentityInterface { /** * @var Product name in registry diff --git a/app/code/Magento/GoogleOptimizer/Model/Observer/Category/Delete.php b/app/code/Magento/GoogleOptimizer/Model/Observer/Category/Delete.php index d63770e1104..e3d4b537f5e 100644 --- a/app/code/Magento/GoogleOptimizer/Model/Observer/Category/Delete.php +++ b/app/code/Magento/GoogleOptimizer/Model/Observer/Category/Delete.php @@ -25,7 +25,7 @@ class Delete /** * Delete Product scripts after deleting product * - * @param \Magento\Framework\Object $observer + * @param \Magento\Framework\DataObject $observer * @return $this */ public function deleteCategoryGoogleExperimentScript($observer) diff --git a/app/code/Magento/GoogleOptimizer/Model/Observer/CmsPage/Delete.php b/app/code/Magento/GoogleOptimizer/Model/Observer/CmsPage/Delete.php index 371f644aec9..c2087728f51 100644 --- a/app/code/Magento/GoogleOptimizer/Model/Observer/CmsPage/Delete.php +++ b/app/code/Magento/GoogleOptimizer/Model/Observer/CmsPage/Delete.php @@ -28,7 +28,7 @@ class Delete /** * Delete Product scripts after deleting product * - * @param \Magento\Framework\Object $observer + * @param \Magento\Framework\DataObject $observer * @return $this */ public function deleteCmsGoogleExperimentScript($observer) diff --git a/app/code/Magento/GoogleOptimizer/Model/Observer/Product/Delete.php b/app/code/Magento/GoogleOptimizer/Model/Observer/Product/Delete.php index 32ad45d66f8..4f7a670451f 100644 --- a/app/code/Magento/GoogleOptimizer/Model/Observer/Product/Delete.php +++ b/app/code/Magento/GoogleOptimizer/Model/Observer/Product/Delete.php @@ -25,7 +25,7 @@ class Delete /** * Delete Product scripts after deleting product * - * @param \Magento\Framework\Object $observer + * @param \Magento\Framework\DataObject $observer * @return $this */ public function deleteProductGoogleExperimentScript($observer) diff --git a/app/code/Magento/GroupedProduct/Block/Adminhtml/Order/Create/Sidebar.php b/app/code/Magento/GroupedProduct/Block/Adminhtml/Order/Create/Sidebar.php index a408341db7c..8b4b93d2443 100644 --- a/app/code/Magento/GroupedProduct/Block/Adminhtml/Order/Create/Sidebar.php +++ b/app/code/Magento/GroupedProduct/Block/Adminhtml/Order/Create/Sidebar.php @@ -12,7 +12,7 @@ class Sidebar * * @param \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\AbstractSidebar $subject * @param callable $proceed - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * * @return string * @SuppressWarnings(PHPMD.UnusedFormalParameter) @@ -20,7 +20,7 @@ class Sidebar public function aroundGetItemQty( \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\AbstractSidebar $subject, \Closure $proceed, - \Magento\Framework\Object $item + \Magento\Framework\DataObject $item ) { if ($item->getProduct()->getTypeId() == \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE) { return ''; diff --git a/app/code/Magento/GroupedProduct/Block/Cart/Item/Renderer/Grouped.php b/app/code/Magento/GroupedProduct/Block/Cart/Item/Renderer/Grouped.php index b9d8ced7264..7f07e6a3521 100644 --- a/app/code/Magento/GroupedProduct/Block/Cart/Item/Renderer/Grouped.php +++ b/app/code/Magento/GroupedProduct/Block/Cart/Item/Renderer/Grouped.php @@ -7,7 +7,7 @@ namespace Magento\GroupedProduct\Block\Cart\Item\Renderer; use Magento\Catalog\Model\Config\Source\Product\Thumbnail as ThumbnailSource; use Magento\Checkout\Block\Cart\Item\Renderer; -use Magento\Framework\Object\IdentityInterface; +use Magento\Framework\DataObject\IdentityInterface; /** * Shopping cart item render block diff --git a/app/code/Magento/GroupedProduct/Block/Stockqty/Type/Grouped.php b/app/code/Magento/GroupedProduct/Block/Stockqty/Type/Grouped.php index ec900cc06ea..9ec91481e34 100644 --- a/app/code/Magento/GroupedProduct/Block/Stockqty/Type/Grouped.php +++ b/app/code/Magento/GroupedProduct/Block/Stockqty/Type/Grouped.php @@ -5,7 +5,7 @@ */ namespace Magento\GroupedProduct\Block\Stockqty\Type; -use Magento\Framework\Object\IdentityInterface; +use Magento\Framework\DataObject\IdentityInterface; /** * Product stock qty block for grouped product type diff --git a/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php index 0ff17fbaf76..546c51ea04b 100644 --- a/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php +++ b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php @@ -135,11 +135,11 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType /** * Return relation info about used products * - * @return \Magento\Framework\Object Object with information data + * @return \Magento\Framework\DataObject Object with information data */ public function getRelationInfo() { - $info = new \Magento\Framework\Object(); + $info = new \Magento\Framework\DataObject(); $info->setTable( 'catalog_product_link' )->setParentFieldName( @@ -327,12 +327,12 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType } /** - * @param \Magento\Framework\Object $buyRequest + * @param \Magento\Framework\DataObject $buyRequest * @param \Magento\Catalog\Model\Product $product * @param bool $isStrictProcessMode * @return array|string */ - protected function getProductInfo(\Magento\Framework\Object $buyRequest, $product, $isStrictProcessMode) + protected function getProductInfo(\Magento\Framework\DataObject $buyRequest, $product, $isStrictProcessMode) { $productsInfo = $buyRequest->getSuperGroup() ?: []; $associatedProducts = $this->getAssociatedProducts($product); @@ -356,14 +356,14 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType * Prepare product and its configuration to be added to some products list. * Perform standard preparation process and add logic specific to Grouped product type. * - * @param \Magento\Framework\Object $buyRequest + * @param \Magento\Framework\DataObject $buyRequest * @param \Magento\Catalog\Model\Product $product * @param string $processMode * @return \Magento\Framework\Phrase|array|string * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - protected function _prepareProduct(\Magento\Framework\Object $buyRequest, $product, $processMode) + protected function _prepareProduct(\Magento\Framework\DataObject $buyRequest, $product, $processMode) { $products = []; $associatedProductsInfo = []; @@ -441,7 +441,7 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType * Prepare selected qty for grouped product's options * * @param \Magento\Catalog\Model\Product $product - * @param \Magento\Framework\Object $buyRequest + * @param \Magento\Framework\DataObject $buyRequest * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ diff --git a/app/code/Magento/GroupedProduct/Model/Sales/AdminOrder/Product/Quote/Plugin/Initializer.php b/app/code/Magento/GroupedProduct/Model/Sales/AdminOrder/Product/Quote/Plugin/Initializer.php index 5e1c7511fee..9cd98476a33 100644 --- a/app/code/Magento/GroupedProduct/Model/Sales/AdminOrder/Product/Quote/Plugin/Initializer.php +++ b/app/code/Magento/GroupedProduct/Model/Sales/AdminOrder/Product/Quote/Plugin/Initializer.php @@ -21,7 +21,7 @@ class Initializer * @param callable $proceed * @param \Magento\Quote\Model\Quote $quote * @param \Magento\Catalog\Model\Product $product - * @param \Magento\Framework\Object $config + * @param \Magento\Framework\DataObject $config * * @return \Magento\Quote\Model\Quote\Item|string * @SuppressWarnings(PHPMD.UnusedFormalParameter) @@ -31,7 +31,7 @@ class Initializer \Closure $proceed, \Magento\Quote\Model\Quote $quote, \Magento\Catalog\Model\Product $product, - \Magento\Framework\Object $config + \Magento\Framework\DataObject $config ) { $item = $proceed($quote, $product, $config); diff --git a/app/code/Magento/GroupedProduct/Test/Unit/Block/Adminhtml/Order/Create/SidebarTest.php b/app/code/Magento/GroupedProduct/Test/Unit/Block/Adminhtml/Order/Create/SidebarTest.php index 39ff65fa3e6..569d79da50b 100644 --- a/app/code/Magento/GroupedProduct/Test/Unit/Block/Adminhtml/Order/Create/SidebarTest.php +++ b/app/code/Magento/GroupedProduct/Test/Unit/Block/Adminhtml/Order/Create/SidebarTest.php @@ -34,7 +34,7 @@ class SidebarTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->itemMock = $this->getMock('Magento\Framework\Object', ['getProduct'], [], '', false); + $this->itemMock = $this->getMock('Magento\Framework\DataObject', ['getProduct'], [], '', false); $this->productMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); $this->subjectMock = $this->getMock( 'Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\AbstractSidebar', diff --git a/app/code/Magento/GroupedProduct/Test/Unit/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php b/app/code/Magento/GroupedProduct/Test/Unit/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php index caaa76db836..599080ce36a 100644 --- a/app/code/Magento/GroupedProduct/Test/Unit/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php +++ b/app/code/Magento/GroupedProduct/Test/Unit/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php @@ -172,7 +172,7 @@ class GroupedTest extends \PHPUnit_Framework_TestCase { $storeId = 2; - $objectMock = $this->getMock('\Magento\Framework\Object', ['getSuperGroup'], [], '', false); + $objectMock = $this->getMock('\Magento\Framework\DataObject', ['getSuperGroup'], [], '', false); $instanceMock = $this->getMock( 'Magento\GroupedProduct\Model\Product\Type\Grouped', [], diff --git a/app/code/Magento/GroupedProduct/Test/Unit/Block/Product/Grouped/AssociatedProducts/ListAssociatedProductsTest.php b/app/code/Magento/GroupedProduct/Test/Unit/Block/Product/Grouped/AssociatedProducts/ListAssociatedProductsTest.php index f03cf752372..0620f66a105 100644 --- a/app/code/Magento/GroupedProduct/Test/Unit/Block/Product/Grouped/AssociatedProducts/ListAssociatedProductsTest.php +++ b/app/code/Magento/GroupedProduct/Test/Unit/Block/Product/Grouped/AssociatedProducts/ListAssociatedProductsTest.php @@ -157,7 +157,7 @@ class ListAssociatedProductsTest extends \PHPUnit_Framework_TestCase protected function generateAssociatedProduct($productKey = 0) { $associatedProduct = $this->getMock( - 'Magento\Framework\Object', + 'Magento\Framework\DataObject', ['getQty', 'getPosition', 'getId', 'getSku', 'getName', 'getPrice'], [], '', diff --git a/app/code/Magento/GroupedProduct/Test/Unit/Block/Product/View/Type/GroupedTest.php b/app/code/Magento/GroupedProduct/Test/Unit/Block/Product/View/Type/GroupedTest.php index dc5eb016035..ab4b4af7774 100644 --- a/app/code/Magento/GroupedProduct/Test/Unit/Block/Product/View/Type/GroupedTest.php +++ b/app/code/Magento/GroupedProduct/Test/Unit/Block/Product/View/Type/GroupedTest.php @@ -54,7 +54,7 @@ class GroupedTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->typeInstanceMock) ); $this->configuredValueMock = $this->getMock( - 'Magento\Framework\Object', + 'Magento\Framework\DataObject', ['getSuperGroup'], [], '', diff --git a/app/code/Magento/GroupedProduct/Test/Unit/Model/Product/Type/GroupedTest.php b/app/code/Magento/GroupedProduct/Test/Unit/Model/Product/Type/GroupedTest.php index 57c8b33bcf1..edb3864706f 100644 --- a/app/code/Magento/GroupedProduct/Test/Unit/Model/Product/Type/GroupedTest.php +++ b/app/code/Magento/GroupedProduct/Test/Unit/Model/Product/Type/GroupedTest.php @@ -267,7 +267,7 @@ class GroupedTest extends \PHPUnit_Framework_TestCase */ public function testProcessBuyRequest($superGroup, $result) { - $buyRequest = $this->getMock('\Magento\Framework\Object', ['getSuperGroup'], [], '', false); + $buyRequest = $this->getMock('\Magento\Framework\DataObject', ['getSuperGroup'], [], '', false); $buyRequest->expects($this->any())->method('getSuperGroup')->will($this->returnValue($superGroup)); $this->assertEquals($result, $this->_model->processBuyRequest($this->product, $buyRequest)); @@ -301,7 +301,7 @@ class GroupedTest extends \PHPUnit_Framework_TestCase public function testPrepareForCartAdvancedEmpty() { $this->product = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); - $buyRequest = new \Magento\Framework\Object(); + $buyRequest = new \Magento\Framework\DataObject(); $expectedMsg = "Please specify the quantity of product(s)."; $productCollection = $this->getMock( @@ -385,7 +385,7 @@ class GroupedTest extends \PHPUnit_Framework_TestCase public function testPrepareForCartAdvancedNoProductsStrictTrue() { - $buyRequest = new \Magento\Framework\Object(); + $buyRequest = new \Magento\Framework\DataObject(); $buyRequest->setSuperGroup([0 => 0]); $expectedMsg = "Please specify the quantity of product(s)."; @@ -408,7 +408,7 @@ class GroupedTest extends \PHPUnit_Framework_TestCase public function testPrepareForCartAdvancedNoProductsStrictFalse() { - $buyRequest = new \Magento\Framework\Object(); + $buyRequest = new \Magento\Framework\DataObject(); $buyRequest->setSuperGroup([0 => 0]); $cached = true; @@ -446,7 +446,7 @@ class GroupedTest extends \PHPUnit_Framework_TestCase $associatedProduct->expects($this->once())->method('getTypeInstance')->willReturn($typeMock); - $buyRequest = new \Magento\Framework\Object(); + $buyRequest = new \Magento\Framework\DataObject(); $buyRequest->setSuperGroup([$associatedId => 1]); $cached = true; @@ -484,7 +484,7 @@ class GroupedTest extends \PHPUnit_Framework_TestCase $associatedProduct->expects($this->once())->method('getTypeInstance')->willReturn($typeMock); - $buyRequest = new \Magento\Framework\Object(); + $buyRequest = new \Magento\Framework\DataObject(); $buyRequest->setSuperGroup([$associatedId => 1]); $cached = true; @@ -521,7 +521,7 @@ class GroupedTest extends \PHPUnit_Framework_TestCase $associatedProduct->expects($this->once())->method('getTypeInstance')->willReturn($typeMock); - $buyRequest = new \Magento\Framework\Object(); + $buyRequest = new \Magento\Framework\DataObject(); $buyRequest->setSuperGroup([$associatedId => 1]); $cached = true; @@ -558,7 +558,7 @@ class GroupedTest extends \PHPUnit_Framework_TestCase $associatedProduct->expects($this->once())->method('getTypeInstance')->willReturn($typeMock); - $buyRequest = new \Magento\Framework\Object(); + $buyRequest = new \Magento\Framework\DataObject(); $buyRequest->setSuperGroup([$associatedId => 1]); $cached = true; @@ -589,7 +589,7 @@ class GroupedTest extends \PHPUnit_Framework_TestCase $associatedProduct = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); $associatedProduct->expects($this->atLeastOnce())->method('getId')->will($this->returnValue($associatedId)); - $buyRequest = new \Magento\Framework\Object(); + $buyRequest = new \Magento\Framework\DataObject(); $buyRequest->setSuperGroup([$associatedId => 0]); $cached = true; diff --git a/app/code/Magento/ImportExport/Block/Adminhtml/Export/Filter.php b/app/code/Magento/ImportExport/Block/Adminhtml/Export/Filter.php index 4e963662ae0..c8a3ca262da 100644 --- a/app/code/Magento/ImportExport/Block/Adminhtml/Export/Filter.php +++ b/app/code/Magento/ImportExport/Block/Adminhtml/Export/Filter.php @@ -322,12 +322,12 @@ class Filter extends \Magento\Backend\Block\Widget\Grid\Extended * * @param mixed $value * @param Attribute $row - * @param \Magento\Framework\Object $column + * @param \Magento\Framework\DataObject $column * @param boolean $isExport * @return string * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function decorateFilter($value, Attribute $row, \Magento\Framework\Object $column, $isExport) + public function decorateFilter($value, Attribute $row, \Magento\Framework\DataObject $column, $isExport) { $value = null; $values = $column->getValues(); diff --git a/app/code/Magento/ImportExport/Block/Adminhtml/Grid/Column/Renderer/Download.php b/app/code/Magento/ImportExport/Block/Adminhtml/Grid/Column/Renderer/Download.php index 46b5808fdea..0057f0a7357 100644 --- a/app/code/Magento/ImportExport/Block/Adminhtml/Grid/Column/Renderer/Download.php +++ b/app/code/Magento/ImportExport/Block/Adminhtml/Grid/Column/Renderer/Download.php @@ -15,10 +15,10 @@ class Download extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Text /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return mixed */ - public function _getValue(\Magento\Framework\Object $row) + public function _getValue(\Magento\Framework\DataObject $row) { return '<p> ' . $row->getData('imported_file') . '</p><a href="' . $this->getUrl('*/*/download', ['filename' => $row->getData('imported_file')]) . '">Download</a>'; diff --git a/app/code/Magento/ImportExport/Model/AbstractModel.php b/app/code/Magento/ImportExport/Model/AbstractModel.php index 0672bb1c1a4..a5e90b1ce0e 100644 --- a/app/code/Magento/ImportExport/Model/AbstractModel.php +++ b/app/code/Magento/ImportExport/Model/AbstractModel.php @@ -12,7 +12,7 @@ use Magento\Framework\App\Filesystem\DirectoryList; * * @author Magento Core Team <core@magentocommerce.com> */ -abstract class AbstractModel extends \Magento\Framework\Object +abstract class AbstractModel extends \Magento\Framework\DataObject { /** * Enable loging diff --git a/app/code/Magento/ImportExport/Model/Import/AbstractEntity.php b/app/code/Magento/ImportExport/Model/Import/AbstractEntity.php index eb2ce5cf256..1499f70d7ff 100644 --- a/app/code/Magento/ImportExport/Model/Import/AbstractEntity.php +++ b/app/code/Magento/ImportExport/Model/Import/AbstractEntity.php @@ -114,7 +114,7 @@ abstract class AbstractEntity /** * Magento string lib * - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -239,7 +239,7 @@ abstract class AbstractEntity protected $_scopeConfig; /** - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\ImportExport\Model\ImportFactory $importFactory * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper @@ -248,7 +248,7 @@ abstract class AbstractEntity * @SuppressWarnings(PHPMD.NPathComplexity) */ public function __construct( - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEav.php b/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEav.php index 7aa99e359c7..38d488a52e7 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEav.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEav.php @@ -73,7 +73,7 @@ abstract class AbstractEav extends \Magento\ImportExport\Model\Import\AbstractEn protected $_attributeCollection; /** - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\ImportExport\Model\ImportFactory $importFactory * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper @@ -86,7 +86,7 @@ abstract class AbstractEav extends \Magento\ImportExport\Model\Import\AbstractEn * @throws \Magento\Framework\Exception\LocalizedException */ public function __construct( - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php b/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php index aa893f2bde3..a06d7c29020 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php @@ -194,7 +194,7 @@ abstract class AbstractEntity /** * Magento string lib * - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -238,7 +238,7 @@ abstract class AbstractEntity * @param \Magento\Eav\Model\Config $config * @param \Magento\Framework\App\Resource $resource * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string */ public function __construct( \Magento\Framework\Json\Helper\Data $jsonHelper, @@ -247,7 +247,7 @@ abstract class AbstractEntity \Magento\Eav\Model\Config $config, \Magento\Framework\App\Resource $resource, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, - \Magento\Framework\Stdlib\String $string + \Magento\Framework\Stdlib\StringUtils $string ) { $this->jsonHelper = $jsonHelper; $this->_importExportData = $importExportData; diff --git a/app/code/Magento/ImportExport/Model/Resource/Import/Data.php b/app/code/Magento/ImportExport/Model/Resource/Import/Data.php index e6f12e2e690..cc37abc56d6 100644 --- a/app/code/Magento/ImportExport/Model/Resource/Import/Data.php +++ b/app/code/Magento/ImportExport/Model/Resource/Import/Data.php @@ -134,13 +134,16 @@ class Data extends \Magento\Framework\Model\Resource\Db\AbstractDb implements \I $this->_iterator = $this->getIterator(); $this->_iterator->rewind(); } + $dataRow = null; if ($this->_iterator->valid()) { - $dataRow = $this->_iterator->current(); - $dataRow = $this->jsonHelper->jsonDecode($dataRow[0]); - $this->_iterator->next(); - } else { + $encodedData = $this->_iterator->current(); + if (array_key_exists(0, $encodedData) && $encodedData[0]) { + $dataRow = $this->jsonHelper->jsonDecode($encodedData[0]); + $this->_iterator->next(); + } + } + if (!$dataRow) { $this->_iterator = null; - $dataRow = null; } return $dataRow; } diff --git a/app/code/Magento/ImportExport/Test/Unit/Block/Adminhtml/Export/FilterTest.php b/app/code/Magento/ImportExport/Test/Unit/Block/Adminhtml/Export/FilterTest.php index 2fbda38c94c..dcfa1be2b2d 100644 --- a/app/code/Magento/ImportExport/Test/Unit/Block/Adminhtml/Export/FilterTest.php +++ b/app/code/Magento/ImportExport/Test/Unit/Block/Adminhtml/Export/FilterTest.php @@ -254,7 +254,7 @@ class FilterTest extends \PHPUnit_Framework_TestCase $attribute->setOptions($attributeData['options']); $attribute->setFilterOptions($attributeData['filter_options']); $attribute->setBackendType($backendType); - $column = new \Magento\Framework\Object(); + $column = new \Magento\Framework\DataObject(); $column->setData($columnValue, 'value'); $isExport = true; $this->filter->decorateFilter($value, $attribute, $column, $isExport); diff --git a/app/code/Magento/ImportExport/Test/Unit/Block/Adminhtml/Grid/Column/Renderer/DownloadTest.php b/app/code/Magento/ImportExport/Test/Unit/Block/Adminhtml/Grid/Column/Renderer/DownloadTest.php index cceb0040097..0db808239c5 100644 --- a/app/code/Magento/ImportExport/Test/Unit/Block/Adminhtml/Grid/Column/Renderer/DownloadTest.php +++ b/app/code/Magento/ImportExport/Test/Unit/Block/Adminhtml/Grid/Column/Renderer/DownloadTest.php @@ -63,7 +63,7 @@ class DownloadTest extends \PHPUnit_Framework_TestCase public function testGetValue() { $data = ['imported_file' => 'file.csv']; - $row = new \Magento\Framework\Object($data); + $row = new \Magento\Framework\DataObject($data); $this->assertEquals('<p> file.csv</p><a href="url">Download</a>', $this->download->_getValue($row)); } } diff --git a/app/code/Magento/ImportExport/Test/Unit/Model/Import/Entity/EavAbstractTest.php b/app/code/Magento/ImportExport/Test/Unit/Model/Import/Entity/EavAbstractTest.php index d3a43b4355b..6add3933dbf 100644 --- a/app/code/Magento/ImportExport/Test/Unit/Model/Import/Entity/EavAbstractTest.php +++ b/app/code/Magento/ImportExport/Test/Unit/Model/Import/Entity/EavAbstractTest.php @@ -24,7 +24,7 @@ class EavAbstractTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\Framework\Stdlib\String|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Stdlib\StringUtils|\PHPUnit_Framework_MockObject_MockObject */ protected $_string; @@ -60,7 +60,7 @@ class EavAbstractTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_string = new \Magento\Framework\Stdlib\String(); + $this->_string = new \Magento\Framework\Stdlib\StringUtils(); $scopeConfig = $this->getMock('Magento\Framework\App\Config\ScopeConfigInterface'); $this->_importFactory = $this->getMock( diff --git a/app/code/Magento/ImportExport/Test/Unit/Model/Import/EntityAbstractTest.php b/app/code/Magento/ImportExport/Test/Unit/Model/Import/EntityAbstractTest.php index fbd4bfb1331..21b65012b19 100644 --- a/app/code/Magento/ImportExport/Test/Unit/Model/Import/EntityAbstractTest.php +++ b/app/code/Magento/ImportExport/Test/Unit/Model/Import/EntityAbstractTest.php @@ -53,7 +53,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase */ protected function _getModelDependencies() { - $string = new \Magento\Framework\Stdlib\String(); + $string = new \Magento\Framework\Stdlib\StringUtils(); $scopeConfig = $this->getMock('Magento\Framework\App\Config\ScopeConfigInterface'); $importFactory = $this->getMock('Magento\ImportExport\Model\ImportFactory', [], [], '', false); $resourceHelper = $this->getMock('Magento\ImportExport\Model\Resource\Helper', [], [], '', false); diff --git a/app/code/Magento/ImportExport/Test/Unit/Model/Resource/CollectionByPagesIteratorTest.php b/app/code/Magento/ImportExport/Test/Unit/Model/Resource/CollectionByPagesIteratorTest.php index 4c8c2f1ee80..ee2861a7927 100644 --- a/app/code/Magento/ImportExport/Test/Unit/Model/Resource/CollectionByPagesIteratorTest.php +++ b/app/code/Magento/ImportExport/Test/Unit/Model/Resource/CollectionByPagesIteratorTest.php @@ -72,7 +72,7 @@ class CollectionByPagesIteratorTest extends \PHPUnit_Framework_TestCase for ($pageNumber = 1; $pageNumber <= $pageCount; $pageNumber++) { for ($rowNumber = 1; $rowNumber <= $pageSize; $rowNumber++) { $itemId = ($pageNumber - 1) * $pageSize + $rowNumber; - $item = new \Magento\Framework\Object(['id' => $itemId]); + $item = new \Magento\Framework\DataObject(['id' => $itemId]); $collectionMock->addItem($item); $callbackMock->expects($this->at($itemId - 1))->method('callback')->with($item); diff --git a/app/code/Magento/Indexer/Block/Backend/Grid/Column/Renderer/Scheduled.php b/app/code/Magento/Indexer/Block/Backend/Grid/Column/Renderer/Scheduled.php index dbcb97e39ad..8c84621406f 100644 --- a/app/code/Magento/Indexer/Block/Backend/Grid/Column/Renderer/Scheduled.php +++ b/app/code/Magento/Indexer/Block/Backend/Grid/Column/Renderer/Scheduled.php @@ -10,10 +10,10 @@ class Scheduled extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstr /** * Render whether indexer is scheduled * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { if ($this->_getValue($row)) { $class = 'grid-severity-notice'; diff --git a/app/code/Magento/Indexer/Block/Backend/Grid/Column/Renderer/Status.php b/app/code/Magento/Indexer/Block/Backend/Grid/Column/Renderer/Status.php index e929d3faebc..d108b27b83f 100644 --- a/app/code/Magento/Indexer/Block/Backend/Grid/Column/Renderer/Status.php +++ b/app/code/Magento/Indexer/Block/Backend/Grid/Column/Renderer/Status.php @@ -10,10 +10,10 @@ class Status extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstract /** * Render indexer status * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $class = ''; $text = ''; diff --git a/app/code/Magento/Indexer/Block/Backend/Grid/Column/Renderer/Updated.php b/app/code/Magento/Indexer/Block/Backend/Grid/Column/Renderer/Updated.php index 0730d06eeee..762d7f43703 100644 --- a/app/code/Magento/Indexer/Block/Backend/Grid/Column/Renderer/Updated.php +++ b/app/code/Magento/Indexer/Block/Backend/Grid/Column/Renderer/Updated.php @@ -10,10 +10,10 @@ class Updated extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Datetim /** * Render indexer updated time * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return \Magento\Framework\Phrase|string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $value = parent::render($row); if (!$value) { diff --git a/app/code/Magento/Indexer/Model/Action/Base.php b/app/code/Magento/Indexer/Model/Action/Base.php index 3028c2cc7fc..1ce29cd6673 100644 --- a/app/code/Magento/Indexer/Model/Action/Base.php +++ b/app/code/Magento/Indexer/Model/Action/Base.php @@ -10,7 +10,7 @@ use Magento\Framework\App\Resource\SourceProviderInterface; use Magento\Framework\DB\Adapter\AdapterInterface; use Magento\Framework\DB\Ddl\Table; use Magento\Framework\IndexerInterface; -use Magento\Framework\Stdlib\String as StdString; +use Magento\Framework\Stdlib\StringUtils as StdString; use Magento\Indexer\Model\ActionInterface; use Magento\Indexer\Model\FieldsetPool; use Magento\Indexer\Model\HandlerPool; diff --git a/app/code/Magento/Indexer/Model/CacheContext.php b/app/code/Magento/Indexer/Model/CacheContext.php index b12ea98bce5..fa82505a090 100644 --- a/app/code/Magento/Indexer/Model/CacheContext.php +++ b/app/code/Magento/Indexer/Model/CacheContext.php @@ -8,7 +8,7 @@ namespace Magento\Indexer\Model; /** * Class Context */ -class CacheContext implements \Magento\Framework\Object\IdentityInterface +class CacheContext implements \Magento\Framework\DataObject\IdentityInterface { /** * @var array diff --git a/app/code/Magento/Indexer/Model/Indexer.php b/app/code/Magento/Indexer/Model/Indexer.php index bf47170388e..43436f1ce10 100644 --- a/app/code/Magento/Indexer/Model/Indexer.php +++ b/app/code/Magento/Indexer/Model/Indexer.php @@ -5,7 +5,7 @@ */ namespace Magento\Indexer\Model; -class Indexer extends \Magento\Framework\Object implements IndexerInterface +class Indexer extends \Magento\Framework\DataObject implements IndexerInterface { /** * @var string diff --git a/app/code/Magento/Indexer/Test/Unit/Block/Backend/Grid/Column/Renderer/ScheduledTest.php b/app/code/Magento/Indexer/Test/Unit/Block/Backend/Grid/Column/Renderer/ScheduledTest.php index 89baea16227..4671f5a47b8 100644 --- a/app/code/Magento/Indexer/Test/Unit/Block/Backend/Grid/Column/Renderer/ScheduledTest.php +++ b/app/code/Magento/Indexer/Test/Unit/Block/Backend/Grid/Column/Renderer/ScheduledTest.php @@ -16,8 +16,8 @@ class ScheduledTest extends \PHPUnit_Framework_TestCase public function testRender($rowValue, $class, $text) { $html = '<span class="' . $class . '"><span>' . $text . '</span></span>'; - $row = new \Magento\Framework\Object(); - $column = new \Magento\Framework\Object(); + $row = new \Magento\Framework\DataObject(); + $column = new \Magento\Framework\DataObject(); $context = $this->getMockBuilder('\Magento\Backend\Block\Context') ->disableOriginalConstructor() ->getMock(); @@ -39,5 +39,4 @@ class ScheduledTest extends \PHPUnit_Framework_TestCase ['', 'grid-severity-major', __('Update on Save')], ]; } - } diff --git a/app/code/Magento/Indexer/Test/Unit/Block/Backend/Grid/Column/Renderer/StatusTest.php b/app/code/Magento/Indexer/Test/Unit/Block/Backend/Grid/Column/Renderer/StatusTest.php index f9941118a52..699e5dcd636 100644 --- a/app/code/Magento/Indexer/Test/Unit/Block/Backend/Grid/Column/Renderer/StatusTest.php +++ b/app/code/Magento/Indexer/Test/Unit/Block/Backend/Grid/Column/Renderer/StatusTest.php @@ -18,7 +18,7 @@ class StatusTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); $model = new \Magento\Indexer\Block\Backend\Grid\Column\Renderer\Status($context); - $obj = new \Magento\Framework\Object(); + $obj = new \Magento\Framework\DataObject(); $obj->setGetter(null); $obj->setDefault(''); $obj->setValue(''); @@ -27,7 +27,10 @@ class StatusTest extends \PHPUnit_Framework_TestCase $model->setColumn($obj); $model->setIndex($indexValues[0]); $result = $model->render($obj); - $this->assertEquals($result, '<span class="' . $expectedResult['class'] . '"><span>' . $expectedResult['text'] . '</span></span>'); + $this->assertEquals( + $result, + '<span class="' . $expectedResult['class'] . '"><span>' . $expectedResult['text'] . '</span></span>' + ); } public function renderDataProvider() @@ -47,5 +50,4 @@ class StatusTest extends \PHPUnit_Framework_TestCase ] ]; } - } diff --git a/app/code/Magento/Indexer/Test/Unit/Block/Backend/Grid/Column/Renderer/UpdatedTest.php b/app/code/Magento/Indexer/Test/Unit/Block/Backend/Grid/Column/Renderer/UpdatedTest.php index 56391a6a955..cb89b3e6dae 100644 --- a/app/code/Magento/Indexer/Test/Unit/Block/Backend/Grid/Column/Renderer/UpdatedTest.php +++ b/app/code/Magento/Indexer/Test/Unit/Block/Backend/Grid/Column/Renderer/UpdatedTest.php @@ -18,7 +18,7 @@ class UpdatedTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); $model = new \Magento\Indexer\Block\Backend\Grid\Column\Renderer\Updated($context); - $obj = new \Magento\Framework\Object(); + $obj = new \Magento\Framework\DataObject(); $obj->setGetter('getValue'); $obj->setDefault($defaultValue); $obj->setValue(''); diff --git a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button.php b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button.php index 7f5b2f98b9f..f88de7a8dad 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button.php @@ -6,7 +6,7 @@ namespace Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer; use Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Integration\Model\Integration; /** @@ -18,7 +18,7 @@ class Button extends AbstractRenderer /** * {@inheritdoc} */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { /** @var array $attributes */ $attributes = $this->_prepareAttributes($row); @@ -28,10 +28,10 @@ class Button extends AbstractRenderer /** * Determine whether current integration came from config file * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return bool */ - protected function _isConfigBasedIntegration(Object $row) + protected function _isConfigBasedIntegration(DataObject $row) { return $row->hasData( Integration::SETUP_TYPE @@ -43,20 +43,20 @@ class Button extends AbstractRenderer /** * Whether current item is disabled. * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return bool * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - protected function _isDisabled(Object $row) + protected function _isDisabled(DataObject $row) { return false; } /** - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - protected function _getDisabledAttribute(Object $row) + protected function _getDisabledAttribute(DataObject $row) { return $this->_isDisabled($row) ? 'disabled' : ''; } @@ -68,10 +68,10 @@ class Button extends AbstractRenderer * - Then it tries to get it from the button's column layout description. * If received attribute value is empty - attribute is not added to final HTML. * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return array */ - protected function _prepareAttributes(Object $row) + protected function _prepareAttributes(DataObject $row) { $attributes = []; foreach ($this->_getValidAttributes() as $attributeName) { diff --git a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/Delete.php b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/Delete.php index 3e3a18036e2..ef54fe14e2b 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/Delete.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/Delete.php @@ -7,7 +7,7 @@ */ namespace Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer\Button; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer\Button; class Delete extends Button @@ -15,10 +15,10 @@ class Delete extends Button /** * Return 'onclick' action for the button (redirect to the integration edit page). * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - protected function _getOnclickAttribute(Object $row) + protected function _getOnclickAttribute(DataObject $row) { return sprintf( "this.setAttribute('data-url', '%s')", @@ -29,10 +29,10 @@ class Delete extends Button /** * Get title depending on whether element is disabled or not. * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - protected function _getTitleAttribute(Object $row) + protected function _getTitleAttribute(DataObject $row) { return $this->_isDisabled($row) ? __('Uninstall the extension to remove this integration') : __('Remove'); } @@ -40,10 +40,10 @@ class Delete extends Button /** * Determine whether current integration came from config file, thus can not be removed * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return bool */ - protected function _isDisabled(Object $row) + protected function _isDisabled(DataObject $row) { return $this->_isConfigBasedIntegration($row); } diff --git a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/Edit.php b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/Edit.php index d7a84108b70..1c3276e664d 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/Edit.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/Edit.php @@ -7,7 +7,7 @@ */ namespace Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer\Button; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer\Button; class Edit extends Button @@ -15,10 +15,10 @@ class Edit extends Button /** * Return 'onclick' action for the button (redirect to the integration edit page). * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - protected function _getOnclickAttribute(Object $row) + protected function _getOnclickAttribute(DataObject $row) { return sprintf("window.location.href='%s'", $this->getUrl('*/*/edit', ['id' => $row->getId()])); } @@ -26,10 +26,10 @@ class Edit extends Button /** * Get title depending on whether element is disabled or not. * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - protected function _getTitleAttribute(Object $row) + protected function _getTitleAttribute(DataObject $row) { return $this->_isConfigBasedIntegration($row) ? __('View') : __('Edit'); } @@ -37,10 +37,10 @@ class Edit extends Button /** * Get the icon on the grid according to the integration type * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function _getClassAttribute(Object $row) + public function _getClassAttribute(DataObject $row) { $class = $this->_isConfigBasedIntegration($row) ? 'info' : 'edit'; diff --git a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link.php b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link.php index 28bc811d5f4..b58cd5532db 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link.php @@ -8,11 +8,11 @@ namespace Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer; use Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer; -use Magento\Framework\Object; +use Magento\Framework\DataObject; class Link extends AbstractRenderer { - /** @var \Magento\Framework\Object */ + /** @var \Magento\Framework\DataObject */ protected $_row; /** @@ -37,10 +37,10 @@ class Link extends AbstractRenderer /** * Render grid row * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(Object $row) + public function render(DataObject $row) { $this->_row = $row; @@ -157,10 +157,10 @@ class Link extends AbstractRenderer /** * Render URL for current item. * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - protected function _getUrl(Object $row) + protected function _getUrl(DataObject $row) { return $this->isDisabled($row) ? '#' : $this->getUrl($this->getUrlPattern(), ['id' => $row->getId()]); } diff --git a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link/Activate.php b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link/Activate.php index 7855bc1ad62..31f327a6bca 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link/Activate.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link/Activate.php @@ -7,7 +7,7 @@ */ namespace Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer\Link; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer\Link; use Magento\Integration\Model\Integration; @@ -25,7 +25,7 @@ class Activate extends Link * {@inheritDoc} * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - protected function _getUrl(Object $row) + protected function _getUrl(DataObject $row) { return 'javascript:void(0);'; } diff --git a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Name.php b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Name.php index 84f7b9cd024..559c415fc03 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Name.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Name.php @@ -15,10 +15,10 @@ class Name extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Text * * If integration endpoint URL is unsecure then add error message to integration name. * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { /** @var \Magento\Integration\Model\Integration $row */ $text = parent::render($row); diff --git a/app/code/Magento/Integration/Test/Unit/Block/Adminhtml/Widget/Grid/Column/Renderer/ButtonTest.php b/app/code/Magento/Integration/Test/Unit/Block/Adminhtml/Widget/Grid/Column/Renderer/ButtonTest.php index 5f718df71a5..f2a60f7e472 100644 --- a/app/code/Magento/Integration/Test/Unit/Block/Adminhtml/Widget/Grid/Column/Renderer/ButtonTest.php +++ b/app/code/Magento/Integration/Test/Unit/Block/Adminhtml/Widget/Grid/Column/Renderer/ButtonTest.php @@ -63,7 +63,7 @@ class ButtonTest extends \PHPUnit_Framework_TestCase ->willReturn('name'); $this->buttonRenderer->setColumn($column); - $object = new \Magento\Framework\Object(['name' => 'my button']); + $object = new \Magento\Framework\DataObject(['name' => 'my button']); $actualResult = $this->buttonRenderer->render($object); $this->assertEquals($expectedResult, $actualResult); } diff --git a/app/code/Magento/Integration/Test/Unit/Block/Adminhtml/Widget/Grid/Column/Renderer/LinkTest.php b/app/code/Magento/Integration/Test/Unit/Block/Adminhtml/Widget/Grid/Column/Renderer/LinkTest.php index 8d308aeea0b..2a1d4f382ae 100644 --- a/app/code/Magento/Integration/Test/Unit/Block/Adminhtml/Widget/Grid/Column/Renderer/LinkTest.php +++ b/app/code/Magento/Integration/Test/Unit/Block/Adminhtml/Widget/Grid/Column/Renderer/LinkTest.php @@ -75,7 +75,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase ->method('getId') ->willReturn('1'); $this->linkRenderer->setColumn($column); - $object = new \Magento\Framework\Object(['id' => '1']); + $object = new \Magento\Framework\DataObject(['id' => '1']); $actualResult = $this->linkRenderer->render($object); $this->assertEquals($expectedResult, $actualResult); } diff --git a/app/code/Magento/Integration/Test/Unit/Controller/Adminhtml/IntegrationTest.php b/app/code/Magento/Integration/Test/Unit/Controller/Adminhtml/IntegrationTest.php index e0ec2e3555c..540dc4b7266 100644 --- a/app/code/Magento/Integration/Test/Unit/Controller/Adminhtml/IntegrationTest.php +++ b/app/code/Magento/Integration/Test/Unit/Controller/Adminhtml/IntegrationTest.php @@ -296,11 +296,11 @@ abstract class IntegrationTest extends \PHPUnit_Framework_TestCase /** * Return sample Integration Data * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function _getSampleIntegrationData() { - return new \Magento\Framework\Object( + return new \Magento\Framework\DataObject( [ Info::DATA_NAME => 'nameTest', Info::DATA_ID => self::INTEGRATION_ID, diff --git a/app/code/Magento/Integration/Test/Unit/Model/ManagerTest.php b/app/code/Magento/Integration/Test/Unit/Model/ManagerTest.php index adcf3a7e697..0b207a92dff 100644 --- a/app/code/Magento/Integration/Test/Unit/Model/ManagerTest.php +++ b/app/code/Magento/Integration/Test/Unit/Model/ManagerTest.php @@ -93,7 +93,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase ] ) ); - $intLookupData1 = new \Magento\Framework\Object( + $intLookupData1 = new \Magento\Framework\DataObject( ['id' => 1, Integration::NAME => 'TestIntegration1', Integration::SETUP_TYPE => 1] ); @@ -130,7 +130,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase )->with( 'TestIntegration2' )->will( - $this->returnValue(new \Magento\Framework\Object([])) + $this->returnValue(new \Magento\Framework\DataObject([])) ); $this->_integrationServiceMock->expects($this->once())->method('update')->with($intUpdateData1); diff --git a/app/code/Magento/Integration/Test/Unit/Oauth/OauthTest.php b/app/code/Magento/Integration/Test/Unit/Oauth/OauthTest.php index 5012a69aed0..ed2578ef97b 100644 --- a/app/code/Magento/Integration/Test/Unit/Oauth/OauthTest.php +++ b/app/code/Magento/Integration/Test/Unit/Oauth/OauthTest.php @@ -210,7 +210,7 @@ class OauthTest extends \PHPUnit_Framework_TestCase )->method( 'loadByKey' )->will( - $this->returnValue(new \Magento\Framework\Object()) + $this->returnValue(new \Magento\Framework\DataObject()) ); $this->_oauth->getRequestToken($this->_getRequestTokenParams(), self::REQUEST_URL); @@ -253,7 +253,7 @@ class OauthTest extends \PHPUnit_Framework_TestCase )->method( 'load' )->will( - $this->returnValue(new \Magento\Framework\Object()) + $this->returnValue(new \Magento\Framework\DataObject()) ); } @@ -355,7 +355,7 @@ class OauthTest extends \PHPUnit_Framework_TestCase )->method( 'loadByKey' )->will( - $this->returnValue(new \Magento\Framework\Object()) + $this->returnValue(new \Magento\Framework\DataObject()) ); $this->_oauth->getRequestToken($this->_getRequestTokenParams(), self::REQUEST_URL); diff --git a/app/code/Magento/Log/Block/Adminhtml/Online/Grid/Renderer/Ip.php b/app/code/Magento/Log/Block/Adminhtml/Online/Grid/Renderer/Ip.php index 871863af274..3af9b66925f 100644 --- a/app/code/Magento/Log/Block/Adminhtml/Online/Grid/Renderer/Ip.php +++ b/app/code/Magento/Log/Block/Adminhtml/Online/Grid/Renderer/Ip.php @@ -13,10 +13,10 @@ namespace Magento\Log\Block\Adminhtml\Online\Grid\Renderer; class Ip extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { /** - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { return long2ip($row->getData($this->getColumn()->getIndex())); } diff --git a/app/code/Magento/Log/Block/Adminhtml/Online/Grid/Renderer/Type.php b/app/code/Magento/Log/Block/Adminhtml/Online/Grid/Renderer/Type.php index 0adbf2d7520..c3ce8926e58 100644 --- a/app/code/Magento/Log/Block/Adminhtml/Online/Grid/Renderer/Type.php +++ b/app/code/Magento/Log/Block/Adminhtml/Online/Grid/Renderer/Type.php @@ -13,10 +13,10 @@ namespace Magento\Log\Block\Adminhtml\Online\Grid\Renderer; class Type extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { /** - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { return $row->getCustomerId() > 0 ? __('Customer') : __('Visitor'); } diff --git a/app/code/Magento/Log/Block/Adminhtml/Online/Grid/Renderer/Url.php b/app/code/Magento/Log/Block/Adminhtml/Online/Grid/Renderer/Url.php index ecd90e9498f..9716d35adde 100644 --- a/app/code/Magento/Log/Block/Adminhtml/Online/Grid/Renderer/Url.php +++ b/app/code/Magento/Log/Block/Adminhtml/Online/Grid/Renderer/Url.php @@ -16,10 +16,10 @@ class Url extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRen /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { return htmlspecialchars($row->getData($this->getColumn()->getIndex())); } diff --git a/app/code/Magento/Log/Model/Resource/Visitor.php b/app/code/Magento/Log/Model/Resource/Visitor.php index ee98b9f8ef7..8674327b5fe 100644 --- a/app/code/Magento/Log/Model/Resource/Visitor.php +++ b/app/code/Magento/Log/Model/Resource/Visitor.php @@ -20,7 +20,7 @@ class Visitor extends \Magento\Framework\Model\Resource\Db\AbstractDb /** * Magento string lib * - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -38,14 +38,14 @@ class Visitor extends \Magento\Framework\Model\Resource\Db\AbstractDb * @param \Magento\Framework\Model\Resource\Db\Context $context * @param \Magento\Framework\Stdlib\DateTime\DateTime $date * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param string|null $resourcePrefix */ public function __construct( \Magento\Framework\Model\Resource\Db\Context $context, \Magento\Framework\Stdlib\DateTime\DateTime $date, \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, $resourcePrefix = null ) { $this->_date = $date; @@ -90,7 +90,7 @@ class Visitor extends \Magento\Framework\Model\Resource\Db\AbstractDb protected function _saveUrlInfo($visitor) { $adapter = $this->_getWriteAdapter(); - $data = new \Magento\Framework\Object( + $data = new \Magento\Framework\DataObject( [ 'url' => $this->string->substr($visitor->getUrl(), 0, 250), 'referer' => $this->string->substr($visitor->getHttpReferer(), 0, 250), @@ -145,7 +145,7 @@ class Visitor extends \Magento\Framework\Model\Resource\Db\AbstractDb /** * Perform actions after object load * - * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\Object $object + * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\DataObject $object * @return \Magento\Framework\Model\Resource\Db\AbstractDb */ protected function _afterLoad(\Magento\Framework\Model\AbstractModel $object) @@ -189,7 +189,7 @@ class Visitor extends \Magento\Framework\Model\Resource\Db\AbstractDb $language = $this->string->cleanString($visitor->getHttpAcceptLanguage()); $language = $this->string->substr($language, 0, 255); - $data = new \Magento\Framework\Object( + $data = new \Magento\Framework\DataObject( [ 'visitor_id' => $visitor->getId(), 'http_referer' => $referer, @@ -217,7 +217,7 @@ class Visitor extends \Magento\Framework\Model\Resource\Db\AbstractDb */ protected function _saveVisitorUrl($visitor) { - $data = new \Magento\Framework\Object( + $data = new \Magento\Framework\DataObject( [ 'url_id' => $visitor->getLastUrlId(), 'visitor_id' => $visitor->getId(), @@ -241,7 +241,7 @@ class Visitor extends \Magento\Framework\Model\Resource\Db\AbstractDb $adapter = $this->_getWriteAdapter(); if ($visitor->getDoCustomerLogin()) { - $data = new \Magento\Framework\Object( + $data = new \Magento\Framework\DataObject( [ 'visitor_id' => $visitor->getVisitorId(), 'customer_id' => $visitor->getCustomerId(), @@ -257,7 +257,7 @@ class Visitor extends \Magento\Framework\Model\Resource\Db\AbstractDb } if ($visitor->getDoCustomerLogout() && ($logId = $visitor->getCustomerLogId())) { - $data = new \Magento\Framework\Object( + $data = new \Magento\Framework\DataObject( [ 'logout_at' => $this->_date->gmtDate(), 'store_id' => (int)$this->_storeManager->getStore()->getId(), @@ -288,7 +288,7 @@ class Visitor extends \Magento\Framework\Model\Resource\Db\AbstractDb { $adapter = $this->_getWriteAdapter(); if ($visitor->getDoQuoteCreate()) { - $data = new \Magento\Framework\Object( + $data = new \Magento\Framework\DataObject( [ 'quote_id' => (int)$visitor->getQuoteId(), 'visitor_id' => (int)$visitor->getId(), diff --git a/app/code/Magento/Log/Model/Resource/Visitor/Online/Grid/Row/UrlGenerator.php b/app/code/Magento/Log/Model/Resource/Visitor/Online/Grid/Row/UrlGenerator.php index 388e42a6cda..c327e7bbc21 100644 --- a/app/code/Magento/Log/Model/Resource/Visitor/Online/Grid/Row/UrlGenerator.php +++ b/app/code/Magento/Log/Model/Resource/Visitor/Online/Grid/Row/UrlGenerator.php @@ -30,7 +30,7 @@ class UrlGenerator extends \Magento\Backend\Model\Widget\Grid\Row\UrlGenerator /** * Create url for passed item using passed url model - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return string */ public function getUrl($item) diff --git a/app/code/Magento/Log/Test/Unit/Model/VisitorTest.php b/app/code/Magento/Log/Test/Unit/Model/VisitorTest.php index 9e970f2c88c..6f4a27537c0 100644 --- a/app/code/Magento/Log/Test/Unit/Model/VisitorTest.php +++ b/app/code/Magento/Log/Test/Unit/Model/VisitorTest.php @@ -151,8 +151,8 @@ class VisitorTest extends \PHPUnit_Framework_TestCase $this->resource->expects($this->once())->method('save')->will($this->returnSelf()); $this->resource->expects($this->never())->method('beginTransaction'); - $event = new \Magento\Framework\Object(['visitor' => $visitor]); - $observer = new \Magento\Framework\Object(['event' => $event]); + $event = new \Magento\Framework\DataObject(['visitor' => $visitor]); + $observer = new \Magento\Framework\DataObject(['event' => $event]); $this->assertSame($this->visitor, $this->visitor->logNewVisitor($observer)); } @@ -166,8 +166,8 @@ class VisitorTest extends \PHPUnit_Framework_TestCase $this->resource->expects($this->once())->method('save')->will($this->returnSelf()); $this->resource->expects($this->never())->method('beginTransaction'); - $event = new \Magento\Framework\Object(['visitor' => $visitor]); - $observer = new \Magento\Framework\Object(['event' => $event]); + $event = new \Magento\Framework\DataObject(['visitor' => $visitor]); + $observer = new \Magento\Framework\DataObject(['event' => $event]); $this->assertSame($this->visitor, $this->visitor->logVisitorActivity($observer)); } } diff --git a/app/code/Magento/MediaStorage/Test/Unit/Model/Resource/Db/AbstractTest.php b/app/code/Magento/MediaStorage/Test/Unit/Model/Resource/Db/AbstractTest.php index 2cc515cc7fb..f76ff1e7dfc 100644 --- a/app/code/Magento/MediaStorage/Test/Unit/Model/Resource/Db/AbstractTest.php +++ b/app/code/Magento/MediaStorage/Test/Unit/Model/Resource/Db/AbstractTest.php @@ -48,7 +48,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase */ public function testGetConnectionInMemoryCaching() { - $string = $this->getMock('Magento\Framework\Stdlib\String', [], [], '', false); + $string = $this->getMock('Magento\Framework\Stdlib\StringUtils', [], [], '', false); $dateTime = $this->getMock('Magento\Framework\Stdlib\DateTime', null, [], '', true); $logger = $this->getMockForAbstractClass('Magento\Framework\DB\LoggerInterface'); $connection = new \Magento\Framework\DB\Adapter\Pdo\Mysql( diff --git a/app/code/Magento/Multishipping/Block/Checkout/Addresses.php b/app/code/Magento/Multishipping/Block/Checkout/Addresses.php index bdff027736e..2045c49851d 100644 --- a/app/code/Magento/Multishipping/Block/Checkout/Addresses.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Addresses.php @@ -14,7 +14,7 @@ use Magento\Customer\Model\Address\Config as AddressConfig; class Addresses extends \Magento\Sales\Block\Items\AbstractItems { /** - * @var \Magento\Framework\Filter\Object\GridFactory + * @var \Magento\Framework\Filter\DataObject\GridFactory */ protected $_filterGridFactory; @@ -42,7 +42,7 @@ class Addresses extends \Magento\Sales\Block\Items\AbstractItems * Constructor * * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Framework\Filter\Object\GridFactory $filterGridFactory + * @param \Magento\Framework\Filter\DataObject\GridFactory $filterGridFactory * @param \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping * @param \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository * @param AddressConfig $addressConfig @@ -51,7 +51,7 @@ class Addresses extends \Magento\Sales\Block\Items\AbstractItems */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Framework\Filter\Object\GridFactory $filterGridFactory, + \Magento\Framework\Filter\DataObject\GridFactory $filterGridFactory, \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping, \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository, AddressConfig $addressConfig, @@ -94,7 +94,7 @@ class Addresses extends \Magento\Sales\Block\Items\AbstractItems public function getItems() { $items = $this->getCheckout()->getQuoteShippingAddressesItems(); - /** @var \Magento\Framework\Filter\Object\Grid $itemsFilter */ + /** @var \Magento\Framework\Filter\DataObject\Grid $itemsFilter */ $itemsFilter = $this->_filterGridFactory->create(); $itemsFilter->addFilter(new \Magento\Framework\Filter\Sprintf('%d'), 'qty'); return $itemsFilter->filter($items); diff --git a/app/code/Magento/Multishipping/Block/Checkout/Overview.php b/app/code/Magento/Multishipping/Block/Checkout/Overview.php index 68f3632f777..4cccf0ead90 100644 --- a/app/code/Magento/Multishipping/Block/Checkout/Overview.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Overview.php @@ -98,12 +98,12 @@ class Overview extends \Magento\Sales\Block\Items\AbstractItems /** * Get object with payment info posted data * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getPayment() { if (!$this->hasData('payment')) { - $payment = new \Magento\Framework\Object($this->getRequest()->getPost('payment')); + $payment = new \Magento\Framework\DataObject($this->getRequest()->getPost('payment')); $this->setData('payment', $payment); } return $this->_getData('payment'); @@ -353,10 +353,10 @@ class Overview extends \Magento\Sales\Block\Items\AbstractItems /** * Return row-level item html * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return string */ - public function getRowItemHtml(\Magento\Framework\Object $item) + public function getRowItemHtml(\Magento\Framework\DataObject $item) { $type = $this->_getItemType($item); $renderer = $this->_getRowItemRenderer($type)->setItem($item); diff --git a/app/code/Magento/Multishipping/Block/Checkout/Shipping.php b/app/code/Magento/Multishipping/Block/Checkout/Shipping.php index 589bfbb3bee..f2e63db897f 100644 --- a/app/code/Magento/Multishipping/Block/Checkout/Shipping.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Shipping.php @@ -16,7 +16,7 @@ use Magento\Quote\Model\Quote\Address; class Shipping extends \Magento\Sales\Block\Items\AbstractItems { /** - * @var \Magento\Framework\Filter\Object\GridFactory + * @var \Magento\Framework\Filter\DataObject\GridFactory */ protected $_filterGridFactory; @@ -32,7 +32,7 @@ class Shipping extends \Magento\Sales\Block\Items\AbstractItems /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Framework\Filter\Object\GridFactory $filterGridFactory + * @param \Magento\Framework\Filter\DataObject\GridFactory $filterGridFactory * @param \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping * @param \Magento\Tax\Helper\Data $taxHelper * @param PriceCurrencyInterface $priceCurrency @@ -40,7 +40,7 @@ class Shipping extends \Magento\Sales\Block\Items\AbstractItems */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Framework\Filter\Object\GridFactory $filterGridFactory, + \Magento\Framework\Filter\DataObject\GridFactory $filterGridFactory, \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping, \Magento\Tax\Helper\Data $taxHelper, PriceCurrencyInterface $priceCurrency, @@ -98,7 +98,7 @@ class Shipping extends \Magento\Sales\Block\Items\AbstractItems /** * @param Address $address - * @return \Magento\Framework\Object[] + * @return \Magento\Framework\DataObject[] */ public function getAddressItems($address) { @@ -202,12 +202,12 @@ class Shipping extends \Magento\Sales\Block\Items\AbstractItems /** * Retrieve text for items box * - * @param \Magento\Framework\Object $addressEntity + * @param \Magento\Framework\DataObject $addressEntity * @return string * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function getItemsBoxTextAfter(\Magento\Framework\Object $addressEntity) + public function getItemsBoxTextAfter(\Magento\Framework\DataObject $addressEntity) { return ''; } diff --git a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php index 7d44458a8f0..6fb6c151142 100644 --- a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php +++ b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php @@ -19,7 +19,7 @@ use Magento\Framework\Exception\LocalizedException; * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Multishipping extends \Magento\Framework\Object +class Multishipping extends \Magento\Framework\DataObject { /** * Quote shipping addresses items cache diff --git a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping/State.php b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping/State.php index 793a808e2a2..abcc5ad6e70 100644 --- a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping/State.php +++ b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping/State.php @@ -13,7 +13,7 @@ use Magento\Multishipping\Model\Checkout\Type\Multishipping; * * @author Magento Core Team <core@magentocommerce.com> */ -class State extends \Magento\Framework\Object +class State extends \Magento\Framework\DataObject { const STEP_SELECT_ADDRESSES = 'multishipping_addresses'; @@ -56,11 +56,11 @@ class State extends \Magento\Framework\Object $this->_multishipping = $multishipping; parent::__construct(); $this->_steps = [ - self::STEP_SELECT_ADDRESSES => new \Magento\Framework\Object(['label' => __('Select Addresses')]), - self::STEP_SHIPPING => new \Magento\Framework\Object(['label' => __('Shipping Information')]), - self::STEP_BILLING => new \Magento\Framework\Object(['label' => __('Billing Information')]), - self::STEP_OVERVIEW => new \Magento\Framework\Object(['label' => __('Place Order')]), - self::STEP_SUCCESS => new \Magento\Framework\Object(['label' => __('Order Success')]), + self::STEP_SELECT_ADDRESSES => new \Magento\Framework\DataObject(['label' => __('Select Addresses')]), + self::STEP_SHIPPING => new \Magento\Framework\DataObject(['label' => __('Shipping Information')]), + self::STEP_BILLING => new \Magento\Framework\DataObject(['label' => __('Billing Information')]), + self::STEP_OVERVIEW => new \Magento\Framework\DataObject(['label' => __('Place Order')]), + self::STEP_SUCCESS => new \Magento\Framework\DataObject(['label' => __('Order Success')]), ]; foreach ($this->_steps as $step) { diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Problem/Grid/Renderer/Checkbox.php b/app/code/Magento/Newsletter/Block/Adminhtml/Problem/Grid/Renderer/Checkbox.php index b78b0b1324f..191bd97ceda 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Problem/Grid/Renderer/Checkbox.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Problem/Grid/Renderer/Checkbox.php @@ -16,10 +16,10 @@ class Checkbox extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { return '<input type="checkbox" name="problem[]" value="' . $row->getId() . '" class="problemCheckbox"/>'; } diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Grid/Renderer/Action.php b/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Grid/Renderer/Action.php index 95d0815ac91..4d35830c1ed 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Grid/Renderer/Action.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Grid/Renderer/Action.php @@ -16,10 +16,10 @@ class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Action /** * Renders column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $actions = []; diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Renderer/Checkbox.php b/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Renderer/Checkbox.php index 7af982dc099..00462ea3a76 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Renderer/Checkbox.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Renderer/Checkbox.php @@ -16,10 +16,10 @@ class Checkbox extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { if ($row->getSubscriberStatus() == \Magento\Newsletter\Model\Subscriber::STATUS_SUBSCRIBED) { return '<input type="checkbox" name="subscriber[]" value="' . diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid.php b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid.php index 62c785e2d72..98d8c3310fe 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid.php @@ -155,7 +155,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended /** * Get row url * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ public function getRowUrl($row) diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid/Renderer/Action.php b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid/Renderer/Action.php index 14cc0331724..a7ffde66db9 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid/Renderer/Action.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid/Renderer/Action.php @@ -16,10 +16,10 @@ class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Action /** * Renderer for "Action" column in Newsletter templates grid * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { if ($row->isValidForSend()) { $actions[] = [ diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid/Renderer/Sender.php b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid/Renderer/Sender.php index 40a3838fcb5..e9352bf1626 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid/Renderer/Sender.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid/Renderer/Sender.php @@ -16,10 +16,10 @@ class Sender extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstract /** * Renderer for "Action" column in Newsletter templates grid * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $str = ''; if ($row->getTemplateSenderName()) { diff --git a/app/code/Magento/OfflinePayments/Model/Purchaseorder.php b/app/code/Magento/OfflinePayments/Model/Purchaseorder.php index d6f1baaadeb..c5d76b0be87 100644 --- a/app/code/Magento/OfflinePayments/Model/Purchaseorder.php +++ b/app/code/Magento/OfflinePayments/Model/Purchaseorder.php @@ -41,13 +41,13 @@ class Purchaseorder extends \Magento\Payment\Model\Method\AbstractMethod /** * Assign data to info model instance * - * @param \Magento\Framework\Object|mixed $data + * @param \Magento\Framework\DataObject|mixed $data * @return $this */ public function assignData($data) { - if (!$data instanceof \Magento\Framework\Object) { - $data = new \Magento\Framework\Object($data); + if (!$data instanceof \Magento\Framework\DataObject) { + $data = new \Magento\Framework\DataObject($data); } $this->getInfoInstance()->setPoNumber($data->getPoNumber()); diff --git a/app/code/Magento/OfflinePayments/Test/Unit/Model/PurchaseorderTest.php b/app/code/Magento/OfflinePayments/Test/Unit/Model/PurchaseorderTest.php index a00d58a6568..73a26db22cd 100644 --- a/app/code/Magento/OfflinePayments/Test/Unit/Model/PurchaseorderTest.php +++ b/app/code/Magento/OfflinePayments/Test/Unit/Model/PurchaseorderTest.php @@ -41,7 +41,7 @@ class PurchaseorderTest extends \PHPUnit_Framework_TestCase public function testAssignData() { - $data = new \Magento\Framework\Object([ + $data = new \Magento\Framework\DataObject([ 'po_number' => '12345' ]); diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php b/app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php index d85a0d771d2..aa227ffb1ed 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php @@ -55,12 +55,12 @@ class Flatrate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implement } /** - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return Result|bool * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - public function collectRates(\Magento\Framework\Object $request) + public function collectRates(\Magento\Framework\DataObject $request) { if (!$this->getConfigFlag('active')) { return false; diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php b/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php index fdbc3c26467..1222735d599 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php @@ -58,10 +58,10 @@ class Freeshipping extends \Magento\Shipping\Model\Carrier\AbstractCarrier imple /** * FreeShipping Rates Collector * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return \Magento\Shipping\Model\Rate\Result|bool */ - public function collectRates(\Magento\Framework\Object $request) + public function collectRates(\Magento\Framework\DataObject $request) { if (!$this->getConfigFlag('active')) { return false; diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Pickup.php b/app/code/Magento/OfflineShipping/Model/Carrier/Pickup.php index 40df2042c04..b06eaf213ad 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Pickup.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Pickup.php @@ -50,11 +50,11 @@ class Pickup extends \Magento\Shipping\Model\Carrier\AbstractCarrier implements } /** - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return \Magento\Shipping\Model\Rate\Result * @SuppressWarnings(PHPMD.UnusedLocalVariable) */ - public function collectRates(\Magento\Framework\Object $request) + public function collectRates(\Magento\Framework\DataObject $request) { if (!$this->getConfigFlag('active')) { return false; diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php index b89948409eb..af11dad2696 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php @@ -74,13 +74,13 @@ class Tablerate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implemen } /** - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return \Magento\Shipping\Model\Rate\Result * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - public function collectRates(\Magento\Framework\Object $request) + public function collectRates(\Magento\Framework\DataObject $request) { if (!$this->getConfigFlag('active')) { return false; diff --git a/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate.php b/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate.php index f6794bd0b02..28b33f88e4b 100644 --- a/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate.php +++ b/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate.php @@ -242,7 +242,7 @@ class Tablerate extends \Magento\Framework\Model\Resource\Db\AbstractDb /** * Upload table rate file and import data from it * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @throws \Magento\Framework\Exception\LocalizedException * @return \Magento\OfflineShipping\Model\Resource\Carrier\Tablerate * @todo: this method should be refactored as soon as updated design will be provided @@ -250,7 +250,7 @@ class Tablerate extends \Magento\Framework\Model\Resource\Db\AbstractDb * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - public function uploadAndImport(\Magento\Framework\Object $object) + public function uploadAndImport(\Magento\Framework\DataObject $object) { if (empty($_FILES['groups']['tmp_name']['tablerate']['fields']['import']['value'])) { return $this; diff --git a/app/code/Magento/OfflineShipping/etc/fieldset.xml b/app/code/Magento/OfflineShipping/etc/fieldset.xml index 17c6cfaa6d4..0e9c27801c8 100644 --- a/app/code/Magento/OfflineShipping/etc/fieldset.xml +++ b/app/code/Magento/OfflineShipping/etc/fieldset.xml @@ -6,7 +6,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Object/etc/fieldset.xsd"> + xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/DataObject/etc/fieldset.xsd"> <scope id="global"> <fieldset id="quote_convert_item"> <field name="free_shipping"> diff --git a/app/code/Magento/PageCache/Controller/Block/Esi.php b/app/code/Magento/PageCache/Controller/Block/Esi.php index 93fa5a6f057..e21aabd7cfd 100644 --- a/app/code/Magento/PageCache/Controller/Block/Esi.php +++ b/app/code/Magento/PageCache/Controller/Block/Esi.php @@ -24,7 +24,7 @@ class Esi extends \Magento\PageCache\Controller\Block $blockInstance = array_shift($blocks); $html = $blockInstance->toHtml(); $ttl = $blockInstance->getTtl(); - if ($blockInstance instanceof \Magento\Framework\Object\IdentityInterface) { + if ($blockInstance instanceof \Magento\Framework\DataObject\IdentityInterface) { $response->setHeader('X-Magento-Tags', implode(',', $blockInstance->getIdentities())); } } diff --git a/app/code/Magento/PageCache/Controller/Block/Render.php b/app/code/Magento/PageCache/Controller/Block/Render.php index 789fb1b696f..499973ae1e1 100644 --- a/app/code/Magento/PageCache/Controller/Block/Render.php +++ b/app/code/Magento/PageCache/Controller/Block/Render.php @@ -27,7 +27,9 @@ class Render extends \Magento\PageCache\Controller\Block $currentRequestUri = $this->getRequest()->getRequestUri(); $origRequest = $this->getRequest()->getParam('originalRequest'); - $origRequest = json_decode($origRequest, true); + if ($origRequest && is_string($origRequest)) { + $origRequest = json_decode($origRequest, true); + } $this->getRequest()->setRouteName($origRequest['route']); $this->getRequest()->setControllerName($origRequest['controller']); $this->getRequest()->setActionName($origRequest['action']); diff --git a/app/code/Magento/PageCache/Model/Layout/LayoutPlugin.php b/app/code/Magento/PageCache/Model/Layout/LayoutPlugin.php index cc745692290..8bbbfc158d6 100644 --- a/app/code/Magento/PageCache/Model/Layout/LayoutPlugin.php +++ b/app/code/Magento/PageCache/Model/Layout/LayoutPlugin.php @@ -62,7 +62,7 @@ class LayoutPlugin if ($subject->isCacheable() && $this->config->isEnabled()) { $tags = []; foreach ($subject->getAllBlocks() as $block) { - if ($block instanceof \Magento\Framework\Object\IdentityInterface) { + if ($block instanceof \Magento\Framework\DataObject\IdentityInterface) { $isEsiBlock = $block->getTtl() > 0; $isVarnish = $this->config->getType() == \Magento\PageCache\Model\Config::VARNISH; if ($isVarnish && $isEsiBlock) { diff --git a/app/code/Magento/PageCache/Model/Observer/FlushCacheByTags.php b/app/code/Magento/PageCache/Model/Observer/FlushCacheByTags.php index 45192819f34..9b678126670 100644 --- a/app/code/Magento/PageCache/Model/Observer/FlushCacheByTags.php +++ b/app/code/Magento/PageCache/Model/Observer/FlushCacheByTags.php @@ -41,7 +41,7 @@ class FlushCacheByTags { if ($this->_config->getType() == \Magento\PageCache\Model\Config::BUILT_IN && $this->_config->isEnabled()) { $object = $observer->getEvent()->getObject(); - if ($object instanceof \Magento\Framework\Object\IdentityInterface) { + if ($object instanceof \Magento\Framework\DataObject\IdentityInterface) { $tags = $object->getIdentities(); foreach ($tags as $tag) { $tags[] = preg_replace("~_\\d+$~", '', $tag); diff --git a/app/code/Magento/PageCache/Model/Observer/InvalidateCacheIfChanged.php b/app/code/Magento/PageCache/Model/Observer/InvalidateCacheIfChanged.php index da5f388c6c7..5fed9765f96 100644 --- a/app/code/Magento/PageCache/Model/Observer/InvalidateCacheIfChanged.php +++ b/app/code/Magento/PageCache/Model/Observer/InvalidateCacheIfChanged.php @@ -44,7 +44,7 @@ class InvalidateCacheIfChanged { if ($this->config->isEnabled()) { $object = $observer->getEvent()->getObject(); - if ($object instanceof \Magento\Framework\Object\IdentityInterface) { + if ($object instanceof \Magento\Framework\DataObject\IdentityInterface) { if ($object->getIdentities()) { $this->typeList->invalidate('full_page'); } diff --git a/app/code/Magento/PageCache/Test/Unit/Block/Controller/StubBlock.php b/app/code/Magento/PageCache/Test/Unit/Block/Controller/StubBlock.php index 0a9a9b2fee0..dbbc32b3c92 100644 --- a/app/code/Magento/PageCache/Test/Unit/Block/Controller/StubBlock.php +++ b/app/code/Magento/PageCache/Test/Unit/Block/Controller/StubBlock.php @@ -6,7 +6,7 @@ namespace Magento\PageCache\Test\Unit\Block\Controller; -use Magento\Framework\Object\IdentityInterface; +use Magento\Framework\DataObject\IdentityInterface; use Magento\Framework\View\Element\AbstractBlock; class StubBlock extends AbstractBlock implements IdentityInterface diff --git a/app/code/Magento/PageCache/Test/Unit/Model/Observer/InvalidateCacheIfChangedTest.php b/app/code/Magento/PageCache/Test/Unit/Model/Observer/InvalidateCacheIfChangedTest.php index c10379d6b24..ab737387238 100644 --- a/app/code/Magento/PageCache/Test/Unit/Model/Observer/InvalidateCacheIfChangedTest.php +++ b/app/code/Magento/PageCache/Test/Unit/Model/Observer/InvalidateCacheIfChangedTest.php @@ -20,7 +20,7 @@ class InvalidateCacheIfChangedTest extends \PHPUnit_Framework_TestCase /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Event\Observer */ protected $observerMock; - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Object\IdentityInterface */ + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\DataObject\IdentityInterface */ protected $objectMock; /** @@ -44,7 +44,12 @@ class InvalidateCacheIfChangedTest extends \PHPUnit_Framework_TestCase $this->observerMock = $this->getMock('Magento\Framework\Event\Observer', [], [], '', false); $eventMock = $this->getMock('Magento\Framework\Event', ['getObject'], [], '', false); - $this->objectMock = $this->getMockForAbstractClass('Magento\Framework\Object\IdentityInterface', [], '', false); + $this->objectMock = $this->getMockForAbstractClass( + 'Magento\Framework\DataObject\IdentityInterface', + [], + '', + false + ); $eventMock->expects($this->any())->method('getObject')->willReturn($this->objectMock); $this->observerMock->expects($this->any())->method('getEvent')->willReturn($eventMock); } diff --git a/app/code/Magento/PageCache/Test/Unit/Model/Observer/ProcessLayoutRenderElementTest.php b/app/code/Magento/PageCache/Test/Unit/Model/Observer/ProcessLayoutRenderElementTest.php index 1601b85f477..3bdc74f0d26 100644 --- a/app/code/Magento/PageCache/Test/Unit/Model/Observer/ProcessLayoutRenderElementTest.php +++ b/app/code/Magento/PageCache/Test/Unit/Model/Observer/ProcessLayoutRenderElementTest.php @@ -29,7 +29,7 @@ class ProcessLayoutRenderElementTest extends \PHPUnit_Framework_TestCase /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Event\Observer */ protected $_observerMock; - /** @var \Magento\Framework\Object */ + /** @var \Magento\Framework\DataObject */ protected $_transport; /** @@ -69,7 +69,7 @@ class ProcessLayoutRenderElementTest extends \PHPUnit_Framework_TestCase true, ['getData', 'isScopePrivate', 'getNameInLayout', 'getUrl'] ); - $this->_transport = new \Magento\Framework\Object(['output' => 'test output html']); + $this->_transport = new \Magento\Framework\DataObject(['output' => 'test output html']); } /** diff --git a/app/code/Magento/Payment/Block/ConfigurableInfo.php b/app/code/Magento/Payment/Block/ConfigurableInfo.php index 954cb6cecbd..95273d62ae0 100644 --- a/app/code/Magento/Payment/Block/ConfigurableInfo.php +++ b/app/code/Magento/Payment/Block/ConfigurableInfo.php @@ -41,8 +41,8 @@ class ConfigurableInfo extends \Magento\Payment\Block\Info /** * Prepare PayPal-specific payment information * - * @param \Magento\Framework\Object|array|null $transport - * @return \Magento\Framework\Object + * @param \Magento\Framework\DataObject|array|null $transport + * @return \Magento\Framework\DataObject */ protected function _prepareSpecificInformation($transport = null) { @@ -73,13 +73,13 @@ class ConfigurableInfo extends \Magento\Payment\Block\Info /** * Sets data to transport * - * @param \Magento\Framework\Object $transport + * @param \Magento\Framework\DataObject $transport * @param string $field * @param string $value * @return void */ protected function setDataToTransfer( - \Magento\Framework\Object $transport, + \Magento\Framework\DataObject $transport, $field, $value ) { diff --git a/app/code/Magento/Payment/Block/Info.php b/app/code/Magento/Payment/Block/Info.php index 94c8b8c998d..8e7f6e60340 100644 --- a/app/code/Magento/Payment/Block/Info.php +++ b/app/code/Magento/Payment/Block/Info.php @@ -13,7 +13,7 @@ class Info extends \Magento\Framework\View\Element\Template /** * Payment rendered specific information * - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $_paymentSpecificInformation; @@ -141,16 +141,16 @@ class Info extends \Magento\Framework\View\Element\Template /** * Prepare information specific to current payment method * - * @param null|\Magento\Framework\Object|array $transport - * @return \Magento\Framework\Object + * @param null|\Magento\Framework\DataObject|array $transport + * @return \Magento\Framework\DataObject */ protected function _prepareSpecificInformation($transport = null) { if (null === $this->_paymentSpecificInformation) { if (null === $transport) { - $transport = new \Magento\Framework\Object(); + $transport = new \Magento\Framework\DataObject(); } elseif (is_array($transport)) { - $transport = new \Magento\Framework\Object($transport); + $transport = new \Magento\Framework\DataObject($transport); } $this->_paymentSpecificInformation = $transport; } diff --git a/app/code/Magento/Payment/Block/Info/Cc.php b/app/code/Magento/Payment/Block/Info/Cc.php index 6e6c0af6148..05b06b064e0 100644 --- a/app/code/Magento/Payment/Block/Info/Cc.php +++ b/app/code/Magento/Payment/Block/Info/Cc.php @@ -85,8 +85,8 @@ class Cc extends \Magento\Payment\Block\Info /** * Prepare credit card related payment info * - * @param \Magento\Framework\Object|array $transport - * @return \Magento\Framework\Object + * @param \Magento\Framework\DataObject|array $transport + * @return \Magento\Framework\DataObject */ protected function _prepareSpecificInformation($transport = null) { diff --git a/app/code/Magento/Payment/Model/Cart.php b/app/code/Magento/Payment/Model/Cart.php index 436bdc899a4..f12254abd54 100644 --- a/app/code/Magento/Payment/Model/Cart.php +++ b/app/code/Magento/Payment/Model/Cart.php @@ -411,11 +411,11 @@ class Cart * @param int $qty * @param float $amount * @param null|string $identifier - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function _createItemFromData($name, $qty, $amount, $identifier = null) { - $item = new \Magento\Framework\Object(['name' => $name, 'qty' => $qty, 'amount' => (double)$amount]); + $item = new \Magento\Framework\DataObject(['name' => $name, 'qty' => $qty, 'amount' => (double)$amount]); if ($identifier) { $item->setData('id', $identifier); diff --git a/app/code/Magento/Payment/Model/Cart/SalesModel/Order.php b/app/code/Magento/Payment/Model/Cart/SalesModel/Order.php index edaf5bac89c..8caeb8acb80 100644 --- a/app/code/Magento/Payment/Model/Cart/SalesModel/Order.php +++ b/app/code/Magento/Payment/Model/Cart/SalesModel/Order.php @@ -33,7 +33,7 @@ class Order implements \Magento\Payment\Model\Cart\SalesModel\SalesModelInterfac $resultItems = []; foreach ($this->_salesModel->getAllItems() as $item) { - $resultItems[] = new \Magento\Framework\Object( + $resultItems[] = new \Magento\Framework\DataObject( [ 'parent_item' => $item->getParentItem(), 'name' => $item->getName(), diff --git a/app/code/Magento/Payment/Model/Cart/SalesModel/Quote.php b/app/code/Magento/Payment/Model/Cart/SalesModel/Quote.php index e63c59eedb7..ea2093d851c 100644 --- a/app/code/Magento/Payment/Model/Cart/SalesModel/Quote.php +++ b/app/code/Magento/Payment/Model/Cart/SalesModel/Quote.php @@ -45,7 +45,7 @@ class Quote implements \Magento\Payment\Model\Cart\SalesModel\SalesModelInterfac $resultItems = []; foreach ($this->_salesModel->getAllItems() as $item) { - $resultItems[] = new \Magento\Framework\Object( + $resultItems[] = new \Magento\Framework\DataObject( [ 'parent_item' => $item->getParentItem(), 'name' => $item->getName(), diff --git a/app/code/Magento/Payment/Model/Cart/SalesModel/SalesModelInterface.php b/app/code/Magento/Payment/Model/Cart/SalesModel/SalesModelInterface.php index a210f55bb3a..e73aca9f2cf 100644 --- a/app/code/Magento/Payment/Model/Cart/SalesModel/SalesModelInterface.php +++ b/app/code/Magento/Payment/Model/Cart/SalesModel/SalesModelInterface.php @@ -43,7 +43,7 @@ interface SalesModelInterface public function getBaseDiscountAmount(); /** - * Wrapper for \Magento\Framework\Object getDataUsingMethod method + * Wrapper for \Magento\Framework\DataObject getDataUsingMethod method * * @param string $key * @param mixed $args diff --git a/app/code/Magento/Payment/Model/Method/AbstractMethod.php b/app/code/Magento/Payment/Model/Method/AbstractMethod.php index c41efbfa721..9701d741ae4 100644 --- a/app/code/Magento/Payment/Model/Method/AbstractMethod.php +++ b/app/code/Magento/Payment/Model/Method/AbstractMethod.php @@ -359,7 +359,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl /** * Check void availability * @return bool - * @internal param \Magento\Framework\Object $payment + * @internal param \Magento\Framework\DataObject $payment * @api */ public function canVoid() @@ -581,7 +581,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl /** * Order payment abstract method * - * @param \Magento\Framework\Object|InfoInterface $payment + * @param \Magento\Framework\DataObject|InfoInterface $payment * @param float $amount * @return $this * @throws \Magento\Framework\Exception\LocalizedException @@ -599,7 +599,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl /** * Authorize payment abstract method * - * @param \Magento\Framework\Object|InfoInterface $payment + * @param \Magento\Framework\DataObject|InfoInterface $payment * @param float $amount * @return $this * @throws \Magento\Framework\Exception\LocalizedException @@ -617,7 +617,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl /** * Capture payment abstract method * - * @param \Magento\Framework\Object|InfoInterface $payment + * @param \Magento\Framework\DataObject|InfoInterface $payment * @param float $amount * @return $this * @throws \Magento\Framework\Exception\LocalizedException @@ -636,7 +636,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl /** * Refund specified amount for payment * - * @param \Magento\Framework\Object|InfoInterface $payment + * @param \Magento\Framework\DataObject|InfoInterface $payment * @param float $amount * @return $this * @throws \Magento\Framework\Exception\LocalizedException @@ -654,7 +654,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl /** * Cancel payment abstract method * - * @param \Magento\Framework\Object|InfoInterface $payment + * @param \Magento\Framework\DataObject|InfoInterface $payment * @return $this * @api * @SuppressWarnings(PHPMD.UnusedFormalParameter) @@ -667,7 +667,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl /** * Void payment abstract method * - * @param \Magento\Framework\Object|InfoInterface $payment + * @param \Magento\Framework\DataObject|InfoInterface $payment * @return $this * @throws \Magento\Framework\Exception\LocalizedException * @api @@ -758,7 +758,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl /** * Assign data to info model instance * - * @param array|\Magento\Framework\Object $data + * @param array|\Magento\Framework\DataObject $data * @return $this * @api */ @@ -766,7 +766,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl { if (is_array($data)) { $this->getInfoInstance()->addData($data); - } elseif ($data instanceof \Magento\Framework\Object) { + } elseif ($data instanceof \Magento\Framework\DataObject) { $this->getInfoInstance()->addData($data->getData()); } return $this; diff --git a/app/code/Magento/Payment/Model/Method/Adapter.php b/app/code/Magento/Payment/Model/Method/Adapter.php index 8a0268f0d04..8b4d035bcb7 100644 --- a/app/code/Magento/Payment/Model/Method/Adapter.php +++ b/app/code/Magento/Payment/Model/Method/Adapter.php @@ -579,7 +579,7 @@ class Adapter implements MethodInterface { if (is_array($data)) { $this->getInfoInstance()->addData($data); - } elseif ($data instanceof \Magento\Framework\Object) { + } elseif ($data instanceof \Magento\Framework\DataObject) { $this->getInfoInstance()->addData($data->getData()); } return $this; diff --git a/app/code/Magento/Payment/Model/Method/Cc.php b/app/code/Magento/Payment/Model/Method/Cc.php index 9f84700d7da..407617e8c2e 100644 --- a/app/code/Magento/Payment/Model/Method/Cc.php +++ b/app/code/Magento/Payment/Model/Method/Cc.php @@ -84,13 +84,13 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod /** * Assign data to info model instance * - * @param \Magento\Framework\Object|mixed $data + * @param \Magento\Framework\DataObject|mixed $data * @return $this */ public function assignData($data) { - if (!$data instanceof \Magento\Framework\Object) { - $data = new \Magento\Framework\Object($data); + if (!$data instanceof \Magento\Framework\DataObject) { + $data = new \Magento\Framework\DataObject($data); } $info = $this->getInfoInstance(); $info->setCcType( diff --git a/app/code/Magento/Payment/Model/Method/Online/GatewayInterface.php b/app/code/Magento/Payment/Model/Method/Online/GatewayInterface.php index 4a99a7e8308..a1307e3a2ca 100644 --- a/app/code/Magento/Payment/Model/Method/Online/GatewayInterface.php +++ b/app/code/Magento/Payment/Model/Method/Online/GatewayInterface.php @@ -5,7 +5,7 @@ */ namespace Magento\Payment\Model\Method\Online; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Payment\Model\Method\ConfigInterface; /** @@ -21,9 +21,9 @@ interface GatewayInterface * @param Object $request * @param ConfigInterface $config * - * @return Object + * @return DataObject * * @throws \Exception */ - public function postRequest(Object $request, ConfigInterface $config); + public function postRequest(DataObject $request, ConfigInterface $config); } diff --git a/app/code/Magento/Payment/Model/MethodInterface.php b/app/code/Magento/Payment/Model/MethodInterface.php index 8ff23d1a0bf..f9d1fb89d87 100644 --- a/app/code/Magento/Payment/Model/MethodInterface.php +++ b/app/code/Magento/Payment/Model/MethodInterface.php @@ -236,7 +236,7 @@ interface MethodInterface /** * Order payment abstract method * - * @param \Magento\Framework\Object|InfoInterface $payment + * @param \Magento\Framework\DataObject|InfoInterface $payment * @param float $amount * @return $this * @api @@ -246,7 +246,7 @@ interface MethodInterface /** * Authorize payment abstract method * - * @param \Magento\Framework\Object|InfoInterface $payment + * @param \Magento\Framework\DataObject|InfoInterface $payment * @param float $amount * @return $this * @api @@ -256,7 +256,7 @@ interface MethodInterface /** * Capture payment abstract method * - * @param \Magento\Framework\Object|InfoInterface $payment + * @param \Magento\Framework\DataObject|InfoInterface $payment * @param float $amount * @return $this * @api @@ -266,7 +266,7 @@ interface MethodInterface /** * Refund specified amount for payment * - * @param \Magento\Framework\Object|InfoInterface $payment + * @param \Magento\Framework\DataObject|InfoInterface $payment * @param float $amount * @return $this * @api @@ -276,7 +276,7 @@ interface MethodInterface /** * Cancel payment abstract method * - * @param \Magento\Framework\Object|InfoInterface $payment + * @param \Magento\Framework\DataObject|InfoInterface $payment * @return $this * @api */ @@ -285,7 +285,7 @@ interface MethodInterface /** * Void payment abstract method * - * @param \Magento\Framework\Object|InfoInterface $payment + * @param \Magento\Framework\DataObject|InfoInterface $payment * @return $this * @api */ @@ -331,7 +331,7 @@ interface MethodInterface /** * Assign data to info model instance * - * @param array|\Magento\Framework\Object $data + * @param array|\Magento\Framework\DataObject $data * @return $this * @api * @deprecated diff --git a/app/code/Magento/Payment/Model/Paygate/Result.php b/app/code/Magento/Payment/Model/Paygate/Result.php index 853b34f59bb..00b0144d3cb 100644 --- a/app/code/Magento/Payment/Model/Paygate/Result.php +++ b/app/code/Magento/Payment/Model/Paygate/Result.php @@ -5,6 +5,6 @@ */ namespace Magento\Payment\Model\Paygate; -class Result extends \Magento\Framework\Object +class Result extends \Magento\Framework\DataObject { } diff --git a/app/code/Magento/Payment/Test/Unit/Block/Adminhtml/Transparent/FormTest.php b/app/code/Magento/Payment/Test/Unit/Block/Adminhtml/Transparent/FormTest.php index 3281e616a64..8d006ac36c6 100644 --- a/app/code/Magento/Payment/Test/Unit/Block/Adminhtml/Transparent/FormTest.php +++ b/app/code/Magento/Payment/Test/Unit/Block/Adminhtml/Transparent/FormTest.php @@ -6,7 +6,7 @@ namespace Magento\Payment\Test\Unit\Block\Adminhtml\Transparent; use Magento\Framework\App\RequestInterface; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Framework\UrlInterface; use Magento\Payment\Model\Method\TransparentInterface; diff --git a/app/code/Magento/Payment/Test/Unit/Block/FormTest.php b/app/code/Magento/Payment/Test/Unit/Block/FormTest.php index c99001dbf2d..173159df416 100644 --- a/app/code/Magento/Payment/Test/Unit/Block/FormTest.php +++ b/app/code/Magento/Payment/Test/Unit/Block/FormTest.php @@ -8,7 +8,7 @@ namespace Magento\Payment\Test\Unit\Block; -use Magento\Framework\Object; +use Magento\Framework\DataObject; class FormTest extends \PHPUnit_Framework_TestCase { @@ -62,7 +62,7 @@ class FormTest extends \PHPUnit_Framework_TestCase */ public function testGetMethodException() { - $method = new \Magento\Framework\Object([]); + $method = new \Magento\Framework\DataObject([]); $this->_object->setData('method', $method); $this->_object->getMethod(); } diff --git a/app/code/Magento/Payment/Test/Unit/Block/InfoTest.php b/app/code/Magento/Payment/Test/Unit/Block/InfoTest.php index 9a1f83b92df..1b103a30e76 100644 --- a/app/code/Magento/Payment/Test/Unit/Block/InfoTest.php +++ b/app/code/Magento/Payment/Test/Unit/Block/InfoTest.php @@ -5,7 +5,7 @@ */ namespace Magento\Payment\Test\Unit\Block; -use Magento\Framework\Object; +use Magento\Framework\DataObject; class InfoTest extends \PHPUnit_Framework_TestCase { @@ -125,7 +125,7 @@ class InfoTest extends \PHPUnit_Framework_TestCase */ public function testGetInfoThrowException() { - $this->_object->setData('info', new \Magento\Framework\Object([])); + $this->_object->setData('info', new \Magento\Framework\DataObject([])); $this->_object->getInfo(); } diff --git a/app/code/Magento/Payment/Test/Unit/Block/Transparent/FormTest.php b/app/code/Magento/Payment/Test/Unit/Block/Transparent/FormTest.php index 6a6342ef7ab..d5f99cf0940 100644 --- a/app/code/Magento/Payment/Test/Unit/Block/Transparent/FormTest.php +++ b/app/code/Magento/Payment/Test/Unit/Block/Transparent/FormTest.php @@ -7,7 +7,7 @@ namespace Magento\Payment\Test\Unit\Block\Transparent; use Magento\Checkout\Model\Session; use Magento\Framework\App\RequestInterface; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Framework\UrlInterface; use Magento\Payment\Model\Method\TransparentInterface; diff --git a/app/code/Magento/Payment/Test/Unit/Model/Cart/SalesModel/OrderTest.php b/app/code/Magento/Payment/Test/Unit/Model/Cart/SalesModel/OrderTest.php index 8b6c23d1f57..b928108edf1 100644 --- a/app/code/Magento/Payment/Test/Unit/Model/Cart/SalesModel/OrderTest.php +++ b/app/code/Magento/Payment/Test/Unit/Model/Cart/SalesModel/OrderTest.php @@ -52,18 +52,18 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetAllItems() { $items = [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( ['parent_item' => 'parent item 1', 'name' => 'name 1', 'qty_ordered' => 1, 'base_price' => 0.1] ), - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( ['parent_item' => 'parent item 2', 'name' => 'name 2', 'qty_ordered' => 2, 'base_price' => 1.2] ), - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( ['parent_item' => 'parent item 3', 'name' => 'name 3', 'qty_ordered' => 3, 'base_price' => 2.3] ), ]; $expected = [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'parent_item' => 'parent item 1', 'name' => 'name 1', @@ -72,7 +72,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase 'original_item' => $items[0], ] ), - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'parent_item' => 'parent item 2', 'name' => 'name 2', @@ -81,7 +81,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase 'original_item' => $items[1], ] ), - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'parent_item' => 'parent item 3', 'name' => 'name 3', diff --git a/app/code/Magento/Payment/Test/Unit/Model/Cart/SalesModel/QuoteTest.php b/app/code/Magento/Payment/Test/Unit/Model/Cart/SalesModel/QuoteTest.php index 0a5aa8a80ac..484f4d8e1a9 100644 --- a/app/code/Magento/Payment/Test/Unit/Model/Cart/SalesModel/QuoteTest.php +++ b/app/code/Magento/Payment/Test/Unit/Model/Cart/SalesModel/QuoteTest.php @@ -70,7 +70,7 @@ class QuoteTest extends \PHPUnit_Framework_TestCase $itemMock->expects($this->any())->method('getTotalQty')->will($this->returnValue($qty)); $itemMock->expects($this->any())->method('getBaseCalculationPrice')->will($this->returnValue($price)); $expected = [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'parent_item' => $pItem, 'name' => $name, diff --git a/app/code/Magento/Payment/Test/Unit/Model/CartTest.php b/app/code/Magento/Payment/Test/Unit/Model/CartTest.php index b65ea5e1064..e823c7b55d8 100644 --- a/app/code/Magento/Payment/Test/Unit/Model/CartTest.php +++ b/app/code/Magento/Payment/Test/Unit/Model/CartTest.php @@ -7,7 +7,6 @@ namespace Magento\Payment\Test\Unit\Model; use \Magento\Payment\Model\Cart; - class CartTest extends \PHPUnit_Framework_TestCase { /** @var \Magento\Payment\Model\Cart */ @@ -91,12 +90,12 @@ class CartTest extends \PHPUnit_Framework_TestCase $customItems = []; if ($transferFlags['transfer_shipping']) { - $customItems[] = new \Magento\Framework\Object( + $customItems[] = new \Magento\Framework\DataObject( ['name' => 'Shipping', 'qty' => 1, 'amount' => $salesModelAmounts['BaseShippingAmount']] ); } if ($transferFlags['transfer_discount']) { - $customItems[] = new \Magento\Framework\Object( + $customItems[] = new \Magento\Framework\DataObject( ['name' => 'Discount', 'qty' => 1, 'amount' => -1.00 * $salesModelAmounts['BaseDiscountAmount']] ); } @@ -277,15 +276,15 @@ class CartTest extends \PHPUnit_Framework_TestCase */ protected function _getSalesModelItems() { - $product = new \Magento\Framework\Object(['id' => '1']); + $product = new \Magento\Framework\DataObject(['id' => '1']); return [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( ['name' => 'name 1', 'qty' => 1, 'price' => 0.1, 'original_item' => $product] ), - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( ['name' => 'name 2', 'qty' => 2, 'price' => 1.2, 'original_item' => $product] ), - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'parent_item' => 'parent item 3', 'name' => 'name 3', @@ -310,7 +309,7 @@ class CartTest extends \PHPUnit_Framework_TestCase if ($item->getParentItem()) { continue; } - $result[] = new \Magento\Framework\Object( + $result[] = new \Magento\Framework\DataObject( [ 'name' => $item->getName(), 'qty' => $item->getQty(), diff --git a/app/code/Magento/Paypal/Block/Billing/Agreements.php b/app/code/Magento/Paypal/Block/Billing/Agreements.php index 10b6754f6e1..703a2ea4b20 100644 --- a/app/code/Magento/Paypal/Block/Billing/Agreements.php +++ b/app/code/Magento/Paypal/Block/Billing/Agreements.php @@ -102,7 +102,7 @@ class Agreements extends \Magento\Framework\View\Element\Template /** * Retrieve item value by key * - * @param \Magento\Framework\Object|\Magento\Paypal\Model\Billing\Agreement $item + * @param \Magento\Framework\DataObject|\Magento\Paypal\Model\Billing\Agreement $item * @param string $key * @return string */ diff --git a/app/code/Magento/Paypal/Block/Express/Review.php b/app/code/Magento/Paypal/Block/Express/Review.php index 21632fac2eb..049a6dd4efa 100644 --- a/app/code/Magento/Paypal/Block/Express/Review.php +++ b/app/code/Magento/Paypal/Block/Express/Review.php @@ -142,10 +142,10 @@ class Review extends \Magento\Framework\View\Element\Template /** * Get either shipping rate code or empty value on error * - * @param \Magento\Framework\Object $rate + * @param \Magento\Framework\DataObject $rate * @return string */ - public function renderShippingRateValue(\Magento\Framework\Object $rate) + public function renderShippingRateValue(\Magento\Framework\DataObject $rate) { if ($rate->getErrorMessage()) { return ''; @@ -156,7 +156,7 @@ class Review extends \Magento\Framework\View\Element\Template /** * Get shipping rate code title and its price or error message * - * @param \Magento\Framework\Object $rate + * @param \Magento\Framework\DataObject $rate * @param string $format * @param string $inclTaxFormat * @return string diff --git a/app/code/Magento/Paypal/Block/Payment/Info.php b/app/code/Magento/Paypal/Block/Payment/Info.php index 33a864e9bd3..fc31261ce32 100644 --- a/app/code/Magento/Paypal/Block/Payment/Info.php +++ b/app/code/Magento/Paypal/Block/Payment/Info.php @@ -47,8 +47,8 @@ class Info extends \Magento\Payment\Block\Info\Cc /** * Prepare PayPal-specific payment information * - * @param \Magento\Framework\Object|array|null $transport - * @return \Magento\Framework\Object + * @param \Magento\Framework\DataObject|array|null $transport + * @return \Magento\Framework\DataObject */ protected function _prepareSpecificInformation($transport = null) { diff --git a/app/code/Magento/Paypal/Block/Payment/Info/Billing/Agreement.php b/app/code/Magento/Paypal/Block/Payment/Info/Billing/Agreement.php index a8b8ce6fdf8..20c9e109e88 100644 --- a/app/code/Magento/Paypal/Block/Payment/Info/Billing/Agreement.php +++ b/app/code/Magento/Paypal/Block/Payment/Info/Billing/Agreement.php @@ -13,8 +13,8 @@ class Agreement extends \Magento\Payment\Block\Info /** * Add reference id to payment method information * - * @param \Magento\Framework\Object|array|null $transport - * @return \Magento\Framework\Object + * @param \Magento\Framework\DataObject|array|null $transport + * @return \Magento\Framework\DataObject */ protected function _prepareSpecificInformation($transport = null) { @@ -25,7 +25,7 @@ class Agreement extends \Magento\Payment\Block\Info $referenceID = $info->getAdditionalInformation( \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgreement::PAYMENT_INFO_REFERENCE_ID ); - $transport = new \Magento\Framework\Object([(string)__('Reference ID') => $referenceID]); + $transport = new \Magento\Framework\DataObject([(string)__('Reference ID') => $referenceID]); $transport = parent::_prepareSpecificInformation($transport); return $transport; diff --git a/app/code/Magento/Paypal/Model/Api/AbstractApi.php b/app/code/Magento/Paypal/Model/Api/AbstractApi.php index 38d65b98c94..b6c44054538 100644 --- a/app/code/Magento/Paypal/Model/Api/AbstractApi.php +++ b/app/code/Magento/Paypal/Model/Api/AbstractApi.php @@ -10,7 +10,7 @@ use Magento\Payment\Model\Method\Logger; /** * Abstract class for Paypal API wrappers */ -abstract class AbstractApi extends \Magento\Framework\Object +abstract class AbstractApi extends \Magento\Framework\DataObject { /** * Config instance @@ -285,25 +285,25 @@ abstract class AbstractApi extends \Magento\Framework\Object /** * Import $this public data to specified object or array * - * @param array|\Magento\Framework\Object $to + * @param array|\Magento\Framework\DataObject $to * @param array $publicMap - * @return array|\Magento\Framework\Object + * @return array|\Magento\Framework\DataObject */ public function import($to, array $publicMap = []) { - return \Magento\Framework\Object\Mapper::accumulateByMap([$this, 'getDataUsingMethod'], $to, $publicMap); + return \Magento\Framework\DataObject\Mapper::accumulateByMap([$this, 'getDataUsingMethod'], $to, $publicMap); } /** * Export $this public data from specified object or array * - * @param array|\Magento\Framework\Object $from + * @param array|\Magento\Framework\DataObject $from * @param array $publicMap * @return $this */ public function export($from, array $publicMap = []) { - \Magento\Framework\Object\Mapper::accumulateByMap($from, [$this, 'setDataUsingMethod'], $publicMap); + \Magento\Framework\DataObject\Mapper::accumulateByMap($from, [$this, 'setDataUsingMethod'], $publicMap); return $this; } @@ -366,7 +366,7 @@ abstract class AbstractApi extends \Magento\Framework\Object $map[$this->_globalMap[$key]] = $key; } } - $result = \Magento\Framework\Object\Mapper::accumulateByMap([$this, 'getDataUsingMethod'], $request, $map); + $result = \Magento\Framework\DataObject\Mapper::accumulateByMap([$this, 'getDataUsingMethod'], $request, $map); foreach ($privateRequestMap as $key) { if (isset($this->_exportToRequestFilters[$key]) && isset($result[$key])) { $callback = $this->_exportToRequestFilters[$key]; @@ -397,7 +397,7 @@ abstract class AbstractApi extends \Magento\Framework\Object $response[$key] = call_user_func([$this, $callback], $response[$key], $key, $map[$key]); } } - \Magento\Framework\Object\Mapper::accumulateByMap($response, [$this, 'setDataUsingMethod'], $map); + \Magento\Framework\DataObject\Mapper::accumulateByMap($response, [$this, 'setDataUsingMethod'], $map); } /** @@ -532,10 +532,10 @@ abstract class AbstractApi extends \Magento\Framework\Object /** * region_id workaround: PayPal requires state code, try to find one in the address * - * @param \Magento\Framework\Object $address + * @param \Magento\Framework\DataObject $address * @return string */ - protected function _lookupRegionCodeFromAddress(\Magento\Framework\Object $address) + protected function _lookupRegionCodeFromAddress(\Magento\Framework\DataObject $address) { $regionId = $address->getData('region_id'); if ($regionId) { @@ -551,11 +551,11 @@ abstract class AbstractApi extends \Magento\Framework\Object * Street address workaround: divides address lines into parts by specified keys * (keys should go as 3rd, 4th[...] parameters) * - * @param \Magento\Framework\Object $address + * @param \Magento\Framework\DataObject $address * @param array $to * @return void */ - protected function _importStreetFromAddress(\Magento\Framework\Object $address, array &$to) + protected function _importStreetFromAddress(\Magento\Framework\DataObject $address, array &$to) { $keys = func_get_args(); array_shift($keys); diff --git a/app/code/Magento/Paypal/Model/Api/Nvp.php b/app/code/Magento/Paypal/Model/Api/Nvp.php index e1faeb04d5d..5902cc8cb56 100644 --- a/app/code/Magento/Paypal/Model/Api/Nvp.php +++ b/app/code/Magento/Paypal/Model/Api/Nvp.php @@ -1088,12 +1088,12 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi * Import callback request array into $this public data * * @param array $request - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function prepareShippingOptionsCallbackAddress(array $request) { - $address = new \Magento\Framework\Object(); - \Magento\Framework\Object\Mapper::accumulateByMap($request, $address, $this->_callbackRequestMap); + $address = new \Magento\Framework\DataObject(); + \Magento\Framework\DataObject\Mapper::accumulateByMap($request, $address, $this->_callbackRequestMap); $address->setExportedKeys(array_values($this->_callbackRequestMap)); $this->_applyStreetAndRegionWorkarounds($address); return $address; @@ -1455,15 +1455,15 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi */ protected function _exportAddressses($data) { - $address = new \Magento\Framework\Object(); - \Magento\Framework\Object\Mapper::accumulateByMap($data, $address, $this->_billingAddressMap); + $address = new \Magento\Framework\DataObject(); + \Magento\Framework\DataObject\Mapper::accumulateByMap($data, $address, $this->_billingAddressMap); $address->setExportedKeys(array_values($this->_billingAddressMap)); $this->_applyStreetAndRegionWorkarounds($address); $this->setExportedBillingAddress($address); // assume there is shipping address if there is at least one field specific to shipping if (isset($data['SHIPTONAME'])) { $shippingAddress = clone $address; - \Magento\Framework\Object\Mapper::accumulateByMap($data, $shippingAddress, $this->_shippingAddressMap); + \Magento\Framework\DataObject\Mapper::accumulateByMap($data, $shippingAddress, $this->_shippingAddressMap); $this->_applyStreetAndRegionWorkarounds($shippingAddress); // PayPal doesn't provide detailed shipping name fields, so the name will be overwritten $shippingAddress->addData(['firstname' => $data['SHIPTONAME']]); @@ -1474,10 +1474,10 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi /** * Adopt specified address object to be compatible with Magento * - * @param \Magento\Framework\Object $address + * @param \Magento\Framework\DataObject $address * @return void */ - protected function _applyStreetAndRegionWorkarounds(\Magento\Framework\Object $address) + protected function _applyStreetAndRegionWorkarounds(\Magento\Framework\DataObject $address) { // merge street addresses into 1 if ($address->hasStreet2()) { @@ -1512,7 +1512,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi $billingAddress = $this->getBillingAddress() ? $this->getBillingAddress() : $this->getAddress(); $shippingAddress = $this->getAddress(); - $to = \Magento\Framework\Object\Mapper::accumulateByMap( + $to = \Magento\Framework\DataObject\Mapper::accumulateByMap( $billingAddress, $to, array_merge(array_flip($this->_billingAddressMap), $this->_billingAddressMapRequest) @@ -1522,7 +1522,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi $to['STATE'] = $regionCode; } if (!$this->getSuppressShipping()) { - $to = \Magento\Framework\Object\Mapper::accumulateByMap( + $to = \Magento\Framework\DataObject\Mapper::accumulateByMap( $shippingAddress, $to, array_flip($this->_shippingAddressMap) diff --git a/app/code/Magento/Paypal/Model/Config.php b/app/code/Magento/Paypal/Model/Config.php index e894c5a39b6..0dc844d0d2d 100644 --- a/app/code/Magento/Paypal/Model/Config.php +++ b/app/code/Magento/Paypal/Model/Config.php @@ -1311,10 +1311,10 @@ class Config extends AbstractConfig /** * Export page style current settings to specified object * - * @param \Magento\Framework\Object $to + * @param \Magento\Framework\DataObject $to * @return void */ - public function exportExpressCheckoutStyleSettings(\Magento\Framework\Object $to) + public function exportExpressCheckoutStyleSettings(\Magento\Framework\DataObject $to) { foreach ($this->_ecStyleConfigMap as $key => $exportKey) { $configValue = $this->getValue($key); diff --git a/app/code/Magento/Paypal/Model/Config/Rules/Reader.php b/app/code/Magento/Paypal/Model/Config/Rules/Reader.php index 452c8dc5eff..e1536118fe8 100644 --- a/app/code/Magento/Paypal/Model/Config/Rules/Reader.php +++ b/app/code/Magento/Paypal/Model/Config/Rules/Reader.php @@ -8,7 +8,7 @@ namespace Magento\Paypal\Model\Config\Rules; use Magento\Framework\Config\FileResolverInterface; use Magento\Framework\Config\SchemaLocatorInterface; use Magento\Framework\Config\ValidationStateInterface; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\Config\Reader\Filesystem; use Magento\Paypal\Helper\Backend; diff --git a/app/code/Magento/Paypal/Model/Direct.php b/app/code/Magento/Paypal/Model/Direct.php index 5fe3c4d3a96..e7ab0fc1615 100644 --- a/app/code/Magento/Paypal/Model/Direct.php +++ b/app/code/Magento/Paypal/Model/Direct.php @@ -299,7 +299,7 @@ class Direct extends \Magento\Payment\Model\Method\Cc /** * Authorize payment * - * @param \Magento\Framework\Object|\Magento\Payment\Model\InfoInterface|Payment $payment + * @param \Magento\Framework\DataObject|\Magento\Payment\Model\InfoInterface|Payment $payment * @param float $amount * @return $this */ @@ -311,7 +311,7 @@ class Direct extends \Magento\Payment\Model\Method\Cc /** * Void payment * - * @param \Magento\Framework\Object|\Magento\Payment\Model\InfoInterface|Payment $payment + * @param \Magento\Framework\DataObject|\Magento\Payment\Model\InfoInterface|Payment $payment * @return $this * @throws \Magento\Framework\Exception\LocalizedException */ @@ -324,7 +324,7 @@ class Direct extends \Magento\Payment\Model\Method\Cc /** * Capture payment * - * @param \Magento\Framework\Object|\Magento\Payment\Model\InfoInterface|Payment $payment + * @param \Magento\Framework\DataObject|\Magento\Payment\Model\InfoInterface|Payment $payment * @param float $amount * @return $this */ @@ -339,7 +339,7 @@ class Direct extends \Magento\Payment\Model\Method\Cc /** * Refund capture * - * @param \Magento\Framework\Object|\Magento\Payment\Model\InfoInterface|Payment $payment + * @param \Magento\Framework\DataObject|\Magento\Payment\Model\InfoInterface|Payment $payment * @param float $amount * @return $this * @throws \Magento\Framework\Exception\LocalizedException @@ -353,7 +353,7 @@ class Direct extends \Magento\Payment\Model\Method\Cc /** * Cancel payment * - * @param \Magento\Framework\Object|\Magento\Payment\Model\InfoInterface|Payment $payment + * @param \Magento\Framework\DataObject|\Magento\Payment\Model\InfoInterface|Payment $payment * @return $this */ public function cancel(\Magento\Payment\Model\InfoInterface $payment) @@ -505,7 +505,7 @@ class Direct extends \Magento\Payment\Model\Method\Cc /** * Check void availability * @return bool - * @internal param \Magento\Framework\Object $payment + * @internal param \Magento\Framework\DataObject $payment */ public function canVoid() { diff --git a/app/code/Magento/Paypal/Model/Express.php b/app/code/Magento/Paypal/Model/Express.php index 65e212c36d7..32c85cf2d99 100644 --- a/app/code/Magento/Paypal/Model/Express.php +++ b/app/code/Magento/Paypal/Model/Express.php @@ -344,7 +344,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod /** * Order payment * - * @param \Magento\Framework\Object|\Magento\Payment\Model\InfoInterface|Payment $payment + * @param \Magento\Framework\DataObject|\Magento\Payment\Model\InfoInterface|Payment $payment * @param float $amount * @return $this * @throws \Magento\Framework\Exception\LocalizedException @@ -414,7 +414,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod /** * Authorize payment * - * @param \Magento\Framework\Object|\Magento\Payment\Model\InfoInterface|Payment $payment + * @param \Magento\Framework\DataObject|\Magento\Payment\Model\InfoInterface|Payment $payment * @param float $amount * @return $this */ @@ -426,7 +426,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod /** * Void payment * - * @param \Magento\Framework\Object|\Magento\Payment\Model\InfoInterface|Payment $payment + * @param \Magento\Framework\DataObject|\Magento\Payment\Model\InfoInterface|Payment $payment * @return $this * @throws \Magento\Framework\Exception\LocalizedException */ @@ -450,7 +450,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod /** * Capture payment * - * @param \Magento\Framework\Object|\Magento\Payment\Model\InfoInterface|Payment $payment + * @param \Magento\Framework\DataObject|\Magento\Payment\Model\InfoInterface|Payment $payment * @param float $amount * @return $this * @SuppressWarnings(PHPMD.CyclomaticComplexity) @@ -477,7 +477,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod $payment->setParentTransactionId($authorizationTransaction->getTxnId()); $payment->unsTransactionId(); $payment->setVoidOnlyAuthorization(true); - $payment->void(new \Magento\Framework\Object()); + $payment->void(new \Magento\Framework\DataObject()); //Revert payment state after voiding $payment->unsAuthorizationTransaction(); @@ -541,7 +541,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod /** * Refund capture * - * @param \Magento\Framework\Object|\Magento\Payment\Model\InfoInterface|Payment $payment + * @param \Magento\Framework\DataObject|\Magento\Payment\Model\InfoInterface|Payment $payment * @param float $amount * @return $this * @throws \Magento\Framework\Exception\LocalizedException @@ -555,7 +555,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod /** * Cancel payment * - * @param \Magento\Framework\Object|\Magento\Payment\Model\InfoInterface|Payment $payment + * @param \Magento\Framework\DataObject|\Magento\Payment\Model\InfoInterface|Payment $payment * @return $this */ public function cancel(\Magento\Payment\Model\InfoInterface $payment) @@ -633,7 +633,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod /** * Assign data to info model instance * - * @param array|\Magento\Framework\Object $data + * @param array|\Magento\Framework\DataObject $data * @return \Magento\Payment\Model\Info */ public function assignData($data) @@ -642,7 +642,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod $key = ExpressCheckout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT; if (is_array($data)) { $this->getInfoInstance()->setAdditionalInformation($key, isset($data[$key]) ? $data[$key] : null); - } elseif ($data instanceof \Magento\Framework\Object) { + } elseif ($data instanceof \Magento\Framework\DataObject) { $this->getInfoInstance()->setAdditionalInformation($key, $data->getData($key)); } return $result; @@ -731,7 +731,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod * Check void availability * @return bool * @throws \Magento\Framework\Exception\LocalizedException - * @internal param \Magento\Framework\Object $payment + * @internal param \Magento\Framework\DataObject $payment */ public function canVoid() { @@ -779,7 +779,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod * Call DoAuthorize * * @param int $amount - * @param \Magento\Framework\Object $payment + * @param \Magento\Framework\DataObject $payment * @param string $parentTransactionId * @return \Magento\Paypal\Model\Api\AbstractApi */ diff --git a/app/code/Magento/Paypal/Model/Express/Checkout.php b/app/code/Magento/Paypal/Model/Express/Checkout.php index b9062fa0de9..72d7cf63398 100644 --- a/app/code/Magento/Paypal/Model/Express/Checkout.php +++ b/app/code/Magento/Paypal/Model/Express/Checkout.php @@ -11,6 +11,7 @@ use Magento\Paypal\Model\Config as PaypalConfig; use Magento\Paypal\Model\Express\Checkout\Quote as PaypalQuote; use Magento\Sales\Model\Order\Email\Sender\OrderSender; use Magento\Quote\Model\Quote\Address; +use Magento\Framework\DataObject; /** * Wrapper that performs Paypal Express and Checkout communication @@ -218,7 +219,7 @@ class Checkout protected $_apiTypeFactory; /** - * @var \Magento\Framework\Object\Copy + * @var \Magento\Framework\DataObject\Copy */ protected $_objectCopyService; @@ -283,7 +284,7 @@ class Checkout * @param \Magento\Quote\Model\QuoteManagement $quoteManagement * @param \Magento\Paypal\Model\Billing\AgreementFactory $agreementFactory * @param \Magento\Paypal\Model\Api\Type\Factory $apiTypeFactory - * @param \Magento\Framework\Object\Copy $objectCopyService + * @param \Magento\Framework\DataObject\Copy $objectCopyService * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Framework\Encryption\EncryptorInterface $encryptor * @param \Magento\Framework\Message\ManagerInterface $messageManager @@ -312,7 +313,7 @@ class Checkout \Magento\Quote\Model\QuoteManagement $quoteManagement, \Magento\Paypal\Model\Billing\AgreementFactory $agreementFactory, \Magento\Paypal\Model\Api\Type\Factory $apiTypeFactory, - \Magento\Framework\Object\Copy $objectCopyService, + \Magento\Framework\DataObject\Copy $objectCopyService, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Framework\Encryption\EncryptorInterface $encryptor, \Magento\Framework\Message\ManagerInterface $messageManager, @@ -1016,7 +1017,7 @@ class Checkout $amountExclTax = $this->_taxData->getShippingPrice($amount, false, $address); $amountInclTax = $this->_taxData->getShippingPrice($amount, true, $address); - $options[$i] = new \Magento\Framework\Object( + $options[$i] = new \Magento\Framework\DataObject( [ 'is_default' => $isDefault, 'name' => trim("{$rate->getCarrierTitle()} - {$rate->getMethodTitle()}", ' -'), @@ -1041,7 +1042,7 @@ class Checkout } if ($mayReturnEmpty && $userSelectedOption === null) { - $options[] = new \Magento\Framework\Object( + $options[] = new \Magento\Framework\DataObject( [ 'is_default' => true, 'name' => __('N/A'), @@ -1075,11 +1076,11 @@ class Checkout * This function is used as a callback comparison function in shipping options sorting process * @see self::_prepareShippingOptions() * - * @param \Magento\Framework\Object $option1 - * @param \Magento\Framework\Object $option2 + * @param \Magento\Framework\DataObject $option1 + * @param \Magento\Framework\DataObject $option2 * @return int */ - protected static function cmpShippingOptions(\Magento\Framework\Object $option1, \Magento\Framework\Object $option2) + protected static function cmpShippingOptions(DataObject $option1, DataObject $option2) { if ($option1->getAmount() == $option2->getAmount()) { return 0; diff --git a/app/code/Magento/Paypal/Model/Express/Checkout/Quote.php b/app/code/Magento/Paypal/Model/Express/Checkout/Quote.php index 7dc7008b560..8dde08a6552 100644 --- a/app/code/Magento/Paypal/Model/Express/Checkout/Quote.php +++ b/app/code/Magento/Paypal/Model/Express/Checkout/Quote.php @@ -8,7 +8,7 @@ namespace Magento\Paypal\Model\Express\Checkout; use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Api\Data\AddressInterfaceFactory; use Magento\Customer\Api\Data\CustomerInterfaceFactory; -use Magento\Framework\Object\Copy as CopyObject; +use Magento\Framework\DataObject\Copy as CopyObject; /** * Class Quote diff --git a/app/code/Magento/Paypal/Model/Hostedpro.php b/app/code/Magento/Paypal/Model/Hostedpro.php index b742988cf70..369e4464fd8 100644 --- a/app/code/Magento/Paypal/Model/Hostedpro.php +++ b/app/code/Magento/Paypal/Model/Hostedpro.php @@ -168,7 +168,7 @@ class Hostedpro extends \Magento\Paypal\Model\Direct * Instantiate state and set it to state object * * @param string $paymentAction - * @param \Magento\Framework\Object $stateObject + * @param \Magento\Framework\DataObject $stateObject * @return void */ public function initialize($paymentAction, $stateObject) diff --git a/app/code/Magento/Paypal/Model/Hostedpro/Request.php b/app/code/Magento/Paypal/Model/Hostedpro/Request.php index 74c2e2ae8fb..c1215777eb4 100644 --- a/app/code/Magento/Paypal/Model/Hostedpro/Request.php +++ b/app/code/Magento/Paypal/Model/Hostedpro/Request.php @@ -10,7 +10,7 @@ namespace Magento\Paypal\Model\Hostedpro; * * @author Magento Core Team <core@magentocommerce.com> */ -class Request extends \Magento\Framework\Object +class Request extends \Magento\Framework\DataObject { /** * Request's order model @@ -194,11 +194,11 @@ class Request extends \Magento\Framework\Object /** * Get shipping address request data * - * @param \Magento\Framework\Object $address + * @param \Magento\Framework\DataObject $address * @return array * @SuppressWarnings(PHPMD.NPathComplexity) */ - protected function _getShippingAddress(\Magento\Framework\Object $address) + protected function _getShippingAddress(\Magento\Framework\DataObject $address) { $region = $address->getRegionCode() ? $address->getRegionCode() : $address->getRegion(); $request = [ @@ -222,11 +222,11 @@ class Request extends \Magento\Framework\Object /** * Get billing address request data * - * @param \Magento\Framework\Object $address + * @param \Magento\Framework\DataObject $address * @return array * @SuppressWarnings(PHPMD.NPathComplexity) */ - protected function _getBillingAddress(\Magento\Framework\Object $address) + protected function _getBillingAddress(\Magento\Framework\DataObject $address) { $region = $address->getRegionCode() ? $address->getRegionCode() : $address->getRegion(); $request = [ diff --git a/app/code/Magento/Paypal/Model/Info.php b/app/code/Magento/Paypal/Model/Info.php index 84d4a81185e..748e3afcb70 100644 --- a/app/code/Magento/Paypal/Model/Info.php +++ b/app/code/Magento/Paypal/Model/Info.php @@ -299,7 +299,7 @@ class Info /** * Grab data from source and map it into payment * - * @param array|\Magento\Framework\Object|callback $from + * @param array|\Magento\Framework\DataObject|callback $from * @param \Magento\Payment\Model\InfoInterface $payment * @return void */ @@ -309,21 +309,21 @@ class Info if (is_object($from)) { $from = [$from, 'getDataUsingMethod']; } - \Magento\Framework\Object\Mapper::accumulateByMap($from, [$payment, 'setAdditionalInformation'], $fullMap); + \Magento\Framework\DataObject\Mapper::accumulateByMap($from, [$payment, 'setAdditionalInformation'], $fullMap); } /** * Grab data from payment and map it into target * * @param \Magento\Payment\Model\InfoInterface $payment - * @param array|\Magento\Framework\Object|callback $to + * @param array|\Magento\Framework\DataObject|callback $to * @param array|null $map - * @return array|\Magento\Framework\Object + * @return array|\Magento\Framework\DataObject */ public function &exportFromPayment(\Magento\Payment\Model\InfoInterface $payment, $to, array $map = null) { $fullMap = array_merge($this->_paymentMap, $this->_systemMap); - \Magento\Framework\Object\Mapper::accumulateByMap( + \Magento\Framework\DataObject\Mapper::accumulateByMap( [$payment, 'getAdditionalInformation'], $to, $map ? $map : array_flip($fullMap) diff --git a/app/code/Magento/Paypal/Model/Method/Agreement.php b/app/code/Magento/Paypal/Model/Method/Agreement.php index f78e08bd8cc..e567a483da2 100644 --- a/app/code/Magento/Paypal/Model/Method/Agreement.php +++ b/app/code/Magento/Paypal/Model/Method/Agreement.php @@ -278,7 +278,7 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr /** * Authorize payment * - * @param \Magento\Framework\Object|InfoInterface $payment + * @param \Magento\Framework\DataObject|InfoInterface $payment * @param float $amount * @return $this */ @@ -290,7 +290,7 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr /** * Void payment * - * @param \Magento\Framework\Object|InfoInterface|Payment $payment + * @param \Magento\Framework\DataObject|InfoInterface|Payment $payment * @return $this * @throws \Magento\Framework\Exception\LocalizedException */ @@ -303,7 +303,7 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr /** * Capture payment * - * @param \Magento\Framework\Object|InfoInterface|Payment $payment + * @param \Magento\Framework\DataObject|InfoInterface|Payment $payment * @param float $amount * @return $this */ @@ -318,7 +318,7 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr /** * Refund capture * - * @param \Magento\Framework\Object|InfoInterface|Payment $payment + * @param \Magento\Framework\DataObject|InfoInterface|Payment $payment * @param float $amount * @return $this * @throws \Magento\Framework\Exception\LocalizedException @@ -332,7 +332,7 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr /** * Cancel payment * - * @param \Magento\Framework\Object|InfoInterface|Payment $payment + * @param \Magento\Framework\DataObject|InfoInterface|Payment $payment * @return $this */ public function cancel(\Magento\Payment\Model\InfoInterface $payment) diff --git a/app/code/Magento/Paypal/Model/Payflow/Pro.php b/app/code/Magento/Paypal/Model/Payflow/Pro.php index 8bab857bf1e..5a33be4476d 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Pro.php +++ b/app/code/Magento/Paypal/Model/Payflow/Pro.php @@ -34,11 +34,11 @@ class Pro extends \Magento\Paypal\Model\Pro /** * Refund a capture transaction * - * @param \Magento\Framework\Object $payment + * @param \Magento\Framework\DataObject $payment * @param float $amount * @return void */ - public function refund(\Magento\Framework\Object $payment, $amount) + public function refund(\Magento\Framework\DataObject $payment, $amount) { $captureTxnId = $this->_getParentTransactionId($payment); if ($captureTxnId) { @@ -61,10 +61,10 @@ class Pro extends \Magento\Paypal\Model\Pro /** * Get payflow transaction id from parent transaction * - * @param \Magento\Framework\Object $payment + * @param \Magento\Framework\DataObject $payment * @return string */ - protected function _getParentTransactionId(\Magento\Framework\Object $payment) + protected function _getParentTransactionId(\Magento\Framework\DataObject $payment) { if ($payment->getParentTransactionId()) { return $payment->getTransaction( diff --git a/app/code/Magento/Paypal/Model/Payflow/Request.php b/app/code/Magento/Paypal/Model/Payflow/Request.php index e29e851646e..f8773636286 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Request.php +++ b/app/code/Magento/Paypal/Model/Payflow/Request.php @@ -10,7 +10,7 @@ namespace Magento\Paypal\Model\Payflow; * * @author Magento Core Team <core@magentocommerce.com> */ -class Request extends \Magento\Framework\Object +class Request extends \Magento\Framework\DataObject { /** * Set/Get attribute wrapper diff --git a/app/code/Magento/Paypal/Model/Payflow/Service/Gateway.php b/app/code/Magento/Paypal/Model/Payflow/Service/Gateway.php index 38c735bce8c..4c2e4bc845b 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Service/Gateway.php +++ b/app/code/Magento/Paypal/Model/Payflow/Service/Gateway.php @@ -11,7 +11,7 @@ use Magento\Framework\Math\Random; use Magento\Payment\Model\Method\Logger; use Magento\Payment\Model\Method\Online\GatewayInterface; use Magento\Payment\Model\Method\ConfigInterface; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Gateway Service @@ -51,15 +51,15 @@ class Gateway implements GatewayInterface /** * Post request into gateway * - * @param Object $request + * @param DataObject $request * @param ConfigInterface $config * - * @return Object + * @return DataObject * @throws \Exception */ - public function postRequest(Object $request, ConfigInterface $config) + public function postRequest(DataObject $request, ConfigInterface $config) { - $result = new Object(); + $result = new DataObject(); $clientConfig = [ 'maxredirects' => 5, diff --git a/app/code/Magento/Paypal/Model/Payflow/Service/Request/SecureToken.php b/app/code/Magento/Paypal/Model/Payflow/Service/Request/SecureToken.php index 4f85f65cdcb..b325255b318 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Service/Request/SecureToken.php +++ b/app/code/Magento/Paypal/Model/Payflow/Service/Request/SecureToken.php @@ -6,7 +6,7 @@ namespace Magento\Paypal\Model\Payflow\Service\Request; use Magento\Framework\Math\Random; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\UrlInterface; use Magento\Paypal\Model\Payflow\Transparent; use Magento\Paypal\Model\Payflowpro; diff --git a/app/code/Magento/Paypal/Model/Payflow/Service/Response/Handler/CreditCardValidationHandler.php b/app/code/Magento/Paypal/Model/Payflow/Service/Response/Handler/CreditCardValidationHandler.php index fee1f5e7a89..4bf561b71d0 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Service/Response/Handler/CreditCardValidationHandler.php +++ b/app/code/Magento/Paypal/Model/Payflow/Service/Response/Handler/CreditCardValidationHandler.php @@ -5,7 +5,7 @@ */ namespace Magento\Paypal\Model\Payflow\Service\Response\Handler; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Payment\Model\InfoInterface; use Magento\Paypal\Model\Info; @@ -37,7 +37,7 @@ class CreditCardValidationHandler implements HandlerInterface /** * {inheritdoc} */ - public function handle(InfoInterface $payment, Object $response) + public function handle(InfoInterface $payment, DataObject $response) { $importObject = []; foreach ($this->fieldsToHandle as $field) { diff --git a/app/code/Magento/Paypal/Model/Payflow/Service/Response/Handler/FraudHandler.php b/app/code/Magento/Paypal/Model/Payflow/Service/Response/Handler/FraudHandler.php index 63003f7f15c..730914f6f91 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Service/Response/Handler/FraudHandler.php +++ b/app/code/Magento/Paypal/Model/Payflow/Service/Response/Handler/FraudHandler.php @@ -5,7 +5,7 @@ */ namespace Magento\Paypal\Model\Payflow\Service\Response\Handler; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Payment\Model\InfoInterface; use Magento\Paypal\Model\Info; use Magento\Paypal\Model\Payflowpro; @@ -54,7 +54,7 @@ class FraudHandler implements HandlerInterface /** * {inheritdoc} */ - public function handle(InfoInterface $payment, Object $response) + public function handle(InfoInterface $payment, DataObject $response) { if ( !in_array( diff --git a/app/code/Magento/Paypal/Model/Payflow/Service/Response/Handler/HandlerComposite.php b/app/code/Magento/Paypal/Model/Payflow/Service/Response/Handler/HandlerComposite.php index a4b1881e163..9d2963acf77 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Service/Response/Handler/HandlerComposite.php +++ b/app/code/Magento/Paypal/Model/Payflow/Service/Response/Handler/HandlerComposite.php @@ -5,7 +5,7 @@ */ namespace Magento\Paypal\Model\Payflow\Service\Response\Handler; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Payment\Model\InfoInterface; class HandlerComposite implements HandlerInterface @@ -39,7 +39,7 @@ class HandlerComposite implements HandlerInterface /** * {inheritdoc} */ - public function handle(InfoInterface $payment, Object $response) + public function handle(InfoInterface $payment, DataObject $response) { foreach ($this->handlers as $handle) { $handle->handle($payment, $response); diff --git a/app/code/Magento/Paypal/Model/Payflow/Service/Response/Handler/HandlerInterface.php b/app/code/Magento/Paypal/Model/Payflow/Service/Response/Handler/HandlerInterface.php index b21e638b92b..9030668ebd5 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Service/Response/Handler/HandlerInterface.php +++ b/app/code/Magento/Paypal/Model/Payflow/Service/Response/Handler/HandlerInterface.php @@ -5,7 +5,7 @@ */ namespace Magento\Paypal\Model\Payflow\Service\Response\Handler; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Payment\Model\InfoInterface; /** @@ -21,5 +21,5 @@ interface HandlerInterface * @param Object $response * @return void */ - public function handle(InfoInterface $payment, Object $response); + public function handle(InfoInterface $payment, DataObject $response); } diff --git a/app/code/Magento/Paypal/Model/Payflow/Service/Response/Transaction.php b/app/code/Magento/Paypal/Model/Payflow/Service/Response/Transaction.php index 98951ca4120..03525721e42 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Service/Response/Transaction.php +++ b/app/code/Magento/Paypal/Model/Payflow/Service/Response/Transaction.php @@ -5,7 +5,7 @@ */ namespace Magento\Paypal\Model\Payflow\Service\Response; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Payment\Model\Method\Logger; use Magento\Paypal\Model\Payflow\Service\Response\Handler\HandlerInterface; @@ -84,7 +84,7 @@ class Transaction */ public function getResponseObject($gatewayTransactionResponse) { - $response = new Object(); + $response = new DataObject(); $response = $this->transparent->mapGatewayResponse($gatewayTransactionResponse, $response); $this->logger->debug( $gatewayTransactionResponse, diff --git a/app/code/Magento/Paypal/Model/Payflow/Service/Response/Validator/AVSResponse.php b/app/code/Magento/Paypal/Model/Payflow/Service/Response/Validator/AVSResponse.php index 59406baa81e..87ce1d16e82 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Service/Response/Validator/AVSResponse.php +++ b/app/code/Magento/Paypal/Model/Payflow/Service/Response/Validator/AVSResponse.php @@ -5,7 +5,7 @@ */ namespace Magento\Paypal\Model\Payflow\Service\Response\Validator; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Paypal\Model\Payflow\Service\Response\ValidatorInterface; /** @@ -75,7 +75,7 @@ class AVSResponse extends AbstractFilterValidator implements ValidatorInterface * @param Object $response * @return bool */ - public function validate(Object $response) + public function validate(DataObject $response) { $config = $this->getConfig(); foreach ($this->avsCheck as $fieldName => $settingName) { diff --git a/app/code/Magento/Paypal/Model/Payflow/Service/Response/Validator/CVV2Match.php b/app/code/Magento/Paypal/Model/Payflow/Service/Response/Validator/CVV2Match.php index 5bd446a4ad6..03371cb2f10 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Service/Response/Validator/CVV2Match.php +++ b/app/code/Magento/Paypal/Model/Payflow/Service/Response/Validator/CVV2Match.php @@ -5,7 +5,7 @@ */ namespace Magento\Paypal\Model\Payflow\Service\Response\Validator; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Paypal\Model\Payflow\Service\Response\ValidatorInterface; /** @@ -48,10 +48,10 @@ class CVV2Match extends AbstractFilterValidator implements ValidatorInterface /** * Validate data * - * @param Object $response + * @param DataObject $response * @return bool */ - public function validate(Object $response) + public function validate(DataObject $response) { if ($this->isValidationOff()) { return true; @@ -87,10 +87,10 @@ class CVV2Match extends AbstractFilterValidator implements ValidatorInterface /** * Matching card CVV (positive) * - * @param Object $response + * @param DataObject $response * @return bool */ - protected function isMatchCvv(Object $response) + protected function isMatchCvv(DataObject $response) { $cvvMatch = strtolower((string) $response->getData(static::CVV2MATCH)); return $cvvMatch === static::RESPONSE_YES || $cvvMatch === static::RESPONSE_NOT_SUPPORTED; @@ -99,10 +99,10 @@ class CVV2Match extends AbstractFilterValidator implements ValidatorInterface /** * Matching card CVV (negative) * - * @param Object $response + * @param DataObject $response * @return bool */ - protected function isNotMatchCvv(Object $response) + protected function isNotMatchCvv(DataObject $response) { return strtolower((string) $response->getData(static::CVV2MATCH)) === static::RESPONSE_NO; } @@ -110,10 +110,10 @@ class CVV2Match extends AbstractFilterValidator implements ValidatorInterface /** * Checking that the CVV does not exist in the response * - * @param Object $response + * @param DataObject $response * @return bool */ - protected function isCvvDoNotExists(Object $response) + protected function isCvvDoNotExists(DataObject $response) { return $response->getData(static::CVV2MATCH) == ''; } diff --git a/app/code/Magento/Paypal/Model/Payflow/Service/Response/Validator/ResponseValidator.php b/app/code/Magento/Paypal/Model/Payflow/Service/Response/Validator/ResponseValidator.php index 1f90ef9f174..0d682f8d172 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Service/Response/Validator/ResponseValidator.php +++ b/app/code/Magento/Paypal/Model/Payflow/Service/Response/Validator/ResponseValidator.php @@ -5,7 +5,7 @@ */ namespace Magento\Paypal\Model\Payflow\Service\Response\Validator; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Paypal\Model\Payflowpro; use Magento\Framework\Exception\LocalizedException; use Magento\Paypal\Model\Payflow\Service\Response\ValidatorInterface; @@ -37,7 +37,7 @@ class ResponseValidator implements ValidatorInterface * @return void * @throws LocalizedException */ - public function validate(Object $response) + public function validate(DataObject $response) { switch ($response->getResult()) { case Payflowpro::RESPONSE_CODE_APPROVED: diff --git a/app/code/Magento/Paypal/Model/Payflow/Service/Response/Validator/SecureToken.php b/app/code/Magento/Paypal/Model/Payflow/Service/Response/Validator/SecureToken.php index 74a070e9f5f..95fdfe79ae1 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Service/Response/Validator/SecureToken.php +++ b/app/code/Magento/Paypal/Model/Payflow/Service/Response/Validator/SecureToken.php @@ -5,7 +5,7 @@ */ namespace Magento\Paypal\Model\Payflow\Service\Response\Validator; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Paypal\Model\Payflow\Service\Response\ValidatorInterface; /** @@ -30,11 +30,10 @@ class SecureToken implements ValidatorInterface /** * Validate data - * - * @param Object $data + * @param DataObject $response * @return bool */ - public function validate(Object $response) + public function validate(DataObject $response) { return (bool) $response->getSecuretoken() && is_numeric($response->getResult()) diff --git a/app/code/Magento/Paypal/Model/Payflow/Service/Response/ValidatorInterface.php b/app/code/Magento/Paypal/Model/Payflow/Service/Response/ValidatorInterface.php index 107d40f0462..84d45c6a12c 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Service/Response/ValidatorInterface.php +++ b/app/code/Magento/Paypal/Model/Payflow/Service/Response/ValidatorInterface.php @@ -5,7 +5,7 @@ */ namespace Magento\Paypal\Model\Payflow\Service\Response; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Interface ValidatorInterface @@ -18,5 +18,5 @@ interface ValidatorInterface * @param Object $response * @return bool */ - public function validate(Object $response); + public function validate(DataObject $response); } diff --git a/app/code/Magento/Paypal/Model/Payflow/Transparent.php b/app/code/Magento/Paypal/Model/Payflow/Transparent.php index c9f62c67e75..75ceb1b6b2f 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Transparent.php +++ b/app/code/Magento/Paypal/Model/Payflow/Transparent.php @@ -5,7 +5,7 @@ */ namespace Magento\Paypal\Model\Payflow; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Paypal\Model\Payflowpro; use Magento\Sales\Model\Order\Payment; use Magento\Paypal\Model\Payflow\Service\Gateway; diff --git a/app/code/Magento/Paypal/Model/Payflowlink.php b/app/code/Magento/Paypal/Model/Payflowlink.php index 76b0013ade0..734791a5d2d 100644 --- a/app/code/Magento/Paypal/Model/Payflowlink.php +++ b/app/code/Magento/Paypal/Model/Payflowlink.php @@ -225,7 +225,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro * Instantiate state and set it to state object * * @param string $paymentAction - * @param \Magento\Framework\Object $stateObject + * @param \Magento\Framework\DataObject $stateObject * @return void */ public function initialize($paymentAction, $stateObject) @@ -407,7 +407,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro * Build request for getting token * * @param \Magento\Sales\Model\Order\Payment $payment - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function _buildTokenRequest(\Magento\Sales\Model\Order\Payment $payment) { @@ -528,7 +528,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro * If response is failed throw exception * Set token data in payment object * - * @param \Magento\Framework\Object $response + * @param \Magento\Framework\DataObject $response * @param \Magento\Sales\Model\Order\Payment $payment * @return void * @throws \Magento\Framework\Exception\LocalizedException diff --git a/app/code/Magento/Paypal/Model/Payflowpro.php b/app/code/Magento/Paypal/Model/Payflowpro.php index 4bed593ad36..5cd4a7e10ae 100644 --- a/app/code/Magento/Paypal/Model/Payflowpro.php +++ b/app/code/Magento/Paypal/Model/Payflowpro.php @@ -5,7 +5,7 @@ */ namespace Magento\Paypal\Model; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Payment\Model\InfoInterface; use Magento\Payment\Model\Method\ConfigInterfaceFactory; use Magento\Paypal\Model\Payflow\Service\Gateway; @@ -569,7 +569,7 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc implements GatewayInte /** * {inheritdoc} */ - public function postRequest(Object $request, ConfigInterface $config) + public function postRequest(DataObject $request, ConfigInterface $config) { return $this->gateway->postRequest($request, $config); } @@ -581,7 +581,7 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc implements GatewayInte * @param float $amount * @return Object */ - protected function _buildPlaceRequest(Object $payment, $amount) + protected function _buildPlaceRequest(DataObject $payment, $amount) { $request = $this->buildBasicRequest(); $request->setAmt(round($amount, 2)); @@ -611,7 +611,7 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc implements GatewayInte */ public function buildBasicRequest() { - $request = new Object(); + $request = new DataObject(); /** @var \Magento\Paypal\Model\PayflowConfig $config */ $config = $this->getConfig(); @@ -630,12 +630,12 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc implements GatewayInte /** * If response is failed throw exception * - * @param Object $response + * @param DataObject $response * @return void * @throws \Magento\Framework\Exception\LocalizedException * @throws \Magento\Framework\Exception\State\InvalidTransitionException */ - public function processErrors(Object $response) + public function processErrors(DataObject $response) { if ($response->getResultCode() == self::RESPONSE_CODE_VOID_ERROR) { throw new \Magento\Framework\Exception\State\InvalidTransitionException( @@ -704,12 +704,12 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc implements GatewayInte } /** - * @param Object $request - * @param Object $billing + * @param DataObject $request + * @param DataObject $billing * * @return Object */ - public function setBilling(Object $request, $billing) + public function setBilling(DataObject $request, $billing) { $request->setFirstname( $billing->getFirstname() @@ -730,8 +730,8 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc implements GatewayInte } /** - * @param Object $request - * @param Object $shipping + * @param DataObject $request + * @param DataObject $shipping * * @return Object */ @@ -759,11 +759,11 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc implements GatewayInte * Fill response with data. * * @param array $postData - * @param Object $response + * @param DataObject $response * - * @return Object + * @return DataObject */ - public function mapGatewayResponse(array $postData, Object $response) + public function mapGatewayResponse(array $postData, DataObject $response) { $response->setData(array_change_key_case($postData)); foreach ($this->_responseParamsMappings as $originKey => $key) { @@ -788,8 +788,8 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc implements GatewayInte } /** - * @param Object $payment - * @param Object $response + * @param DataObject $payment + * @param DataObject $response * * @return Object * @throws \Magento\Framework\Exception\LocalizedException @@ -821,11 +821,11 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc implements GatewayInte } /** - * @param Object $order - * @param Object $request - * @return Object + * @param DataObject $order + * @param DataObject $request + * @return DataObject */ - public function fillCustomerContacts(Object $order, Object $request) + public function fillCustomerContacts(DataObject $order, DataObject $request) { $customerId = $order->getCustomerId(); if ($customerId) { diff --git a/app/code/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreement.php b/app/code/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreement.php index 4c9b4feaa4a..7d6a8c9e7c8 100644 --- a/app/code/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreement.php +++ b/app/code/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreement.php @@ -113,7 +113,7 @@ abstract class AbstractAgreement extends \Magento\Payment\Model\Method\AbstractM $id = false; if (is_array($data) && isset($data[$key])) { $id = $data[$key]; - } elseif ($data instanceof \Magento\Framework\Object && $data->getData($key)) { + } elseif ($data instanceof \Magento\Framework\DataObject && $data->getData($key)) { $id = $data->getData($key); } if ($id) { diff --git a/app/code/Magento/Paypal/Model/Pro.php b/app/code/Magento/Paypal/Model/Pro.php index 81ab25a8a08..baab75589b8 100644 --- a/app/code/Magento/Paypal/Model/Pro.php +++ b/app/code/Magento/Paypal/Model/Pro.php @@ -181,11 +181,11 @@ class Pro /** * Transfer transaction/payment information from API instance to order payment * - * @param \Magento\Framework\Object|AbstractApi $from + * @param \Magento\Framework\DataObject|AbstractApi $from * @param \Magento\Payment\Model\InfoInterface $to * @return $this */ - public function importPaymentInfo(\Magento\Framework\Object $from, \Magento\Payment\Model\InfoInterface $to) + public function importPaymentInfo(\Magento\Framework\DataObject $from, \Magento\Payment\Model\InfoInterface $to) { // update PayPal-specific payment information in the payment object $this->getInfo()->importToPayment($from, $to); @@ -214,11 +214,11 @@ class Pro /** * Void transaction * - * @param \Magento\Framework\Object $payment + * @param \Magento\Framework\DataObject $payment * @return void * @throws \Magento\Framework\Exception\LocalizedException */ - public function void(\Magento\Framework\Object $payment) + public function void(\Magento\Framework\DataObject $payment) { $authTransactionId = $this->_getParentTransactionId($payment); if ($authTransactionId) { @@ -236,11 +236,11 @@ class Pro * Attempt to capture payment * Will return false if the payment is not supposed to be captured * - * @param \Magento\Framework\Object $payment + * @param \Magento\Framework\DataObject $payment * @param float $amount * @return false|null */ - public function capture(\Magento\Framework\Object $payment, $amount) + public function capture(\Magento\Framework\DataObject $payment, $amount) { $authTransactionId = $this->_getParentTransactionId($payment); if (!$authTransactionId) { @@ -266,12 +266,12 @@ class Pro /** * Refund a capture transaction * - * @param \Magento\Framework\Object $payment + * @param \Magento\Framework\DataObject $payment * @param float $amount * @return void * @throws \Magento\Framework\Exception\LocalizedException */ - public function refund(\Magento\Framework\Object $payment, $amount) + public function refund(\Magento\Framework\DataObject $payment, $amount) { $captureTxnId = $this->_getParentTransactionId($payment); if ($captureTxnId) { @@ -304,10 +304,10 @@ class Pro /** * Cancel payment * - * @param \Magento\Framework\Object $payment + * @param \Magento\Framework\DataObject $payment * @return void */ - public function cancel(\Magento\Framework\Object $payment) + public function cancel(\Magento\Framework\DataObject $payment) { if (!$payment->getOrder()->getInvoiceCollection()->count()) { $this->void($payment); @@ -416,10 +416,10 @@ class Pro /** * Parent transaction id getter * - * @param \Magento\Framework\Object $payment + * @param \Magento\Framework\DataObject $payment * @return string */ - protected function _getParentTransactionId(\Magento\Framework\Object $payment) + protected function _getParentTransactionId(\Magento\Framework\DataObject $payment) { return $payment->getParentTransactionId(); } diff --git a/app/code/Magento/Paypal/Test/Unit/Block/Express/ReviewTest.php b/app/code/Magento/Paypal/Test/Unit/Block/Express/ReviewTest.php index 87f1d81356c..b17b8f25b94 100644 --- a/app/code/Magento/Paypal/Test/Unit/Block/Express/ReviewTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Block/Express/ReviewTest.php @@ -89,7 +89,7 @@ class ReviewTest extends \PHPUnit_Framework_TestCase $quote->expects($this->any())->method('getIsVirtual')->will($this->returnValue(false)); $quote->setMayEditShippingMethod('MayEditShippingMethod'); - $shippingRate = new \Magento\Framework\Object(['code' => 'Rate 1']); + $shippingRate = new \Magento\Framework\DataObject(['code' => 'Rate 1']); $shippingRates = [ [$shippingRate], ]; @@ -141,7 +141,7 @@ class ReviewTest extends \PHPUnit_Framework_TestCase */ protected function _getQuoteMock() { - $methodInstance = new \Magento\Framework\Object(['title' => 'Payment Method']); + $methodInstance = new \Magento\Framework\DataObject(['title' => 'Payment Method']); $payment = $this->getMock('Magento\Quote\Model\Quote\Payment', [], [], '', false); $payment->expects($this->any())->method('getMethodInstance')->will($this->returnValue($methodInstance)); diff --git a/app/code/Magento/Paypal/Test/Unit/Controller/Express/PlaceOrderTest.php b/app/code/Magento/Paypal/Test/Unit/Controller/Express/PlaceOrderTest.php index 1782a325ea9..5d1b82c55c5 100644 --- a/app/code/Magento/Paypal/Test/Unit/Controller/Express/PlaceOrderTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Controller/Express/PlaceOrderTest.php @@ -109,7 +109,7 @@ class PlaceOrderTest extends \Magento\Paypal\Test\Unit\Controller\ExpressTest ] ) ) { - $payment = new \Magento\Framework\Object(['checkout_redirect_url' => $redirectUrl]); + $payment = new \Magento\Framework\DataObject(['checkout_redirect_url' => $redirectUrl]); $this->quote->expects($this->once()) ->method('getPayment') ->will($this->returnValue($payment)); diff --git a/app/code/Magento/Paypal/Test/Unit/Controller/Transparent/RequestSecureTokenTest.php b/app/code/Magento/Paypal/Test/Unit/Controller/Transparent/RequestSecureTokenTest.php index 8cd34014df3..6aeccbb1bb4 100644 --- a/app/code/Magento/Paypal/Test/Unit/Controller/Transparent/RequestSecureTokenTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Controller/Transparent/RequestSecureTokenTest.php @@ -113,7 +113,7 @@ class RequestSecureTokenTest extends \PHPUnit_Framework_TestCase $quoteMock = $this->getMockBuilder('Magento\Quote\Model\Quote') ->disableOriginalConstructor() ->getMock(); - $tokenMock = $this->getMockBuilder('Magento\Framework\Object') + $tokenMock = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods(['getData', 'getSecuretoken']) ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Paypal/Test/Unit/Controller/Transparent/ResponseTest.php b/app/code/Magento/Paypal/Test/Unit/Controller/Transparent/ResponseTest.php index 70a20a0f1ea..7cddae94159 100644 --- a/app/code/Magento/Paypal/Test/Unit/Controller/Transparent/ResponseTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Controller/Transparent/ResponseTest.php @@ -97,7 +97,7 @@ class ResponseTest extends \PHPUnit_Framework_TestCase public function testExecute() { - $objectMock = $this->getMockBuilder('Magento\Framework\Object') + $objectMock = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->getMock(); $this->transactionMock->expects($this->once()) @@ -124,7 +124,7 @@ class ResponseTest extends \PHPUnit_Framework_TestCase public function testExecuteWithException() { - $objectMock = $this->getMockBuilder('Magento\Framework\Object') + $objectMock = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->getMock(); $this->transactionMock->expects($this->once()) diff --git a/app/code/Magento/Paypal/Test/Unit/Model/BillingAgreementConfigProviderTest.php b/app/code/Magento/Paypal/Test/Unit/Model/BillingAgreementConfigProviderTest.php index c8f45cd3b7d..705597cf564 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/BillingAgreementConfigProviderTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/BillingAgreementConfigProviderTest.php @@ -45,8 +45,8 @@ class BillingAgreementConfigProviderTest extends \PHPUnit_Framework_TestCase { $customerId = 1; $agreements = [ - new \Magento\Framework\Object(['id' => 1, 'reference_id' => 'DFG123ER']), - new \Magento\Framework\Object(['id' => 2, 'reference_id' => 'JKT153ER']), + new \Magento\Framework\DataObject(['id' => 1, 'reference_id' => 'DFG123ER']), + new \Magento\Framework\DataObject(['id' => 2, 'reference_id' => 'JKT153ER']), ]; $expected = [ diff --git a/app/code/Magento/Paypal/Test/Unit/Model/CartTest.php b/app/code/Magento/Paypal/Test/Unit/Model/CartTest.php index e6ccfe1e218..b597a63e214 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/CartTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/CartTest.php @@ -15,7 +15,7 @@ class CartTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $_validItem; @@ -32,13 +32,13 @@ class CartTest extends \PHPUnit_Framework_TestCase public function __construct($name = null, array $data = [], $dataName = '') { parent::__construct($name, $data, $dataName); - $this->_validItem = new \Magento\Framework\Object( + $this->_validItem = new \Magento\Framework\DataObject( [ 'parent_item' => null, 'price' => 2.0, 'qty' => 3, 'name' => 'valid item', - 'original_item' => new \Magento\Framework\Object(['base_row_total' => 6.0]), + 'original_item' => new \Magento\Framework\DataObject(['base_row_total' => 6.0]), ] ); } @@ -69,7 +69,7 @@ class CartTest extends \PHPUnit_Framework_TestCase */ public function testInvalidGetAllItems($items) { - $taxContainer = new \Magento\Framework\Object( + $taxContainer = new \Magento\Framework\DataObject( ['base_discount_tax_compensation_amount' => 0.2, 'base_shipping_discount_tax_compensation_amnt' => 0.1] ); $this->_salesModel->expects($this->once())->method('getTaxContainer')->will($this->returnValue($taxContainer)); @@ -91,9 +91,9 @@ class CartTest extends \PHPUnit_Framework_TestCase [[]], [ [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ - 'parent_item' => new \Magento\Framework\Object(), + 'parent_item' => new \Magento\Framework\DataObject(), 'price' => 2.0, 'qty' => 3, 'name' => 'item 1', @@ -104,12 +104,12 @@ class CartTest extends \PHPUnit_Framework_TestCase [ [ $this->_validItem, - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'price' => 2.0, 'qty' => 3, 'name' => 'item 2', - 'original_item' => new \Magento\Framework\Object(['base_row_total' => 6.01]), + 'original_item' => new \Magento\Framework\DataObject(['base_row_total' => 6.01]), ] ), ] @@ -117,12 +117,12 @@ class CartTest extends \PHPUnit_Framework_TestCase [ [ $this->_validItem, - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'price' => sqrt(2), 'qty' => sqrt(2), 'name' => 'item 3', - 'original_item' => new \Magento\Framework\Object(['base_row_total' => 2]), + 'original_item' => new \Magento\Framework\DataObject(['base_row_total' => 2]), ] ), ] @@ -185,7 +185,7 @@ class CartTest extends \PHPUnit_Framework_TestCase $totals = $this->_prepareValidModelData(); $this->assertEquals( [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'name' => $this->_validItem->getName(), 'qty' => $this->_validItem->getQty(), @@ -242,7 +242,7 @@ class CartTest extends \PHPUnit_Framework_TestCase */ protected function _prepareInvalidModelData($values, $transferDiscount) { - $taxContainer = new \Magento\Framework\Object( + $taxContainer = new \Magento\Framework\DataObject( [ 'base_discount_tax_compensation_amount' => $values['base_discount_tax_compensation_amount'], @@ -317,7 +317,7 @@ class CartTest extends \PHPUnit_Framework_TestCase protected function _prepareValidModelData() { $totals = ['discount' => 0.1, 'shipping' => 0.2, 'subtotal' => 0.3, 'tax' => 0.4]; - $taxContainer = new \Magento\Framework\Object( + $taxContainer = new \Magento\Framework\DataObject( ['base_discount_tax_compensation_amount' => 0, 'base_shipping_discount_tax_compensation_amnt' => 0] ); $this->_salesModel->expects($this->once())->method('getTaxContainer')->will($this->returnValue($taxContainer)); diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Express/Checkout/QuoteTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Express/Checkout/QuoteTest.php index 4a52a4d3c75..b51b1061e05 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Express/Checkout/QuoteTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Express/Checkout/QuoteTest.php @@ -24,7 +24,7 @@ class QuoteTest extends \PHPUnit_Framework_TestCase protected $addressFactoryMock; /** - * @var \Magento\Framework\Object\Copy|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObject\Copy|\PHPUnit_Framework_MockObject_MockObject */ protected $copyObjectMock; @@ -63,7 +63,7 @@ class QuoteTest extends \PHPUnit_Framework_TestCase false ); $this->copyObjectMock = $this->getMock( - 'Magento\Framework\Object\Copy', + 'Magento\Framework\DataObject\Copy', [], [], '', diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Express/CheckoutTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Express/CheckoutTest.php index ad143beb35c..f9b820ac855 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Express/CheckoutTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Express/CheckoutTest.php @@ -31,7 +31,7 @@ class CheckoutTest extends \PHPUnit_Framework_TestCase protected $customerAccountManagementMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Object\Copy + * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\DataObject\Copy */ protected $objectCopyServiceMock; @@ -62,7 +62,7 @@ class CheckoutTest extends \PHPUnit_Framework_TestCase '', false ); - $this->objectCopyServiceMock = $this->getMockBuilder('\Magento\Framework\Object\Copy') + $this->objectCopyServiceMock = $this->getMockBuilder('\Magento\Framework\DataObject\Copy') ->disableOriginalConstructor() ->getMock(); $this->customerSessionMock = $this->getMockBuilder('\Magento\Customer\Model\Session') diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Hostedpro/RequestTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Hostedpro/RequestTest.php index c66623c4743..0638c446d7d 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Hostedpro/RequestTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Hostedpro/RequestTest.php @@ -62,7 +62,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase */ public function addressesDataProvider() { - $billing = new \Magento\Framework\Object([ + $billing = new \Magento\Framework\DataObject([ 'firstname' => 'Firstname', 'lastname' => 'Lastname', 'city' => 'City', @@ -71,7 +71,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase 'country' => 'United States', 'Street' => '1 Ln Ave', ]); - $shipping = new \Magento\Framework\Object([ + $shipping = new \Magento\Framework\DataObject([ 'firstname' => 'ShipFirstname', 'lastname' => 'ShipLastname', 'city' => 'ShipCity', @@ -80,7 +80,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase 'country' => 'United States', 'Street' => '1 Ln Ave', ]); - $billing2 = new \Magento\Framework\Object([ + $billing2 = new \Magento\Framework\DataObject([ 'firstname' => 'Firstname', 'lastname' => 'Lastname', 'city' => 'City', @@ -89,7 +89,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase 'country' => 'United States', 'Street' => '1 Ln Ave', ]); - $shipping2 = new \Magento\Framework\Object([ + $shipping2 = new \Magento\Framework\DataObject([ 'firstname' => 'ShipFirstname', 'lastname' => 'ShipLastname', 'city' => 'ShipCity', diff --git a/app/code/Magento/Paypal/Test/Unit/Model/InfoTest.php b/app/code/Magento/Paypal/Test/Unit/Model/InfoTest.php index 68383cd435a..9d4d5ad817b 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/InfoTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/InfoTest.php @@ -91,7 +91,7 @@ class InfoTest extends \PHPUnit_Framework_TestCase public function testImportToPayment($mapping, $expectation) { // we create $from object, based on mapping - $from = new \Magento\Framework\Object($mapping); + $from = new \Magento\Framework\DataObject($mapping); /** @var \Magento\Payment\Model\InfoInterface $paymentInfo */ $paymentInfo = $this->objectManagerHelper->getObject('Magento\Payment\Model\Info'); $this->info->importToPayment($from, $paymentInfo); @@ -110,7 +110,7 @@ class InfoTest extends \PHPUnit_Framework_TestCase $paymentInfo->setAdditionalInformation($expectation); // we create $to empty object - $to = new \Magento\Framework\Object(); + $to = new \Magento\Framework\DataObject(); $this->info->exportFromPayment($paymentInfo, $to); $this->assertEquals($mapping, $to->getData()); } @@ -127,7 +127,7 @@ class InfoTest extends \PHPUnit_Framework_TestCase $paymentInfo->setAdditionalInformation($expectation); // we create $to empty object - $to = new \Magento\Framework\Object(); + $to = new \Magento\Framework\DataObject(); $this->info->exportFromPayment($paymentInfo, $to, array_flip($mapping)); $this->assertEquals($mapping, $to->getData()); } diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Observer/RestrictAdminBillingAgreementUsageTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Observer/RestrictAdminBillingAgreementUsageTest.php index 98957fa8283..a5cd6f89bc8 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Observer/RestrictAdminBillingAgreementUsageTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Observer/RestrictAdminBillingAgreementUsageTest.php @@ -22,7 +22,7 @@ class RestrictAdminBillingAgreementUsageTest extends \PHPUnit_Framework_TestCase protected $_observer; /** - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $_event; @@ -33,7 +33,7 @@ class RestrictAdminBillingAgreementUsageTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_event = new \Magento\Framework\Object(); + $this->_event = new \Magento\Framework\DataObject(); $this->_observer = new \Magento\Framework\Event\Observer(); $this->_observer->setEvent($this->_event); diff --git a/app/code/Magento/Paypal/Test/Unit/Model/ObserverTest.php b/app/code/Magento/Paypal/Test/Unit/Model/ObserverTest.php index 9702381ded8..69fbcd57e97 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/ObserverTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/ObserverTest.php @@ -25,7 +25,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase protected $_observer; /** - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $_event; @@ -71,7 +71,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_event = new \Magento\Framework\Object(); + $this->_event = new \Magento\Framework\DataObject(); $this->_observer = new \Magento\Framework\Event\Observer(); $this->_observer->setEvent($this->_event); @@ -190,7 +190,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $paymentMock = $this->getMockBuilder('Magento\Sales\Model\Order\Payment') ->disableOriginalConstructor() ->getMock(); - $resultMock = $this->getMockBuilder('Magento\Framework\Object') + $resultMock = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->getMock(); $layoutMock = $this->getMockBuilder('Magento\Framework\View\LayoutInterface') diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/GatewayTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/GatewayTest.php index f921743b038..0b1203afdcc 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/GatewayTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/GatewayTest.php @@ -81,11 +81,11 @@ class GatewayTest extends \PHPUnit_Framework_TestCase $this->loggerMock->expects($this->once()) ->method('debug'); - $object = new \Magento\Framework\Object(); + $object = new \Magento\Framework\DataObject(); $result = $this->object->postRequest($object, $configInterfaceMock); - $this->assertInstanceOf('Magento\Framework\Object', $result); + $this->assertInstanceOf('Magento\Framework\DataObject', $result); $this->assertArrayHasKey('result_code', $result->getData()); } @@ -106,7 +106,7 @@ class GatewayTest extends \PHPUnit_Framework_TestCase ->method('request') ->willThrowException(new \Exception()); - $object = new \Magento\Framework\Object(); + $object = new \Magento\Framework\DataObject(); $this->object->postRequest($object, $configInterfaceMock); } } diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Request/SecureTokenTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Request/SecureTokenTest.php index 4506985ce2a..e83a5dac841 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Request/SecureTokenTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Request/SecureTokenTest.php @@ -6,7 +6,7 @@ namespace Magento\Paypal\Test\Unit\Model\Payflow\Service\Request; use Magento\Framework\Math\Random; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\UrlInterface; use Magento\Paypal\Model\Payflow\Service\Request\SecureToken; use Magento\Paypal\Model\Payflow\Transparent; @@ -51,7 +51,7 @@ class SecureTokenTest extends \PHPUnit_Framework_TestCase public function testRequestToken() { - $request = new Object(); + $request = new DataObject(); $secureTokenID = 'Sdj46hDokds09c8k2klaGJdKLl032ekR'; $this->transparent->expects($this->once()) @@ -64,7 +64,7 @@ class SecureTokenTest extends \PHPUnit_Framework_TestCase ->willReturn($this->getMock('Magento\Paypal\Model\PayflowConfig', [], [], '', false)); $this->transparent->expects($this->once()) ->method('postRequest') - ->willReturn(new Object()); + ->willReturn(new DataObject()); $this->mathRandom->expects($this->once()) ->method('getUniqueHash') diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Handler/CreditCardValidationHandlerTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Handler/CreditCardValidationHandlerTest.php index d457614518c..c0ea58169c6 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Handler/CreditCardValidationHandlerTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Handler/CreditCardValidationHandlerTest.php @@ -5,7 +5,7 @@ */ namespace Magento\Paypal\Test\Unit\Model\Payflow\Service\Response\Handler; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Paypal\Model\Info; use Magento\Paypal\Model\Payflow\Service\Response\Handler\CreditCardValidationHandler; @@ -26,7 +26,7 @@ class CreditCardValidationHandlerTest extends \PHPUnit_Framework_TestCase ->getMock(); $paymentMock = $this->getMockBuilder('Magento\Payment\Model\InfoInterface') ->getMock(); - $responseMock = $this->getMockBuilder('Magento\Framework\Object') + $responseMock = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Handler/FraudHandlerTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Handler/FraudHandlerTest.php index dee2f88f42f..fa199342fa7 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Handler/FraudHandlerTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Handler/FraudHandlerTest.php @@ -5,7 +5,7 @@ */ namespace Magento\Paypal\Test\Unit\Model\Payflow\Service\Response\Handler; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Payment\Model\InfoInterface; use Magento\Paypal\Model\Payflow\Service\Response\Handler\FraudHandler; use Magento\Paypal\Model\Info; @@ -37,7 +37,7 @@ class FraudHandlerTest extends \PHPUnit_Framework_TestCase { $this->paymentMock = $this->getMockBuilder('Magento\Payment\Model\InfoInterface') ->getMock(); - $this->responseMock = $this->getMockBuilder('Magento\Framework\Object') + $this->responseMock = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->getMock(); $this->paypalInfoManagerMock = $this->getMockBuilder('Magento\Paypal\Model\Info') diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Handler/HandlerCompositeTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Handler/HandlerCompositeTest.php index cc251421565..bb8679e6a44 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Handler/HandlerCompositeTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Handler/HandlerCompositeTest.php @@ -36,7 +36,7 @@ class HandlerCompositeTest extends \PHPUnit_Framework_TestCase { $paymentMock = $this->getMockBuilder('Magento\Payment\Model\InfoInterface') ->getMock(); - $responseMock = $this->getMockBuilder('Magento\Framework\Object') + $responseMock = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/TransactionTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/TransactionTest.php index b765a7362f3..b81b9acce9e 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/TransactionTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/TransactionTest.php @@ -5,7 +5,7 @@ */ namespace Magento\Paypal\Test\Unit\Model\Payflow\Service\Response; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Paypal\Model\Payflowpro; use Magento\Paypal\Model\Payflow\Service\Response\Transaction; use Magento\Paypal\Model\Payflow\Service\Response\Handler\HandlerInterface; @@ -83,7 +83,7 @@ class TransactionTest extends \PHPUnit_Framework_TestCase public function testGetResponseObject() { $gatewayTransactionResponse = []; - $result = new \Magento\Framework\Object(); + $result = new \Magento\Framework\DataObject(); $this->transparent->expects($this->once()) ->method('getDebugReplacePrivateDataKeys') @@ -108,7 +108,7 @@ class TransactionTest extends \PHPUnit_Framework_TestCase public function testSavePaymentInQuote() { $quoteId = 1; - $response = new Object(); + $response = new DataObject(); $payment = $this->getMockBuilder('Magento\Quote\Model\Quote\Payment') ->disableOriginalConstructor() diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Validator/AVSResponseTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Validator/AVSResponseTest.php index f3fbe905ee1..745ae62f8be 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Validator/AVSResponseTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Validator/AVSResponseTest.php @@ -107,7 +107,7 @@ class AVSResponseTest extends \PHPUnit_Framework_TestCase /** * @param bool $expectedResult - * @param \Magento\Framework\Object $response + * @param \Magento\Framework\DataObject $response * @param array $configMap * @param int $exactlyCount * @@ -115,7 +115,7 @@ class AVSResponseTest extends \PHPUnit_Framework_TestCase */ public function testValidation( $expectedResult, - \Magento\Framework\Object $response, + \Magento\Framework\DataObject $response, array $configMap, $exactlyCount ) { @@ -140,7 +140,7 @@ class AVSResponseTest extends \PHPUnit_Framework_TestCase return [ [ 'expectedResult' => true, - 'response' => new \Magento\Framework\Object( + 'response' => new \Magento\Framework\DataObject( [ 'avsaddr' => 'Y', 'avszip' => 'Y', @@ -156,7 +156,7 @@ class AVSResponseTest extends \PHPUnit_Framework_TestCase ], [ 'expectedResult' => true, - 'response' => new \Magento\Framework\Object( + 'response' => new \Magento\Framework\DataObject( [ 'avsaddr' => 'Y', 'avszip' => 'Y', @@ -172,7 +172,7 @@ class AVSResponseTest extends \PHPUnit_Framework_TestCase ], [ 'expectedResult' => false, - 'response' => new \Magento\Framework\Object( + 'response' => new \Magento\Framework\DataObject( [ 'avsaddr' => 'Y', 'avszip' => 'N', @@ -188,7 +188,7 @@ class AVSResponseTest extends \PHPUnit_Framework_TestCase ], [ 'expectedResult' => true, - 'response' => new \Magento\Framework\Object( + 'response' => new \Magento\Framework\DataObject( [ 'avsaddr' => 'Y', 'avszip' => 'N', @@ -204,7 +204,7 @@ class AVSResponseTest extends \PHPUnit_Framework_TestCase ], [ 'expectedResult' => true, - 'response' => new \Magento\Framework\Object( + 'response' => new \Magento\Framework\DataObject( [ 'avsaddr' => 'Y', 'avszip' => 'N', @@ -220,7 +220,7 @@ class AVSResponseTest extends \PHPUnit_Framework_TestCase ], [ 'expectedResult' => true, - 'response' => new \Magento\Framework\Object( + 'response' => new \Magento\Framework\DataObject( [ 'avsaddr' => 'X', 'avszip' => 'Y', @@ -236,7 +236,7 @@ class AVSResponseTest extends \PHPUnit_Framework_TestCase ], [ 'expectedResult' => true, - 'response' => new \Magento\Framework\Object( + 'response' => new \Magento\Framework\DataObject( [ 'avsaddr' => 'X', 'avszip' => 'Y', diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Validator/CVV2MatchTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Validator/CVV2MatchTest.php index f185d5b3e5f..4202cd7080e 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Validator/CVV2MatchTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Validator/CVV2MatchTest.php @@ -107,14 +107,14 @@ class CVV2MatchTest extends \PHPUnit_Framework_TestCase /** * @param bool $expectedResult - * @param \Magento\Framework\Object $response + * @param \Magento\Framework\DataObject $response * @param string $avsSecurityCodeFlag * * @dataProvider validationDataProvider */ public function testValidation( $expectedResult, - \Magento\Framework\Object $response, + \Magento\Framework\DataObject $response, $avsSecurityCodeFlag ) { $this->configMock->expects($this->once()) @@ -137,7 +137,7 @@ class CVV2MatchTest extends \PHPUnit_Framework_TestCase return [ [ 'expectedResult' => true, - 'response' => new \Magento\Framework\Object( + 'response' => new \Magento\Framework\DataObject( [ 'cvv2match' => 'Y', ] @@ -146,7 +146,7 @@ class CVV2MatchTest extends \PHPUnit_Framework_TestCase ], [ 'expectedResult' => true, - 'response' => new \Magento\Framework\Object( + 'response' => new \Magento\Framework\DataObject( [ 'cvv2match' => 'Y', ] @@ -155,7 +155,7 @@ class CVV2MatchTest extends \PHPUnit_Framework_TestCase ], [ 'expectedResult' => true, - 'response' => new \Magento\Framework\Object( + 'response' => new \Magento\Framework\DataObject( [ 'cvv2match' => 'X', ] @@ -164,7 +164,7 @@ class CVV2MatchTest extends \PHPUnit_Framework_TestCase ], [ 'expectedResult' => false, - 'response' => new \Magento\Framework\Object( + 'response' => new \Magento\Framework\DataObject( [ 'cvv2match' => 'N', ] @@ -173,7 +173,7 @@ class CVV2MatchTest extends \PHPUnit_Framework_TestCase ], [ 'expectedResult' => true, - 'response' => new \Magento\Framework\Object( + 'response' => new \Magento\Framework\DataObject( [ 'cvv2match' => null, ] @@ -182,7 +182,7 @@ class CVV2MatchTest extends \PHPUnit_Framework_TestCase ], [ 'expectedResult' => true, - 'response' => new \Magento\Framework\Object(), + 'response' => new \Magento\Framework\DataObject(), 'configValue' => '1', ], ]; diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Validator/ResponseValidatorTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Validator/ResponseValidatorTest.php index 7abfdc9e427..2f1fd725945 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Validator/ResponseValidatorTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Validator/ResponseValidatorTest.php @@ -5,7 +5,7 @@ */ namespace Magento\Paypal\Test\Unit\Model\Payflow\Service\Response\Validator; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Paypal\Model\Payflowpro; use Magento\Paypal\Model\Payflow\Service\Response\ValidatorInterface; use Magento\Paypal\Model\Payflow\Service\Response\Validator\ResponseValidator; @@ -44,7 +44,7 @@ class ResponseValidatorTest extends \PHPUnit_Framework_TestCase * * @dataProvider dataProviderForTestValidate */ - public function testValidate(Object $response, $exactlyCount) + public function testValidate(DataObject $response, $exactlyCount) { $this->validatorMock->expects($this->exactly($exactlyCount)) ->method('validate') @@ -60,15 +60,15 @@ class ResponseValidatorTest extends \PHPUnit_Framework_TestCase { return [ [ - 'response' => new Object(['result' => Payflowpro::RESPONSE_CODE_APPROVED]), + 'response' => new DataObject(['result' => Payflowpro::RESPONSE_CODE_APPROVED]), 'exactlyCount' => 1 ], [ - 'response' => new Object(['result' => Payflowpro::RESPONSE_CODE_FRAUDSERVICE_FILTER]), + 'response' => new DataObject(['result' => Payflowpro::RESPONSE_CODE_FRAUDSERVICE_FILTER]), 'exactlyCount' => 1 ], [ - 'response' => new Object(['result' => Payflowpro::RESPONSE_CODE_INVALID_AMOUNT]), + 'response' => new DataObject(['result' => Payflowpro::RESPONSE_CODE_INVALID_AMOUNT]), 'exactlyCount' => 0 ] ]; @@ -80,7 +80,7 @@ class ResponseValidatorTest extends \PHPUnit_Framework_TestCase */ public function testValidateFail() { - $response = new Object( + $response = new DataObject( [ 'result' => Payflowpro::RESPONSE_CODE_APPROVED, 'respmsg' => 'Test error msg', @@ -101,7 +101,7 @@ class ResponseValidatorTest extends \PHPUnit_Framework_TestCase */ public function testValidateUnknownCode() { - $response = new Object( + $response = new DataObject( [ 'result' => 7777777777, 'respmsg' => 'Test error msg', diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Validator/SecureTokenTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Validator/SecureTokenTest.php index 551348848c9..05cecfca48b 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Validator/SecureTokenTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/Validator/SecureTokenTest.php @@ -31,11 +31,11 @@ class SecureTokenTest extends \PHPUnit_Framework_TestCase /** * @param bool $result - * @param \Magento\Framework\Object $response + * @param \Magento\Framework\DataObject $response * * @dataProvider validationDataProvider */ - public function testValidation($result, \Magento\Framework\Object $response) + public function testValidation($result, \Magento\Framework\DataObject $response) { $this->assertEquals($result, $this->validator->validate($response)); } @@ -48,7 +48,7 @@ class SecureTokenTest extends \PHPUnit_Framework_TestCase return [ [ 'result' => true, - 'response' => new \Magento\Framework\Object( + 'response' => new \Magento\Framework\DataObject( [ 'securetoken' => 'kcsakc;lsakc;lksa;kcsa;', 'result' => 0 // - good code @@ -57,7 +57,7 @@ class SecureTokenTest extends \PHPUnit_Framework_TestCase ], [ 'result' => false, - 'response' => new \Magento\Framework\Object( + 'response' => new \Magento\Framework\DataObject( [ 'securetoken' => 'kcsakc;lsakc;lksa;kcsa;', 'result' => SecureToken::ST_ALREADY_USED @@ -66,7 +66,7 @@ class SecureTokenTest extends \PHPUnit_Framework_TestCase ], [ 'result' => false, - 'response' => new \Magento\Framework\Object( + 'response' => new \Magento\Framework\DataObject( [ 'securetoken' => 'kcsakc;lsakc;lksa;kcsa;', 'result' => SecureToken::ST_EXPIRED @@ -75,7 +75,7 @@ class SecureTokenTest extends \PHPUnit_Framework_TestCase ], [ 'result' => false, - 'response' => new \Magento\Framework\Object( + 'response' => new \Magento\Framework\DataObject( [ 'securetoken' => 'kcsakc;lsakc;lksa;kcsa;', 'result' => SecureToken::ST_TRANSACTION_IN_PROCESS @@ -84,7 +84,7 @@ class SecureTokenTest extends \PHPUnit_Framework_TestCase ], [ 'result' => false, - 'response' => new \Magento\Framework\Object( + 'response' => new \Magento\Framework\DataObject( [ 'securetoken' => 'kcsakc;lsakc;lksa;kcsa;', 'result' => 'BAD_CODE' @@ -93,7 +93,7 @@ class SecureTokenTest extends \PHPUnit_Framework_TestCase ], [ 'result' => false, - 'response' => new \Magento\Framework\Object( + 'response' => new \Magento\Framework\DataObject( [ 'securetoken' => null, // - 'result' => SecureToken::ST_TRANSACTION_IN_PROCESS diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php index 599aad63bdd..b68d42d2974 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php @@ -30,19 +30,19 @@ class TransparentTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Payment\Model\Method\ConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $configMock; - /** @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject */ protected $responseMock; /** @var \Magento\Sales\Model\Order\Payment\Info|\PHPUnit_Framework_MockObject_MockObject */ protected $paymentMock; - /** @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject */ protected $orderMock; - /** @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject */ protected $addressBillingMock; - /** @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject */ protected $addressShippingMock; /** @@ -89,7 +89,7 @@ class TransparentTest extends \PHPUnit_Framework_TestCase $this->configFactoryMock->expects($this->once()) ->method('create') ->willReturn($this->configMock); - $this->responseMock = $this->getMockBuilder('\Magento\Framework\Object') + $this->responseMock = $this->getMockBuilder('\Magento\Framework\DataObject') ->setMethods(['getResultCode', 'getOrigresult', 'getRespmsg', 'getPnref']) ->disableOriginalConstructor() ->getMock(); @@ -118,11 +118,11 @@ class TransparentTest extends \PHPUnit_Framework_TestCase */ protected function initializationAuthorizeMock() { - $this->orderMock = $this->getMockBuilder('Magento\Framework\Object') + $this->orderMock = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods(['getCustomerId', 'getBillingAddress', 'getShippingAddress', 'getCustomerEmail']) ->disableOriginalConstructor() ->getMock(); - $this->addressBillingMock = $this->getMockBuilder('Magento\Framework\Object') + $this->addressBillingMock = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods( [ 'getFirstname', @@ -135,7 +135,7 @@ class TransparentTest extends \PHPUnit_Framework_TestCase ] )->disableOriginalConstructor() ->getMock(); - $this->addressShippingMock = $this->getMockBuilder('Magento\Framework\Object') + $this->addressShippingMock = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods( [ 'getFirstname', @@ -218,7 +218,7 @@ class TransparentTest extends \PHPUnit_Framework_TestCase */ protected function crateVoidResponseMock() { - $voidResponseMock = $this->getMockBuilder('Magento\Framework\Object') + $voidResponseMock = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods( [ 'getResultCode', diff --git a/app/code/Magento/Paypal/Test/Unit/Model/PayflowlinkTest.php b/app/code/Magento/Paypal/Test/Unit/Model/PayflowlinkTest.php index 32d01b61e63..99bb9e56a3b 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/PayflowlinkTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/PayflowlinkTest.php @@ -121,7 +121,7 @@ class PayflowlinkTest extends \PHPUnit_Framework_TestCase ->method('getBuildNotationCode') ->will($this->returnValue('build notation code')); - $response = new \Magento\Framework\Object( + $response = new \Magento\Framework\DataObject( [ 'result' => '0', 'pnref' => 'V19A3D27B61E', @@ -155,7 +155,7 @@ class PayflowlinkTest extends \PHPUnit_Framework_TestCase ['USER2', 'a20d3dc6824c1f7780c5529dc37ae5e', $this->returnSelf()] ); - $stateObject = new \Magento\Framework\Object(); + $stateObject = new \Magento\Framework\DataObject(); $this->model->initialize(\Magento\Paypal\Model\Config::PAYMENT_ACTION_AUTH, $stateObject); } diff --git a/app/code/Magento/Paypal/Test/Unit/Model/PayflowproTest.php b/app/code/Magento/Paypal/Test/Unit/Model/PayflowproTest.php index 2ab7a0272ac..ff90889d946 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/PayflowproTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/PayflowproTest.php @@ -168,7 +168,7 @@ class PayflowproTest extends \PHPUnit_Framework_TestCase '', false ); - $response = new \Magento\Framework\Object( + $response = new \Magento\Framework\DataObject( [ 'result' => '0', 'pnref' => 'V19A3D27B61E', @@ -212,13 +212,13 @@ class PayflowproTest extends \PHPUnit_Framework_TestCase { return [ [ - 'response' => new \Magento\Framework\Object( + 'response' => new \Magento\Framework\DataObject( [ 'pnref' => 'V19A3D27B61E', 'result_code' => Payflowpro::RESPONSE_CODE_APPROVED, ] ), - 'paymentExpected' => new \Magento\Framework\Object( + 'paymentExpected' => new \Magento\Framework\DataObject( [ 'transaction_id' => 'V19A3D27B61E', 'is_transaction_closed' => 0, @@ -226,13 +226,13 @@ class PayflowproTest extends \PHPUnit_Framework_TestCase ), ], [ - 'response' => new \Magento\Framework\Object( + 'response' => new \Magento\Framework\DataObject( [ 'pnref' => 'V19A3D27B61E', 'result_code' => Payflowpro::RESPONSE_CODE_FRAUDSERVICE_FILTER ] ), - 'paymentExpected' => new \Magento\Framework\Object( + 'paymentExpected' => new \Magento\Framework\DataObject( [ 'transaction_id' => 'V19A3D27B61E', 'is_transaction_closed' => 0, diff --git a/app/code/Magento/Persistent/Model/Observer/Session.php b/app/code/Magento/Persistent/Model/Observer/Session.php index 27cf0e7e34f..4e731bbd8e3 100644 --- a/app/code/Magento/Persistent/Model/Observer/Session.php +++ b/app/code/Magento/Persistent/Model/Observer/Session.php @@ -209,7 +209,11 @@ class Session /** @var $request \Magento\Framework\App\RequestInterface */ $request = $observer->getEvent()->getRequest(); if ($request && $request->isXmlHttpRequest()) { - $requestData = \Zend_Json::decode($request->getContent()); + $requestData = []; + $content = $request->getContent(); + if ($content) { + $requestData = \Zend_Json::decode($content); + } $isRememberMeChecked = empty($requestData['persistent_remember_me']) ? false : true; $this->_persistentSession->setRememberMeChecked((bool)$isRememberMeChecked); } diff --git a/app/code/Magento/Persistent/Model/Observer/UpdateCustomerCookies.php b/app/code/Magento/Persistent/Model/Observer/UpdateCustomerCookies.php index f3b89420dd0..ea050554c61 100644 --- a/app/code/Magento/Persistent/Model/Observer/UpdateCustomerCookies.php +++ b/app/code/Magento/Persistent/Model/Observer/UpdateCustomerCookies.php @@ -51,7 +51,7 @@ class UpdateCustomerCookies } $customerCookies = $observer->getEvent()->getCustomerCookies(); - if ($customerCookies instanceof \Magento\Framework\Object) { + if ($customerCookies instanceof \Magento\Framework\DataObject) { $persistentCustomer = $this->customerRepository->getById( $this->_persistentSession->getSession()->getCustomerId() ); diff --git a/app/code/Magento/Persistent/Model/Session.php b/app/code/Magento/Persistent/Model/Session.php index 0808055413f..08ee391e871 100644 --- a/app/code/Magento/Persistent/Model/Session.php +++ b/app/code/Magento/Persistent/Model/Session.php @@ -220,7 +220,10 @@ class Session extends \Magento\Framework\Model\AbstractModel protected function _afterLoad() { parent::_afterLoad(); - $info = $this->jsonHelper->jsonDecode($this->getInfo()); + $info = null; + if ($this->getInfo()) { + $info = $this->jsonHelper->jsonDecode($this->getInfo()); + } if (is_array($info)) { foreach ($info as $key => $value) { $this->setData($key, $value); diff --git a/app/code/Magento/Persistent/Test/Unit/Model/Observer/DisableGuestCheckoutTest.php b/app/code/Magento/Persistent/Test/Unit/Model/Observer/DisableGuestCheckoutTest.php index 7fdeffd2b04..7fa45b30e36 100644 --- a/app/code/Magento/Persistent/Test/Unit/Model/Observer/DisableGuestCheckoutTest.php +++ b/app/code/Magento/Persistent/Test/Unit/Model/Observer/DisableGuestCheckoutTest.php @@ -49,7 +49,7 @@ class DisableGuestCheckoutTest extends \PHPUnit_Framework_TestCase public function testExecuteWithPersistentSession() { - $resultMock = $this->getMock('Magento\Framework\Object', ['setIsAllowed', '__wakeUp'], [], '', false); + $resultMock = $this->getMock('Magento\Framework\DataObject', ['setIsAllowed', '__wakeUp'], [], '', false); $this->sessionHelperMock->expects($this->once())->method('isPersistent')->will($this->returnValue(true)); $this->observerMock ->expects($this->once()) diff --git a/app/code/Magento/Persistent/Test/Unit/Model/Observer/PreventExpressCheckoutTest.php b/app/code/Magento/Persistent/Test/Unit/Model/Observer/PreventExpressCheckoutTest.php index 0b78e060b7b..4b504234088 100644 --- a/app/code/Magento/Persistent/Test/Unit/Model/Observer/PreventExpressCheckoutTest.php +++ b/app/code/Magento/Persistent/Test/Unit/Model/Observer/PreventExpressCheckoutTest.php @@ -124,7 +124,7 @@ class PreventExpressCheckoutTest extends \PHPUnit_Framework_TestCase $expectedActionName = 'realAction'; $unexpectedActionName = 'notAction'; - $request = new \Magento\Framework\Object(); + $request = new \Magento\Framework\DataObject(); $request->setActionName($unexpectedActionName); $expressRedirectMock = $this->getMockBuilder( 'Magento\Checkout\Controller\Express\RedirectLoginInterface' diff --git a/app/code/Magento/Persistent/Test/Unit/Model/Observer/UpdateCustomerCookiesTest.php b/app/code/Magento/Persistent/Test/Unit/Model/Observer/UpdateCustomerCookiesTest.php index 2a9201c3718..463b92d204d 100644 --- a/app/code/Magento/Persistent/Test/Unit/Model/Observer/UpdateCustomerCookiesTest.php +++ b/app/code/Magento/Persistent/Test/Unit/Model/Observer/UpdateCustomerCookiesTest.php @@ -86,7 +86,7 @@ class UpdateCustomerCookiesTest extends \PHPUnit_Framework_TestCase $customerId = 1; $customerGroupId = 2; $cookieMock = - $this->getMock('Magento\Framework\Object', + $this->getMock('Magento\Framework\DataObject', ['setCustomerId', 'setCustomerGroupId', '__wakeUp'], [], '', false); $this->sessionHelperMock->expects($this->once())->method('isPersistent')->will($this->returnValue(true)); diff --git a/app/code/Magento/ProductAlert/Controller/Add/TestObserver.php b/app/code/Magento/ProductAlert/Controller/Add/TestObserver.php index a7d28f45b0d..96a357be0e8 100644 --- a/app/code/Magento/ProductAlert/Controller/Add/TestObserver.php +++ b/app/code/Magento/ProductAlert/Controller/Add/TestObserver.php @@ -6,7 +6,7 @@ namespace Magento\ProductAlert\Controller\Add; use Magento\ProductAlert\Controller\Add as AddController; -use Magento\Framework\Object; +use Magento\Framework\DataObject; class TestObserver extends AddController { @@ -15,7 +15,7 @@ class TestObserver extends AddController */ public function execute() { - $object = new Object(); + $object = new DataObject(); /** @var \Magento\ProductAlert\Model\Observer $observer */ $observer = $this->_objectManager->get('Magento\ProductAlert\Model\Observer'); $observer->process($object); diff --git a/app/code/Magento/Quote/Model/Observer/Frontend/Quote/Address/VatValidator.php b/app/code/Magento/Quote/Model/Observer/Frontend/Quote/Address/VatValidator.php index e388a936b4d..9c9ac27cdce 100644 --- a/app/code/Magento/Quote/Model/Observer/Frontend/Quote/Address/VatValidator.php +++ b/app/code/Magento/Quote/Model/Observer/Frontend/Quote/Address/VatValidator.php @@ -38,7 +38,7 @@ class VatValidator * * @param \Magento\Quote\Model\Quote\Address $quoteAddress * @param \Magento\Store\Model\Store|int $store - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function validate(\Magento\Quote\Model\Quote\Address $quoteAddress, $store) { @@ -73,7 +73,7 @@ class VatValidator $quoteAddress->save(); } else { // Restore validation results from corresponding quote address - $validationResult = new \Magento\Framework\Object( + $validationResult = new \Magento\Framework\DataObject( [ 'is_valid' => (int)$quoteAddress->getVatIsValid(), 'request_identifier' => (string)$quoteAddress->getVatRequestId(), diff --git a/app/code/Magento/Quote/Model/Observer/Webapi/Submit.php b/app/code/Magento/Quote/Model/Observer/Webapi/Submit.php index 7b08adc78fa..d7df2d04afc 100644 --- a/app/code/Magento/Quote/Model/Observer/Webapi/Submit.php +++ b/app/code/Magento/Quote/Model/Observer/Webapi/Submit.php @@ -32,7 +32,7 @@ class Submit } /** - * @param \Magento\Framework\Object $observer + * @param \Magento\Framework\DataObject $observer * * @return void */ diff --git a/app/code/Magento/Quote/Model/Quote.php b/app/code/Magento/Quote/Model/Quote.php index 37848ab8fc0..e9ee00aa7b0 100644 --- a/app/code/Magento/Quote/Model/Quote.php +++ b/app/code/Magento/Quote/Model/Quote.php @@ -252,7 +252,7 @@ class Quote extends AbstractExtensibleModel implements \Magento\Quote\Api\Data\C protected $_quotePaymentCollectionFactory; /** - * @var \Magento\Framework\Object\Copy + * @var \Magento\Framework\DataObject\Copy */ protected $_objectCopyService; @@ -288,7 +288,7 @@ class Quote extends AbstractExtensibleModel implements \Magento\Quote\Api\Data\C protected $itemProcessor; /** - * @var \Magento\Framework\Object\Factory + * @var \Magento\Framework\DataObject\Factory */ protected $objectFactory; @@ -347,10 +347,10 @@ class Quote extends AbstractExtensibleModel implements \Magento\Quote\Api\Data\C * @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository * @param Quote\PaymentFactory $quotePaymentFactory * @param Resource\Quote\Payment\CollectionFactory $quotePaymentCollectionFactory - * @param \Magento\Framework\Object\Copy $objectCopyService + * @param \Magento\Framework\DataObject\Copy $objectCopyService * @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry * @param Quote\Item\Processor $itemProcessor - * @param \Magento\Framework\Object\Factory $objectFactory + * @param \Magento\Framework\DataObject\Factory $objectFactory * @param \Magento\Customer\Api\AddressRepositoryInterface $addressRepository * @param \Magento\Framework\Api\SearchCriteriaBuilder $criteriaBuilder * @param \Magento\Framework\Api\FilterBuilder $filterBuilder @@ -386,10 +386,10 @@ class Quote extends AbstractExtensibleModel implements \Magento\Quote\Api\Data\C \Magento\Catalog\Api\ProductRepositoryInterface $productRepository, \Magento\Quote\Model\Quote\PaymentFactory $quotePaymentFactory, \Magento\Quote\Model\Resource\Quote\Payment\CollectionFactory $quotePaymentCollectionFactory, - \Magento\Framework\Object\Copy $objectCopyService, + \Magento\Framework\DataObject\Copy $objectCopyService, \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry, \Magento\Quote\Model\Quote\Item\Processor $itemProcessor, - \Magento\Framework\Object\Factory $objectFactory, + \Magento\Framework\DataObject\Factory $objectFactory, \Magento\Customer\Api\AddressRepositoryInterface $addressRepository, \Magento\Framework\Api\SearchCriteriaBuilder $criteriaBuilder, \Magento\Framework\Api\FilterBuilder $filterBuilder, @@ -1510,7 +1510,7 @@ class Quote extends AbstractExtensibleModel implements \Magento\Quote\Api\Data\C * Returns error message if product type instance can't prepare product. * * @param mixed $product - * @param null|float|\Magento\Framework\Object $request + * @param null|float|\Magento\Framework\DataObject $request * @param null|string $processMode * @return \Magento\Quote\Model\Quote\Item|string * @throws \Magento\Framework\Exception\LocalizedException @@ -1528,7 +1528,7 @@ class Quote extends AbstractExtensibleModel implements \Magento\Quote\Api\Data\C if (is_numeric($request)) { $request = $this->objectFactory->create(['qty' => $request]); } - if (!$request instanceof \Magento\Framework\Object) { + if (!$request instanceof \Magento\Framework\DataObject) { throw new \Magento\Framework\Exception\LocalizedException( __('We found an invalid request for adding product to quote.') ); @@ -1644,7 +1644,7 @@ class Quote extends AbstractExtensibleModel implements \Magento\Quote\Api\Data\C * It's passed to \Magento\Catalog\Helper\Product->addParamsToBuyRequest() to compose resulting buyRequest. * * Basically it can hold - * - 'current_config', \Magento\Framework\Object or array - current buyRequest that configures product in this item, + * - 'current_config', \Magento\Framework\DataObject or array - current buyRequest that configures product in this item, * used to restore currently attached files * - 'files_prefix': string[a-z0-9_] - prefix that was added at frontend to names of file options (file inputs), * so they won't intersect with other submitted options @@ -1652,8 +1652,8 @@ class Quote extends AbstractExtensibleModel implements \Magento\Quote\Api\Data\C * For more options see \Magento\Catalog\Helper\Product->addParamsToBuyRequest() * * @param int $itemId - * @param \Magento\Framework\Object $buyRequest - * @param null|array|\Magento\Framework\Object $params + * @param \Magento\Framework\DataObject $buyRequest + * @param null|array|\Magento\Framework\DataObject $params * @return \Magento\Quote\Model\Quote\Item * @throws \Magento\Framework\Exception\LocalizedException * @@ -1675,9 +1675,9 @@ class Quote extends AbstractExtensibleModel implements \Magento\Quote\Api\Data\C $product = clone $this->productRepository->getById($productId, false, $this->getStore()->getId()); if (!$params) { - $params = new \Magento\Framework\Object(); + $params = new \Magento\Framework\DataObject(); } elseif (is_array($params)) { - $params = new \Magento\Framework\Object($params); + $params = new \Magento\Framework\DataObject($params); } $params->setCurrentConfig($item->getBuyRequest()); $buyRequest = $this->_catalogProduct->addParamsToBuyRequest($buyRequest, $params); @@ -2140,7 +2140,7 @@ class Quote extends AbstractExtensibleModel implements \Magento\Quote\Api\Data\C * @param string|null $origin Usually a name of module, that embeds error * @param int|null $code Error code, unique for origin, that sets it * @param string|null $message Error message - * @param \Magento\Framework\Object|null $additionalData Any additional data, that caller would like to store + * @param \Magento\Framework\DataObject|null $additionalData Any additional data, that caller would like to store * @return $this */ public function addErrorInfo( diff --git a/app/code/Magento/Quote/Model/Quote/Address.php b/app/code/Magento/Quote/Model/Quote/Address.php index 1c525a5a80a..7deab271f6e 100644 --- a/app/code/Magento/Quote/Model/Quote/Address.php +++ b/app/code/Magento/Quote/Model/Quote/Address.php @@ -246,7 +246,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress implements * @param Address\RateRequestFactory $rateRequestFactory * @param \Magento\Quote\Model\Quote\Address\Total\CollectorFactory $totalCollectorFactory * @param Address\TotalFactory $addressTotalFactory - * @param \Magento\Framework\Object\Copy $objectCopyService + * @param \Magento\Framework\DataObject\Copy $objectCopyService * @param \Magento\Shipping\Model\CarrierFactoryInterface $carrierFactory * @param Address\Validator $validator * @param \Magento\Customer\Model\Address\Mapper $addressMapper @@ -279,7 +279,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress implements \Magento\Quote\Model\Quote\Address\RateRequestFactory $rateRequestFactory, \Magento\Quote\Model\Quote\Address\Total\CollectorFactory $totalCollectorFactory, \Magento\Quote\Model\Quote\Address\TotalFactory $addressTotalFactory, - \Magento\Framework\Object\Copy $objectCopyService, + \Magento\Framework\DataObject\Copy $objectCopyService, \Magento\Shipping\Model\CarrierFactoryInterface $carrierFactory, Address\Validator $validator, \Magento\Customer\Model\Address\Mapper $addressMapper, diff --git a/app/code/Magento/Quote/Model/Quote/Address/RateRequest.php b/app/code/Magento/Quote/Model/Quote/Address/RateRequest.php index 33a15af206a..12064ff7890 100644 --- a/app/code/Magento/Quote/Model/Quote/Address/RateRequest.php +++ b/app/code/Magento/Quote/Model/Quote/Address/RateRequest.php @@ -109,6 +109,6 @@ namespace Magento\Quote\Model\Quote\Address; * @method \Magento\Quote\Model\Quote\Address\RateRequest setLimitMethod(string $value) * @method string getLimitMethod() */ -class RateRequest extends \Magento\Framework\Object +class RateRequest extends \Magento\Framework\DataObject { } diff --git a/app/code/Magento/Quote/Model/Quote/Address/RateResult/AbstractResult.php b/app/code/Magento/Quote/Model/Quote/Address/RateResult/AbstractResult.php index b8a098e736f..d7bae8215d5 100644 --- a/app/code/Magento/Quote/Model/Quote/Address/RateResult/AbstractResult.php +++ b/app/code/Magento/Quote/Model/Quote/Address/RateResult/AbstractResult.php @@ -5,6 +5,6 @@ */ namespace Magento\Quote\Model\Quote\Address\RateResult; -class AbstractResult extends \Magento\Framework\Object +class AbstractResult extends \Magento\Framework\DataObject { } diff --git a/app/code/Magento/Quote/Model/Quote/Address/ToOrder.php b/app/code/Magento/Quote/Model/Quote/Address/ToOrder.php index 3b4649c4473..091557adfae 100644 --- a/app/code/Magento/Quote/Model/Quote/Address/ToOrder.php +++ b/app/code/Magento/Quote/Model/Quote/Address/ToOrder.php @@ -6,7 +6,7 @@ namespace Magento\Quote\Model\Quote\Address; -use Magento\Framework\Object\Copy; +use Magento\Framework\DataObject\Copy; use Magento\Quote\Model\Quote\Address; use Magento\Sales\Api\Data\OrderInterfaceFactory as OrderFactory; use Magento\Sales\Api\Data\OrderInterface; diff --git a/app/code/Magento/Quote/Model/Quote/Address/ToOrderAddress.php b/app/code/Magento/Quote/Model/Quote/Address/ToOrderAddress.php index 86a3a30d541..52b1ab7dbae 100644 --- a/app/code/Magento/Quote/Model/Quote/Address/ToOrderAddress.php +++ b/app/code/Magento/Quote/Model/Quote/Address/ToOrderAddress.php @@ -6,7 +6,7 @@ namespace Magento\Quote\Model\Quote\Address; -use Magento\Framework\Object\Copy; +use Magento\Framework\DataObject\Copy; use Magento\Quote\Model\Quote\Address; use Magento\Sales\Api\Data\OrderAddressInterfaceFactory as OrderAddressFactory; use Magento\Sales\Api\Data\OrderAddressInterface; diff --git a/app/code/Magento/Quote/Model/Quote/Address/Total.php b/app/code/Magento/Quote/Model/Quote/Address/Total.php index 1e92f751503..394d0b91522 100644 --- a/app/code/Magento/Quote/Model/Quote/Address/Total.php +++ b/app/code/Magento/Quote/Model/Quote/Address/Total.php @@ -5,7 +5,7 @@ */ namespace Magento\Quote\Model\Quote\Address; -class Total extends \Magento\Framework\Object +class Total extends \Magento\Framework\DataObject { /** * Merge numeric total values diff --git a/app/code/Magento/Quote/Model/Quote/Item.php b/app/code/Magento/Quote/Model/Quote/Item.php index 51694e5f688..1593b4ac3a5 100644 --- a/app/code/Magento/Quote/Model/Quote/Item.php +++ b/app/code/Magento/Quote/Model/Quote/Item.php @@ -596,7 +596,7 @@ class Item extends \Magento\Quote\Model\Quote\Item\AbstractItem implements \Mage /** * Add option to item * - * @param \Magento\Quote\Model\Quote\Item\Option|\Magento\Framework\Object $option + * @param \Magento\Quote\Model\Quote\Item\Option|\Magento\Framework\DataObject $option * @return $this * @throws \Magento\Framework\Exception\LocalizedException */ @@ -605,7 +605,7 @@ class Item extends \Magento\Quote\Model\Quote\Item\AbstractItem implements \Mage if (is_array($option)) { $option = $this->_itemOptionFactory->create()->setData($option)->setItem($this); } elseif ( - $option instanceof \Magento\Framework\Object && + $option instanceof \Magento\Framework\DataObject && !$option instanceof \Magento\Quote\Model\Quote\Item\Option ) { $option = $this->_itemOptionFactory->create()->setData( @@ -636,11 +636,11 @@ class Item extends \Magento\Quote\Model\Quote\Item\AbstractItem implements \Mage * Example: cataloginventory decimal qty validation may change qty to int, * so need to change quote item qty option value. * - * @param \Magento\Framework\Object $option + * @param \Magento\Framework\DataObject $option * @param int|float|null $value * @return $this */ - public function updateQtyOption(\Magento\Framework\Object $option, $value) + public function updateQtyOption(\Magento\Framework\DataObject $option, $value) { $optionProduct = $option->getProduct(); $options = $this->getQtyOptions(); @@ -803,12 +803,12 @@ class Item extends \Magento\Quote\Model\Quote\Item\AbstractItem implements \Mage * Returns formatted buy request - object, holding request received from * product view page with keys and options for configured product * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getBuyRequest() { $option = $this->getOptionByCode('info_buyRequest'); - $buyRequest = new \Magento\Framework\Object($option ? unserialize($option->getValue()) : []); + $buyRequest = new \Magento\Framework\DataObject($option ? unserialize($option->getValue()) : []); // Overwrite standard buy request qty, because item qty could have changed since adding to quote $buyRequest->setOriginalQty($buyRequest->getQty())->setQty($this->getQty() * 1); @@ -867,7 +867,7 @@ class Item extends \Magento\Quote\Model\Quote\Item\AbstractItem implements \Mage * @param string|null $origin Usually a name of module, that embeds error * @param int|null $code Error code, unique for origin, that sets it * @param string|null $message Error message - * @param \Magento\Framework\Object|null $additionalData Any additional data, that caller would like to store + * @param \Magento\Framework\DataObject|null $additionalData Any additional data, that caller would like to store * @return $this */ public function addErrorInfo($origin = null, $code = null, $message = null, $additionalData = null) diff --git a/app/code/Magento/Quote/Model/Quote/Item/AbstractItem.php b/app/code/Magento/Quote/Model/Quote/Item/AbstractItem.php index 9c8a8666360..2bdeda88c14 100644 --- a/app/code/Magento/Quote/Model/Quote/Item/AbstractItem.php +++ b/app/code/Magento/Quote/Model/Quote/Item/AbstractItem.php @@ -161,7 +161,7 @@ abstract class AbstractItem extends \Magento\Framework\Model\AbstractExtensibleM * Needed to implement \Magento\Catalog\Model\Product\Configuration\Item\Interface. * Return null, as quote item needs no additional configuration. * - * @return null|\Magento\Framework\Object + * @return null|\Magento\Framework\DataObject */ public function getFileDownloadParams() { diff --git a/app/code/Magento/Quote/Model/Quote/Item/Processor.php b/app/code/Magento/Quote/Model/Quote/Item/Processor.php index ad17f5a8ea5..906448dc9fe 100644 --- a/app/code/Magento/Quote/Model/Quote/Item/Processor.php +++ b/app/code/Magento/Quote/Model/Quote/Item/Processor.php @@ -10,7 +10,7 @@ use Magento\Quote\Model\Quote\ItemFactory; use Magento\Quote\Model\Quote\Item; use Magento\Store\Model\StoreManagerInterface; use Magento\Framework\App\State; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Quote\Api\Data\CartItemInterface; /** @@ -53,7 +53,7 @@ class Processor /** * Initialize quote item object * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @param Product $product * * @return \Magento\Quote\Model\Quote\Item @@ -85,11 +85,11 @@ class Processor * Set qty and custom price for quote item * * @param Item $item - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @param Product $candidate * @return void */ - public function prepare(Item $item, Object $request, Product $candidate) + public function prepare(Item $item, DataObject $request, Product $candidate) { /** * We specify qty after we know about parent (for stock) diff --git a/app/code/Magento/Quote/Model/Quote/Item/ToOrderItem.php b/app/code/Magento/Quote/Model/Quote/Item/ToOrderItem.php index 7b144e1cd6b..b70bc53aaf3 100644 --- a/app/code/Magento/Quote/Model/Quote/Item/ToOrderItem.php +++ b/app/code/Magento/Quote/Model/Quote/Item/ToOrderItem.php @@ -6,7 +6,7 @@ namespace Magento\Quote\Model\Quote\Item; -use Magento\Framework\Object\Copy; +use Magento\Framework\DataObject\Copy; use Magento\Quote\Model\Quote\Item; use Magento\Quote\Model\Quote\Address\Item as AddressItem; use Magento\Sales\Api\Data\OrderItemInterfaceFactory as OrderItemFactory; diff --git a/app/code/Magento/Quote/Model/Quote/Item/Updater.php b/app/code/Magento/Quote/Model/Quote/Item/Updater.php index a71d872dc76..8a695babce6 100644 --- a/app/code/Magento/Quote/Model/Quote/Item/Updater.php +++ b/app/code/Magento/Quote/Model/Quote/Item/Updater.php @@ -7,7 +7,7 @@ namespace Magento\Quote\Model\Quote\Item; use Magento\Catalog\Model\ProductFactory; use Magento\Framework\Locale\FormatInterface; -use Magento\Framework\Object\Factory as ObjectFactory; +use Magento\Framework\DataObject\Factory as ObjectFactory; use Magento\Quote\Model\Quote; use Magento\Quote\Model\Quote\Item; use Zend\Code\Exception\InvalidArgumentException; @@ -99,7 +99,7 @@ class Updater protected function setCustomPrice(array $info, Item $item) { $itemPrice = $this->parseCustomPrice($info['custom_price']); - /** @var \Magento\Framework\Object $infoBuyRequest */ + /** @var \Magento\Framework\DataObject $infoBuyRequest */ $infoBuyRequest = $item->getBuyRequest(); if ($infoBuyRequest) { $infoBuyRequest->setCustomPrice($itemPrice); @@ -123,7 +123,7 @@ class Updater */ protected function unsetCustomPrice(Item $item) { - /** @var \Magento\Framework\Object $infoBuyRequest */ + /** @var \Magento\Framework\DataObject $infoBuyRequest */ $infoBuyRequest = $item->getBuyRequest(); if ($infoBuyRequest->hasData('custom_price')) { $infoBuyRequest->unsetData('custom_price'); diff --git a/app/code/Magento/Quote/Model/Quote/Payment.php b/app/code/Magento/Quote/Model/Quote/Payment.php index 68ea05b6e1b..3fbba56f6ab 100644 --- a/app/code/Magento/Quote/Model/Quote/Payment.php +++ b/app/code/Magento/Quote/Model/Quote/Payment.php @@ -145,7 +145,7 @@ class Payment extends \Magento\Payment\Model\Info implements \Magento\Quote\Api\ */ public function importData(array $data) { - $data = new \Magento\Framework\Object($data); + $data = new \Magento\Framework\DataObject($data); $this->_eventManager->dispatch( $this->_eventPrefix . '_import_data_before', [$this->_eventObject => $this, 'input' => $data] diff --git a/app/code/Magento/Quote/Model/Quote/Payment/ToOrderPayment.php b/app/code/Magento/Quote/Model/Quote/Payment/ToOrderPayment.php index a65e71d2246..5098f557b92 100644 --- a/app/code/Magento/Quote/Model/Quote/Payment/ToOrderPayment.php +++ b/app/code/Magento/Quote/Model/Quote/Payment/ToOrderPayment.php @@ -9,7 +9,7 @@ namespace Magento\Quote\Model\Quote\Payment; use Magento\Quote\Model\Quote\Payment; use Magento\Sales\Api\Data\OrderPaymentInterfaceFactory as OrderPaymentFactory; use Magento\Sales\Api\Data\OrderPaymentInterface; -use Magento\Framework\Object\Copy; +use Magento\Framework\DataObject\Copy; use Magento\Payment\Model\Method\Substitution; /** diff --git a/app/code/Magento/Quote/Model/Resource/Quote/Address/Attribute/Backend/Child.php b/app/code/Magento/Quote/Model/Resource/Quote/Address/Attribute/Backend/Child.php index 239ca4d751a..06dd4001926 100644 --- a/app/code/Magento/Quote/Model/Resource/Quote/Address/Attribute/Backend/Child.php +++ b/app/code/Magento/Quote/Model/Resource/Quote/Address/Attribute/Backend/Child.php @@ -15,7 +15,7 @@ class Child extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Set store id to the attribute * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function beforeSave($object) diff --git a/app/code/Magento/Quote/Model/Resource/Quote/Address/Attribute/Backend/Region.php b/app/code/Magento/Quote/Model/Resource/Quote/Address/Attribute/Backend/Region.php index 2a57c823e6f..fde5265506e 100644 --- a/app/code/Magento/Quote/Model/Resource/Quote/Address/Attribute/Backend/Region.php +++ b/app/code/Magento/Quote/Model/Resource/Quote/Address/Attribute/Backend/Region.php @@ -26,7 +26,7 @@ class Region extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Set region to the attribute * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function beforeSave($object) diff --git a/app/code/Magento/Quote/Model/Resource/Quote/Address/Rate/Collection.php b/app/code/Magento/Quote/Model/Resource/Quote/Address/Rate/Collection.php index 94d13b94377..7ac150dec8f 100644 --- a/app/code/Magento/Quote/Model/Resource/Quote/Address/Rate/Collection.php +++ b/app/code/Magento/Quote/Model/Resource/Quote/Address/Rate/Collection.php @@ -96,7 +96,7 @@ class Collection extends \Magento\Framework\Model\Resource\Db\VersionControl\Col * @param \Magento\Quote\Model\Quote\Address\Rate $rate * @return $this */ - public function addItem(\Magento\Framework\Object $rate) + public function addItem(\Magento\Framework\DataObject $rate) { $carrier = $this->_carrierFactory->get($rate->getCarrier()); if ($this->_allowFixedOnly && (!$carrier || !$carrier->isFixed())) { diff --git a/app/code/Magento/Quote/Test/Unit/Model/Observer/Frontend/Quote/Address/VatValidatorTest.php b/app/code/Magento/Quote/Test/Unit/Model/Observer/Frontend/Quote/Address/VatValidatorTest.php index 965d0b4ad21..f326ca73721 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/Observer/Frontend/Quote/Address/VatValidatorTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/Observer/Frontend/Quote/Address/VatValidatorTest.php @@ -38,7 +38,7 @@ class VatValidatorTest extends \PHPUnit_Framework_TestCase protected $testData; /** - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $validationResult; @@ -114,7 +114,7 @@ class VatValidatorTest extends \PHPUnit_Framework_TestCase $this->quoteAddressMock->expects($this->any())->method('getCountryId')->will($this->returnValue('en')); $this->quoteAddressMock->expects($this->any())->method('getVatId')->will($this->returnValue('testVatID')); - $this->validationResult = new \Magento\Framework\Object($this->testData); + $this->validationResult = new \Magento\Framework\DataObject($this->testData); $this->model = new \Magento\Quote\Model\Observer\Frontend\Quote\Address\VatValidator( $this->customerAddressMock, diff --git a/app/code/Magento/Quote/Test/Unit/Model/Observer/Webapi/SubmitTest.php b/app/code/Magento/Quote/Test/Unit/Model/Observer/Webapi/SubmitTest.php index 18603c64890..d47293dc44b 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/Observer/Webapi/SubmitTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/Observer/Webapi/SubmitTest.php @@ -23,7 +23,7 @@ class SubmitTest extends \PHPUnit_Framework_TestCase protected $orderSenderMock; /** - * @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject */ protected $observerMock; @@ -54,7 +54,7 @@ class SubmitTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->setMethods(['getQuote', 'getOrder']) ->getMock(); - $this->observerMock = $this->getMock('Magento\Framework\Object', ['getEvent'], [], '', false); + $this->observerMock = $this->getMock('Magento\Framework\DataObject', ['getEvent'], [], '', false); $this->observerMock->expects($this->any())->method('getEvent')->willReturn($eventMock); $eventMock->expects($this->once())->method('getQuote')->willReturn($this->quoteMock); $eventMock->expects($this->once())->method('getOrder')->willReturn($this->orderMock); diff --git a/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/ToOrderAddressTest.php b/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/ToOrderAddressTest.php index fd0c578b654..522caa3c2fa 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/ToOrderAddressTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/ToOrderAddressTest.php @@ -13,7 +13,7 @@ use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; class ToOrderAddressTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Framework\Object\Copy | \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObject\Copy | \PHPUnit_Framework_MockObject_MockObject */ protected $objectCopyMock; @@ -46,7 +46,7 @@ class ToOrderAddressTest extends \PHPUnit_Framework_TestCase '', false ); - $this->objectCopyMock = $this->getMock('Magento\Framework\Object\Copy', [], [], '', false); + $this->objectCopyMock = $this->getMock('Magento\Framework\DataObject\Copy', [], [], '', false); $this->orderInterfaceMock = $this->getMock('Magento\Sales\Api\Data\OrderAddressInterface', [], [], '', false); $this->dataObjectHelper = $this->getMock('\Magento\Framework\Api\DataObjectHelper', [], [], '', false); $objectManager = new ObjectManager($this); diff --git a/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/ToOrderTest.php b/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/ToOrderTest.php index 0859ec68fe7..6b307336f2f 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/ToOrderTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/ToOrderTest.php @@ -13,7 +13,7 @@ use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; class ToOrderTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Framework\Object\Copy | \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObject\Copy | \PHPUnit_Framework_MockObject_MockObject */ protected $objectCopyMock; @@ -51,7 +51,7 @@ class ToOrderTest extends \PHPUnit_Framework_TestCase '', false ); - $this->objectCopyMock = $this->getMock('Magento\Framework\Object\Copy', [], [], '', false); + $this->objectCopyMock = $this->getMock('Magento\Framework\DataObject\Copy', [], [], '', false); $this->orderInterfaceMock = $this->getMockForAbstractClass( 'Magento\Sales\Api\Data\OrderInterface', [], diff --git a/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/ProcessorTest.php b/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/ProcessorTest.php index 84864eab629..d3f6c869385 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/ProcessorTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/ProcessorTest.php @@ -13,7 +13,7 @@ use Magento\Quote\Model\Quote\Item; use Magento\Store\Model\StoreManagerInterface; use Magento\Store\Model\Store; use Magento\Framework\App\State; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Tests for Magento\Quote\Model\Service\Quote\Processor @@ -124,7 +124,7 @@ class ProcessorTest extends \PHPUnit_Framework_TestCase false ); $this->objectMock = $this->getMock( - 'Magento\Framework\Object', + 'Magento\Framework\DataObject', ['getResetCount', 'getId', 'getCustomPrice'], [], '', diff --git a/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/ToOrderItemTest.php b/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/ToOrderItemTest.php index fbe01094a45..29cf851aaba 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/ToOrderItemTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/ToOrderItemTest.php @@ -21,7 +21,7 @@ class ToOrderItemTest extends \PHPUnit_Framework_TestCase protected $orderItemFactoryMock; /** - * @var \Magento\Framework\Object\Copy|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObject\Copy|\PHPUnit_Framework_MockObject_MockObject */ protected $objectCopyServiceMock; @@ -55,7 +55,7 @@ class ToOrderItemTest extends \PHPUnit_Framework_TestCase false ); $this->objectCopyServiceMock = $this->getMock( - 'Magento\Framework\Object\Copy', + 'Magento\Framework\DataObject\Copy', [], [], '', diff --git a/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/UpdaterTest.php b/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/UpdaterTest.php index 6d18c54136c..4a4a241476d 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/UpdaterTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/UpdaterTest.php @@ -231,7 +231,7 @@ class UpdaterTest extends \PHPUnit_Framework_TestCase $customPrice = 9.99; $qty = 3; $buyRequestMock = $this->getMock( - 'Magento\Framework\Object', + 'Magento\Framework\DataObject', [ 'setCustomPrice', 'setValue', @@ -297,7 +297,7 @@ class UpdaterTest extends \PHPUnit_Framework_TestCase { $qty = 3; $buyRequestMock = $this->getMock( - 'Magento\Framework\Object', + 'Magento\Framework\DataObject', [ 'setCustomPrice', 'setValue', diff --git a/app/code/Magento/Quote/Test/Unit/Model/Quote/ItemTest.php b/app/code/Magento/Quote/Test/Unit/Model/Quote/ItemTest.php index 9b43539ce8b..2f25926744d 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/Quote/ItemTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/Quote/ItemTest.php @@ -918,7 +918,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase ->method('getTypeInstance') ->will($this->returnValue($typeInstanceMock)); - $optionMock = $this->getMockBuilder('Magento\Framework\Object') + $optionMock = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->setMethods(['getProduct']) ->getMock(); @@ -1094,7 +1094,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase $origin = 'origin'; $code = 1; $message = "message"; - $additionalData = new \Magento\Framework\Object(); + $additionalData = new \Magento\Framework\DataObject(); $additionalData->setTemp(true); $this->errorInfos->expects($this->once()) diff --git a/app/code/Magento/Quote/Test/Unit/Model/Quote/Payment/ToOrderPaymentTest.php b/app/code/Magento/Quote/Test/Unit/Model/Quote/Payment/ToOrderPaymentTest.php index 4ff569e76dc..5ff4c57d67c 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/Quote/Payment/ToOrderPaymentTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/Quote/Payment/ToOrderPaymentTest.php @@ -22,7 +22,7 @@ class ToOrderPaymentTest extends \PHPUnit_Framework_TestCase protected $orderPaymentFactoryMock; /** - * @var \Magento\Framework\Object\Copy | \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObject\Copy | \PHPUnit_Framework_MockObject_MockObject */ protected $objectCopyMock; @@ -50,7 +50,7 @@ class ToOrderPaymentTest extends \PHPUnit_Framework_TestCase '', false ); - $this->objectCopyMock = $this->getMock('Magento\Framework\Object\Copy', [], [], '', false); + $this->objectCopyMock = $this->getMock('Magento\Framework\DataObject\Copy', [], [], '', false); $this->orderPaymentFactoryMock = $this->getMock( 'Magento\Sales\Api\Data\OrderPaymentInterfaceFactory', ['create'], diff --git a/app/code/Magento/Quote/Test/Unit/Model/QuoteTest.php b/app/code/Magento/Quote/Test/Unit/Model/QuoteTest.php index 138fb31c0f3..892899ee72a 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/QuoteTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/QuoteTest.php @@ -78,7 +78,7 @@ class QuoteTest extends \PHPUnit_Framework_TestCase protected $productMock; /** - * @var \Magento\Framework\Object\Factory |\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObject\Factory |\PHPUnit_Framework_MockObject_MockObject */ protected $objectFactoryMock; @@ -128,7 +128,7 @@ class QuoteTest extends \PHPUnit_Framework_TestCase protected $customerRepositoryMock; /** - * @var \Magento\Framework\Object\Copy | \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObject\Copy | \PHPUnit_Framework_MockObject_MockObject */ protected $objectCopyServiceMock; @@ -183,14 +183,14 @@ class QuoteTest extends \PHPUnit_Framework_TestCase ['getById'] ); $this->objectCopyServiceMock = $this->getMock( - 'Magento\Framework\Object\Copy', + 'Magento\Framework\DataObject\Copy', ['copyFieldsetToTarget'], [], '', false ); $this->productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); - $this->objectFactoryMock = $this->getMock('\Magento\Framework\Object\Factory', ['create'], [], '', false); + $this->objectFactoryMock = $this->getMock('\Magento\Framework\DataObject\Factory', ['create'], [], '', false); $this->quoteAddressFactoryMock->expects( $this->any() )->method( @@ -803,7 +803,7 @@ class QuoteTest extends \PHPUnit_Framework_TestCase { $expectedResult = 'test_string'; $requestMock = $this->getMock( - '\Magento\Framework\Object' + '\Magento\Framework\DataObject' ); $this->objectFactoryMock->expects($this->once()) ->method('create') @@ -842,7 +842,7 @@ class QuoteTest extends \PHPUnit_Framework_TestCase $expectedResult = $itemMock; $requestMock = $this->getMock( - '\Magento\Framework\Object' + '\Magento\Framework\DataObject' ); $this->objectFactoryMock->expects($this->once()) ->method('create') diff --git a/app/code/Magento/Quote/etc/fieldset.xml b/app/code/Magento/Quote/etc/fieldset.xml index 49008923765..4be04d06516 100644 --- a/app/code/Magento/Quote/etc/fieldset.xml +++ b/app/code/Magento/Quote/etc/fieldset.xml @@ -6,7 +6,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Object/etc/fieldset.xsd"> + xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/DataObject/etc/fieldset.xsd"> <scope id="global"> <fieldset id="quote_convert_address"> <field name="weight"> diff --git a/app/code/Magento/Reports/Block/Adminhtml/Filter/Form.php b/app/code/Magento/Reports/Block/Adminhtml/Filter/Form.php index 335952ca4de..6b4b7eaf266 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Filter/Form.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Filter/Form.php @@ -232,7 +232,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic // apply field options foreach ($this->_fieldOptions as $fieldId => $fieldOptions) { $field = $fieldset->getElements()->searchById($fieldId); - /** @var \Magento\Framework\Object $field */ + /** @var \Magento\Framework\DataObject $field */ if ($field) { foreach ($fieldOptions as $k => $v) { $field->setDataUsingMethod($k, $v); diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid/AbstractGrid.php b/app/code/Magento/Reports/Block/Adminhtml/Grid/AbstractGrid.php index e22d486a0e6..b1e46d90a3c 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Grid/AbstractGrid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid/AbstractGrid.php @@ -304,7 +304,7 @@ class AbstractGrid extends \Magento\Backend\Block\Widget\Grid\Extended $this->_addOrderStatusFilter($totalsCollection, $filterData); if ($totalsCollection->load()->getSize() < 1 || !$filterData->getData('from')) { - $this->setTotals(new \Magento\Framework\Object()); + $this->setTotals(new \Magento\Framework\DataObject()); $this->setCountTotals(false); } else { foreach ($totalsCollection->getItems() as $item) { @@ -387,7 +387,7 @@ class AbstractGrid extends \Magento\Backend\Block\Widget\Grid\Extended * Add order status filter * * @param \Magento\Reports\Model\Resource\Report\Collection\AbstractCollection $collection - * @param \Magento\Framework\Object $filterData + * @param \Magento\Framework\DataObject $filterData * @return $this */ protected function _addOrderStatusFilter($collection, $filterData) @@ -401,7 +401,7 @@ class AbstractGrid extends \Magento\Backend\Block\Widget\Grid\Extended * Can be overridden in child classes if custom filter needed * * @param \Magento\Reports\Model\Resource\Report\Collection\AbstractCollection $collection - * @param \Magento\Framework\Object $filterData + * @param \Magento\Framework\DataObject $filterData * @return $this * @SuppressWarnings(PHPMD.UnusedFormalParameter) * @codeCoverageIgnore diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Blanknumber.php b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Blanknumber.php index fa38eeecbb7..104c53913b7 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Blanknumber.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Blanknumber.php @@ -13,11 +13,11 @@ namespace Magento\Reports\Block\Adminhtml\Grid\Column\Renderer; class Blanknumber extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Number { /** - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * * @return string */ - protected function _getValue(\Magento\Framework\Object $row) + protected function _getValue(\Magento\Framework\DataObject $row) { $data = parent::_getValue($row); if ($data !== null) { diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Currency.php b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Currency.php index 30555dbca8d..a2e5d4935bc 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Currency.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Currency.php @@ -16,10 +16,10 @@ class Currency extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Curren /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $data = $row->getData($this->getColumn()->getIndex()); $currencyCode = $this->_getCurrencyCode($row); diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Customer.php b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Customer.php index 4aabda290f6..b588bb5a286 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Customer.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Customer.php @@ -15,10 +15,10 @@ class Customer extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return \Magento\Framework\Phrase|string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $id = $row->getCustomerId(); diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Product.php b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Product.php index fa58c687a24..85d61659df5 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Product.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Product.php @@ -15,10 +15,10 @@ class Product extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstrac /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $id = $row->getId(); diff --git a/app/code/Magento/Reports/Block/Adminhtml/Product/Downloads/Renderer/Purchases.php b/app/code/Magento/Reports/Block/Adminhtml/Product/Downloads/Renderer/Purchases.php index bc16b2edc87..ae1fc12e6d5 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Product/Downloads/Renderer/Purchases.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Product/Downloads/Renderer/Purchases.php @@ -15,10 +15,10 @@ class Purchases extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstr /** * Renders Purchases value * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return \Magento\Framework\Phrase|string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { if (($value = $row->getData($this->getColumn()->getIndex())) > 0) { return $value; diff --git a/app/code/Magento/Reports/Block/Adminhtml/Product/Viewed/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Product/Viewed/Grid.php index b97781a1f04..69f5335dc23 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Product/Viewed/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Product/Viewed/Grid.php @@ -115,7 +115,7 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\AbstractGrid * Don't use orders in collection * * @param \Magento\Reports\Model\Resource\Report\Collection\AbstractCollection $collection - * @param \Magento\Framework\Object $filterData + * @param \Magento\Framework\DataObject $filterData * @return $this * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ diff --git a/app/code/Magento/Reports/Block/Adminhtml/Sales/Coupons/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Sales/Coupons/Grid.php index cf79f4c0668..e4ca7acdebf 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Sales/Coupons/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Sales/Coupons/Grid.php @@ -206,7 +206,7 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\AbstractGrid * Add price rule filter * * @param \Magento\Reports\Model\Resource\Report\Collection\AbstractCollection $collection - * @param \Magento\Framework\Object $filterData + * @param \Magento\Framework\DataObject $filterData * @return \Magento\Reports\Block\Adminhtml\Grid\AbstractGrid */ protected function _addCustomFilter($collection, $filterData) diff --git a/app/code/Magento/Reports/Block/Adminhtml/Sales/Grid/Column/Renderer/Date.php b/app/code/Magento/Reports/Block/Adminhtml/Sales/Grid/Column/Renderer/Date.php index cda443f4c78..60c1da426c9 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Sales/Grid/Column/Renderer/Date.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Sales/Grid/Column/Renderer/Date.php @@ -58,10 +58,10 @@ class Date extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Date /** * Renders grid column * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { if ($data = $row->getData($this->getColumn()->getIndex())) { switch ($this->getColumn()->getPeriodType()) { diff --git a/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Abandoned/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Abandoned/Grid.php index 59d5cef6ac7..04e370c9736 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Abandoned/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Abandoned/Grid.php @@ -223,7 +223,7 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\Shopcart } /** - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * * @return string */ diff --git a/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Product/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Product/Grid.php index 53044f15068..b30cc26bc90 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Product/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Product/Grid.php @@ -141,7 +141,7 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\Shopcart } /** - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * * @return string */ diff --git a/app/code/Magento/Reports/Block/Product/Viewed.php b/app/code/Magento/Reports/Block/Product/Viewed.php index 9a689ec5a6d..1bc6e1f95e1 100644 --- a/app/code/Magento/Reports/Block/Product/Viewed.php +++ b/app/code/Magento/Reports/Block/Product/Viewed.php @@ -6,7 +6,7 @@ namespace Magento\Reports\Block\Product; -use \Magento\Framework\Object\IdentityInterface; +use \Magento\Framework\DataObject\IdentityInterface; /** * Reports Recently Viewed Products Block diff --git a/app/code/Magento/Reports/Controller/Adminhtml/Report/AbstractReport.php b/app/code/Magento/Reports/Controller/Adminhtml/Report/AbstractReport.php index 1a1b7932691..892b67930c6 100644 --- a/app/code/Magento/Reports/Controller/Adminhtml/Report/AbstractReport.php +++ b/app/code/Magento/Reports/Controller/Adminhtml/Report/AbstractReport.php @@ -73,7 +73,7 @@ abstract class AbstractReport extends \Magento\Backend\App\Action /** * Report action init operations * - * @param array|\Magento\Framework\Object $blocks + * @param array|\Magento\Framework\DataObject $blocks * @return $this */ public function _initReportAction($blocks) @@ -94,7 +94,7 @@ abstract class AbstractReport extends \Magento\Backend\App\Action ); $requestData = $inputFilter->getUnescaped(); $requestData['store_ids'] = $this->getRequest()->getParam('store_ids'); - $params = new \Magento\Framework\Object(); + $params = new \Magento\Framework\DataObject(); foreach ($requestData as $key => $value) { if (!empty($value)) { diff --git a/app/code/Magento/Reports/Model/Config.php b/app/code/Magento/Reports/Model/Config.php index 12fa3befcf7..6de1405b5bb 100644 --- a/app/code/Magento/Reports/Model/Config.php +++ b/app/code/Magento/Reports/Model/Config.php @@ -8,7 +8,7 @@ namespace Magento\Reports\Model; /** * Configuration for reports */ -class Config extends \Magento\Framework\Object +class Config extends \Magento\Framework\DataObject { /** * @var \Magento\Framework\Module\Dir\Reader diff --git a/app/code/Magento/Reports/Model/Item.php b/app/code/Magento/Reports/Model/Item.php index 01a60c397c5..1b4d89a344e 100644 --- a/app/code/Magento/Reports/Model/Item.php +++ b/app/code/Magento/Reports/Model/Item.php @@ -5,7 +5,7 @@ */ namespace Magento\Reports\Model; -class Item extends \Magento\Framework\Object +class Item extends \Magento\Framework\DataObject { /** * @var bool diff --git a/app/code/Magento/Reports/Model/Resource/Customer/Collection.php b/app/code/Magento/Reports/Model/Resource/Customer/Collection.php index 637f5933080..b7d01408868 100644 --- a/app/code/Magento/Reports/Model/Resource/Customer/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Customer/Collection.php @@ -82,7 +82,7 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection * @param \Magento\Eav\Model\Resource\Helper $resourceHelper * @param \Magento\Framework\Validator\UniversalFactory $universalFactory * @param \Magento\Framework\Model\Resource\Db\VersionControl\Snapshot $entitySnapshot - * @param \Magento\Framework\Object\Copy\Config $fieldsetConfig + * @param \Magento\Framework\DataObject\Copy\Config $fieldsetConfig * @param \Magento\Quote\Model\QuoteRepository $quoteRepository * @param \Magento\Quote\Model\Resource\Quote\Item\CollectionFactory $quoteItemFactory * @param \Magento\Sales\Model\Resource\Order\Collection $orderResource @@ -102,7 +102,7 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection \Magento\Eav\Model\Resource\Helper $resourceHelper, \Magento\Framework\Validator\UniversalFactory $universalFactory, \Magento\Framework\Model\Resource\Db\VersionControl\Snapshot $entitySnapshot, - \Magento\Framework\Object\Copy\Config $fieldsetConfig, + \Magento\Framework\DataObject\Copy\Config $fieldsetConfig, \Magento\Quote\Model\QuoteRepository $quoteRepository, \Magento\Quote\Model\Resource\Quote\Item\CollectionFactory $quoteItemFactory, \Magento\Sales\Model\Resource\Order\Collection $orderResource, diff --git a/app/code/Magento/Reports/Model/Resource/Order/Collection.php b/app/code/Magento/Reports/Model/Resource/Order/Collection.php index 97294fb8ddd..205b1a0050e 100644 --- a/app/code/Magento/Reports/Model/Resource/Order/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Order/Collection.php @@ -173,7 +173,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection { if (null === $this->_salesAmountExpression) { $adapter = $this->getConnection(); - $expressionTransferObject = new \Magento\Framework\Object( + $expressionTransferObject = new \Magento\Framework\DataObject( [ 'expression' => '%s - %s - %s - (%s - %s - %s)', 'arguments' => [ diff --git a/app/code/Magento/Reports/Model/Resource/Product/Collection.php b/app/code/Magento/Reports/Model/Resource/Product/Collection.php index 7df4b5dc4d9..fb14cdaa311 100644 --- a/app/code/Magento/Reports/Model/Resource/Product/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Product/Collection.php @@ -237,7 +237,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection */ protected function _joinFields() { - $this->_totals = new \Magento\Framework\Object(); + $this->_totals = new \Magento\Framework\DataObject(); $this->addAttributeToSelect('entity_id')->addAttributeToSelect('name')->addAttributeToSelect('price'); diff --git a/app/code/Magento/Reports/Model/Resource/Product/Index/AbstractIndex.php b/app/code/Magento/Reports/Model/Resource/Product/Index/AbstractIndex.php index 45b1c2c5e9d..8199a91f960 100644 --- a/app/code/Magento/Reports/Model/Resource/Product/Index/AbstractIndex.php +++ b/app/code/Magento/Reports/Model/Resource/Product/Index/AbstractIndex.php @@ -197,11 +197,11 @@ abstract class AbstractIndex extends \Magento\Framework\Model\Resource\Db\Abstra /** * Add information about product ids to visitor/customer * - * @param \Magento\Framework\Object|\Magento\Reports\Model\Product\Index\AbstractIndex $object + * @param \Magento\Framework\DataObject|\Magento\Reports\Model\Product\Index\AbstractIndex $object * @param int[] $productIds * @return $this */ - public function registerIds(\Magento\Framework\Object $object, $productIds) + public function registerIds(\Magento\Framework\DataObject $object, $productIds) { $row = [ 'visitor_id' => $object->getVisitorId(), diff --git a/app/code/Magento/Reports/Model/Resource/Refresh/Collection.php b/app/code/Magento/Reports/Model/Resource/Refresh/Collection.php index 51710f72ab2..129e30f7d58 100644 --- a/app/code/Magento/Reports/Model/Resource/Refresh/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Refresh/Collection.php @@ -116,7 +116,7 @@ class Collection extends \Magento\Framework\Data\Collection ], ]; foreach ($data as $value) { - $item = new \Magento\Framework\Object(); + $item = new \Magento\Framework\DataObject(); $item->setData($value); $this->addItem($item); } diff --git a/app/code/Magento/Reports/Model/Resource/Report/Collection.php b/app/code/Magento/Reports/Model/Resource/Report/Collection.php index abc6db15ad0..8470d35c755 100644 --- a/app/code/Magento/Reports/Model/Resource/Report/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Report/Collection.php @@ -156,7 +156,7 @@ class Collection extends \Magento\Framework\Data\Collection default: break 2; } - $this->_intervals[$interval['period']] = new \Magento\Framework\Object($interval); + $this->_intervals[$interval['period']] = new \Magento\Framework\DataObject($interval); } } return $this->_intervals; diff --git a/app/code/Magento/Reports/Test/Unit/Block/Adminhtml/Sales/Grid/Column/Renderer/DateTest.php b/app/code/Magento/Reports/Test/Unit/Block/Adminhtml/Sales/Grid/Column/Renderer/DateTest.php index 1ceb4a5caef..d88732fa85c 100644 --- a/app/code/Magento/Reports/Test/Unit/Block/Adminhtml/Sales/Grid/Column/Renderer/DateTest.php +++ b/app/code/Magento/Reports/Test/Unit/Block/Adminhtml/Sales/Grid/Column/Renderer/DateTest.php @@ -126,7 +126,7 @@ class DateTest extends \PHPUnit_Framework_TestCase $this->mockGridDateRendererBehaviorWithLocale($locale); $this->mockGridDateColumnConfig($index, $period); - $objectMock = $this->getMockBuilder('Magento\Framework\Object') + $objectMock = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods(['getData']) ->getMock(); $objectMock->expects($this->once())->method('getData')->willReturn($data); @@ -185,7 +185,7 @@ class DateTest extends \PHPUnit_Framework_TestCase $this->mockGridDateRendererBehaviorWithLocale('en_US'); $this->mockGridDateColumnConfig('period', 'day'); - $objectMock = $this->getMockBuilder('Magento\Framework\Object') + $objectMock = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods(['getData']) ->getMock(); $objectMock->expects($this->any())->method('getData')->willReturn('2014-06-25'); diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/AccountsTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/AccountsTest.php index c6267c7192f..baad059fb48 100644 --- a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/AccountsTest.php +++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/AccountsTest.php @@ -7,7 +7,7 @@ namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Customer; use Magento\Reports\Controller\Adminhtml\Report\Customer\Accounts; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\Phrase; class AccountsTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest @@ -47,8 +47,8 @@ class AccountsTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Repor ->expects($this->any()) ->method('getPage') ->willReturn( - new Object( - ['config' => new Object( + new DataObject( + ['config' => new DataObject( ['title' => $titleMock] )] ) diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/OrdersTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/OrdersTest.php index 9e58897f745..1d960cc8175 100644 --- a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/OrdersTest.php +++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/OrdersTest.php @@ -7,7 +7,7 @@ namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Customer; use Magento\Reports\Controller\Adminhtml\Report\Customer\Orders; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\Phrase; class OrdersTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest @@ -47,8 +47,8 @@ class OrdersTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\ ->expects($this->any()) ->method('getPage') ->willReturn( - new Object( - ['config' => new Object( + new DataObject( + ['config' => new DataObject( ['title' => $titleMock] )] ) diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/TotalsTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/TotalsTest.php index bf63f966292..a479fb53c3a 100644 --- a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/TotalsTest.php +++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/TotalsTest.php @@ -7,7 +7,7 @@ namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Customer; use Magento\Reports\Controller\Adminhtml\Report\Customer\Totals; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\Phrase; class TotalsTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest @@ -47,8 +47,8 @@ class TotalsTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\ ->expects($this->any()) ->method('getPage') ->willReturn( - new Object( - ['config' => new Object( + new DataObject( + ['config' => new DataObject( ['title' => $titleMock] )] ) diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/DownloadsTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/DownloadsTest.php index e7e1ada266c..b91ea7a81a8 100644 --- a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/DownloadsTest.php +++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/DownloadsTest.php @@ -7,7 +7,7 @@ namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product; use Magento\Reports\Controller\Adminhtml\Report\Product\Downloads; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\Phrase; class DownloadsTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest @@ -58,8 +58,8 @@ class DownloadsTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Repo ->expects($this->once()) ->method('getPage') ->willReturn( - new Object( - ['config' => new Object( + new DataObject( + ['config' => new DataObject( ['title' => $titleMock] )] ) diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/LowstockTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/LowstockTest.php index 6120128d828..3cd4c936e13 100644 --- a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/LowstockTest.php +++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/LowstockTest.php @@ -7,7 +7,7 @@ namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product; use Magento\Reports\Controller\Adminhtml\Report\Product\Lowstock; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\Phrase; class LowstockTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest @@ -58,8 +58,8 @@ class LowstockTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Repor ->expects($this->once()) ->method('getPage') ->willReturn( - new Object( - ['config' => new Object( + new DataObject( + ['config' => new DataObject( ['title' => $titleMock] )] ) diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/SoldTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/SoldTest.php index 0b1b27e748e..1f8ca5600f7 100644 --- a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/SoldTest.php +++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/SoldTest.php @@ -7,7 +7,7 @@ namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product; use Magento\Reports\Controller\Adminhtml\Report\Product\Sold; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\Phrase; class SoldTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest @@ -58,8 +58,8 @@ class SoldTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Ab ->expects($this->once()) ->method('getPage') ->willReturn( - new Object( - ['config' => new Object( + new DataObject( + ['config' => new DataObject( ['title' => $titleMock] )] ) diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ViewedTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ViewedTest.php index 0d87c428b39..31f70484272 100644 --- a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ViewedTest.php +++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ViewedTest.php @@ -7,7 +7,7 @@ namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product; use Magento\Reports\Controller\Adminhtml\Report\Product\Viewed; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\Phrase; class ViewedTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest @@ -122,8 +122,8 @@ class ViewedTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\ ->expects($this->once()) ->method('getPage') ->willReturn( - new Object( - ['config' => new Object( + new DataObject( + ['config' => new DataObject( ['title' => $titleMock] )] ) diff --git a/app/code/Magento/Reports/Test/Unit/Model/Resource/Report/CollectionTest.php b/app/code/Magento/Reports/Test/Unit/Model/Resource/Report/CollectionTest.php index 518e5e43a70..5667403beb1 100644 --- a/app/code/Magento/Reports/Test/Unit/Model/Resource/Report/CollectionTest.php +++ b/app/code/Magento/Reports/Test/Unit/Model/Resource/Report/CollectionTest.php @@ -116,7 +116,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase $this->collection->setInterval($fromDate, $toDate); $reports = $this->collection->getReports(); foreach ($reports as $report) { - $this->assertInstanceOf('\Magento\Framework\Object', $report); + $this->assertInstanceOf('\Magento\Framework\DataObject', $report); $reportData = $report->getData(); $this->assertTrue(empty($reportData['children'])); $this->assertTrue($reportData['is_empty']); diff --git a/app/code/Magento/Review/Block/Adminhtml/Grid.php b/app/code/Magento/Review/Block/Adminhtml/Grid.php index 73c09bc930e..793bd1ce874 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Grid.php +++ b/app/code/Magento/Review/Block/Adminhtml/Grid.php @@ -353,7 +353,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended /** * Get row url * - * @param \Magento\Review\Model\Review|\Magento\Framework\Object $row + * @param \Magento\Review\Model\Review|\Magento\Framework\DataObject $row * @return string */ public function getRowUrl($row) diff --git a/app/code/Magento/Review/Block/Adminhtml/Grid/Renderer/Type.php b/app/code/Magento/Review/Block/Adminhtml/Grid/Renderer/Type.php index 9f0f240b0ec..1c9ffd5730a 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Grid/Renderer/Type.php +++ b/app/code/Magento/Review/Block/Adminhtml/Grid/Renderer/Type.php @@ -15,10 +15,10 @@ class Type extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRe /** * Render review type * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return \Magento\Framework\Phrase */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { if ($row->getCustomerId()) { return __('Customer'); diff --git a/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php b/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php index 86f2ee89153..91a4acb0ee7 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php +++ b/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php @@ -148,7 +148,7 @@ class Grid extends \Magento\Catalog\Block\Adminhtml\Product\Grid /** * Get catalog product row url * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ public function getRowUrl($row) diff --git a/app/code/Magento/Review/Block/Product/View.php b/app/code/Magento/Review/Block/Product/View.php index 377301f384d..9ec22c73508 100644 --- a/app/code/Magento/Review/Block/Product/View.php +++ b/app/code/Magento/Review/Block/Product/View.php @@ -34,7 +34,7 @@ class View extends \Magento\Catalog\Block\Product\View * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Framework\Url\EncoderInterface $urlEncoder * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Catalog\Helper\Product $productHelper * @param \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig * @param \Magento\Framework\Locale\FormatInterface $localeFormat @@ -49,7 +49,7 @@ class View extends \Magento\Catalog\Block\Product\View \Magento\Catalog\Block\Product\Context $context, \Magento\Framework\Url\EncoderInterface $urlEncoder, \Magento\Framework\Json\EncoderInterface $jsonEncoder, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Catalog\Helper\Product $productHelper, \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig, \Magento\Framework\Locale\FormatInterface $localeFormat, diff --git a/app/code/Magento/Review/Controller/Adminhtml/Product/JsonProductInfo.php b/app/code/Magento/Review/Controller/Adminhtml/Product/JsonProductInfo.php index 0e6cf178d82..2f449cfd4ca 100644 --- a/app/code/Magento/Review/Controller/Adminhtml/Product/JsonProductInfo.php +++ b/app/code/Magento/Review/Controller/Adminhtml/Product/JsonProductInfo.php @@ -11,7 +11,7 @@ use Magento\Framework\Registry; use Magento\Review\Model\ReviewFactory; use Magento\Review\Model\RatingFactory; use Magento\Catalog\Api\ProductRepositoryInterface; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\Controller\ResultFactory; class JsonProductInfo extends ProductController @@ -44,7 +44,7 @@ class JsonProductInfo extends ProductController */ public function execute() { - $response = new Object(); + $response = new DataObject(); $id = $this->getRequest()->getParam('id'); if (intval($id) > 0) { $product = $this->productRepository->getById($id); diff --git a/app/code/Magento/Review/Model/Resource/Review.php b/app/code/Magento/Review/Model/Resource/Review.php index 16798e3f8b1..07afee6c3a9 100644 --- a/app/code/Magento/Review/Model/Resource/Review.php +++ b/app/code/Magento/Review/Model/Resource/Review.php @@ -366,7 +366,7 @@ class Review extends \Magento\Framework\Model\Resource\Db\AbstractDb ':store_id' => $ratingSummaryObject->getStoreId(), ]; $oldData = $readAdapter->fetchRow($select, $bind); - $data = new \Magento\Framework\Object(); + $data = new \Magento\Framework\DataObject(); $data->setReviewsCount($reviewsCount) ->setEntityPkValue($object->getEntityPkValue()) @@ -381,10 +381,10 @@ class Review extends \Magento\Framework\Model\Resource\Db\AbstractDb * Write rating summary * * @param array|bool $oldData - * @param \Magento\Framework\Object $data + * @param \Magento\Framework\DataObject $data * @return void */ - protected function writeReviewSummary($oldData, \Magento\Framework\Object $data) + protected function writeReviewSummary($oldData, \Magento\Framework\DataObject $data) { $writeAdapter = $this->_getWriteAdapter(); $writeAdapter->beginTransaction(); diff --git a/app/code/Magento/Review/Model/Review.php b/app/code/Magento/Review/Model/Review.php index ec1d84b348e..6a0b1c6894f 100644 --- a/app/code/Magento/Review/Model/Review.php +++ b/app/code/Magento/Review/Model/Review.php @@ -6,7 +6,7 @@ namespace Magento\Review\Model; use Magento\Catalog\Model\Product; -use Magento\Framework\Object\IdentityInterface; +use Magento\Framework\DataObject\IdentityInterface; use Magento\Review\Model\Resource\Review\Product\Collection as ProductCollection; use Magento\Review\Model\Resource\Review\Status\Collection as StatusCollection; @@ -213,7 +213,7 @@ class Review extends \Magento\Framework\Model\AbstractModel implements IdentityI public function getEntitySummary($product, $storeId = 0) { $summaryData = $this->_summaryModFactory->create()->setStoreId($storeId)->load($product->getId()); - $summary = new \Magento\Framework\Object(); + $summary = new \Magento\Framework\DataObject(); $summary->setData($summaryData->getData()); $product->setRatingSummary($summary); } diff --git a/app/code/Magento/Review/Test/Unit/Block/Adminhtml/MainTest.php b/app/code/Magento/Review/Test/Unit/Block/Adminhtml/MainTest.php index 93be378cf4c..aa643d15e67 100644 --- a/app/code/Magento/Review/Test/Unit/Block/Adminhtml/MainTest.php +++ b/app/code/Magento/Review/Test/Unit/Block/Adminhtml/MainTest.php @@ -44,7 +44,7 @@ class MainTest extends \PHPUnit_Framework_TestCase $this->customerViewHelper->expects($this->once()) ->method('getCustomerName') ->with($dummyCustomer) - ->will($this->returnValue(new \Magento\Framework\Object())); + ->will($this->returnValue(new \Magento\Framework\DataObject())); $this->request = $this->getMockForAbstractClass('Magento\Framework\App\RequestInterface'); $this->request->expects($this->at(0)) ->method('getParam') diff --git a/app/code/Magento/Review/Test/Unit/Block/Customer/RecentTest.php b/app/code/Magento/Review/Test/Unit/Block/Customer/RecentTest.php index b04e90e9cc7..ce1849881db 100644 --- a/app/code/Magento/Review/Test/Unit/Block/Customer/RecentTest.php +++ b/app/code/Magento/Review/Test/Unit/Block/Customer/RecentTest.php @@ -88,7 +88,7 @@ class RecentTest extends \PHPUnit_Framework_TestCase )->method( 'getStore' )->will( - $this->returnValue(new \Magento\Framework\Object(['id' => 42])) + $this->returnValue(new \Magento\Framework\DataObject(['id' => 42])) ); $this->currentCustomer->expects($this->any())->method('getCustomerId')->will($this->returnValue(4242)); diff --git a/app/code/Magento/Review/Test/Unit/Block/FormTest.php b/app/code/Magento/Review/Test/Unit/Block/FormTest.php index 32a59cf8334..03f004f470c 100644 --- a/app/code/Magento/Review/Test/Unit/Block/FormTest.php +++ b/app/code/Magento/Review/Test/Unit/Block/FormTest.php @@ -80,7 +80,7 @@ class FormTest extends \PHPUnit_Framework_TestCase )->method( 'getStore' )->will( - $this->returnValue(new \Magento\Framework\Object(['id' => $storeId])) + $this->returnValue(new \Magento\Framework\DataObject(['id' => $storeId])) ); $this->requestMock->expects($this->once()) diff --git a/app/code/Magento/Review/Test/Unit/Model/Resource/Review/Summary/CollectionTest.php b/app/code/Magento/Review/Test/Unit/Model/Resource/Review/Summary/CollectionTest.php index 32ee1c22708..c61bbf8de99 100644 --- a/app/code/Magento/Review/Test/Unit/Model/Resource/Review/Summary/CollectionTest.php +++ b/app/code/Magento/Review/Test/Unit/Model/Resource/Review/Summary/CollectionTest.php @@ -139,7 +139,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase ->with($this->selectMock, []) ->will($this->returnValue([$data])); - $objectMock = $this->getMock('Magento\Framework\Object', ['addData'], []); + $objectMock = $this->getMock('Magento\Framework\DataObject', ['addData'], []); $objectMock->expects($this->once()) ->method('addData') ->with($data); diff --git a/app/code/Magento/Review/Test/Unit/Model/ReviewTest.php b/app/code/Magento/Review/Test/Unit/Model/ReviewTest.php index 4be052abd03..3408ac83d7a 100644 --- a/app/code/Magento/Review/Test/Unit/Model/ReviewTest.php +++ b/app/code/Magento/Review/Test/Unit/Model/ReviewTest.php @@ -151,7 +151,7 @@ class ReviewTest extends \PHPUnit_Framework_TestCase $productId = 6; $storeId = 4; $testSummaryData = ['test' => 'value']; - $summary = new \Magento\Framework\Object(); + $summary = new \Magento\Framework\DataObject(); $summary->setData($testSummaryData); $product = $this->getMock( diff --git a/app/code/Magento/Rule/Model/AbstractModel.php b/app/code/Magento/Rule/Model/AbstractModel.php index 375c4180106..988a9e2beca 100644 --- a/app/code/Magento/Rule/Model/AbstractModel.php +++ b/app/code/Magento/Rule/Model/AbstractModel.php @@ -339,10 +339,10 @@ abstract class AbstractModel extends \Magento\Framework\Model\AbstractModel /** * Validate rule conditions to determine if rule can run * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return bool */ - public function validate(\Magento\Framework\Object $object) + public function validate(\Magento\Framework\DataObject $object) { return $this->getConditions()->validate($object); } @@ -350,12 +350,12 @@ abstract class AbstractModel extends \Magento\Framework\Model\AbstractModel /** * Validate rule data * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return bool|string[] - return true if validation passed successfully. Array with errors description otherwise * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - public function validateData(\Magento\Framework\Object $object) + public function validateData(\Magento\Framework\DataObject $object) { $result = []; $fromDate = $toDate = null; diff --git a/app/code/Magento/Rule/Model/Action/AbstractAction.php b/app/code/Magento/Rule/Model/Action/AbstractAction.php index 8e01621b733..b65eb1a4a9a 100644 --- a/app/code/Magento/Rule/Model/Action/AbstractAction.php +++ b/app/code/Magento/Rule/Model/Action/AbstractAction.php @@ -11,7 +11,7 @@ use Magento\Framework\Data\Form\Element\AbstractElement; /** * Quote rule action abstract */ -abstract class AbstractAction extends \Magento\Framework\Object implements ActionInterface +abstract class AbstractAction extends \Magento\Framework\DataObject implements ActionInterface { /** * @var \Magento\Framework\View\Asset\Repository diff --git a/app/code/Magento/Rule/Model/Condition/AbstractCondition.php b/app/code/Magento/Rule/Model/Condition/AbstractCondition.php index 62f3cc68904..d429ff09d46 100644 --- a/app/code/Magento/Rule/Model/Condition/AbstractCondition.php +++ b/app/code/Magento/Rule/Model/Condition/AbstractCondition.php @@ -18,7 +18,7 @@ use Magento\Framework\Data\Form\Element\AbstractElement; * @SuppressWarnings(PHPMD.ExcessivePublicCount) * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) */ -abstract class AbstractCondition extends \Magento\Framework\Object implements ConditionInterface +abstract class AbstractCondition extends \Magento\Framework\DataObject implements ConditionInterface { /** * Defines which operators will be available for this condition diff --git a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php index 8b2df7adff1..64c44081fec 100644 --- a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php +++ b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php @@ -139,7 +139,7 @@ abstract class AbstractProduct extends \Magento\Rule\Model\Condition\AbstractCon try { $obj = $this->_config->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $this->getAttribute()); } catch (\Exception $e) { - $obj = new \Magento\Framework\Object(); + $obj = new \Magento\Framework\DataObject(); $obj->setEntity($this->_productFactory->create())->setFrontendInput('text'); } return $obj; diff --git a/app/code/Magento/Rule/Test/Unit/Model/Condition/Product/AbstractProductTest.php b/app/code/Magento/Rule/Test/Unit/Model/Condition/Product/AbstractProductTest.php index 7c628927f6c..849aa5f0798 100644 --- a/app/code/Magento/Rule/Test/Unit/Model/Condition/Product/AbstractProductTest.php +++ b/app/code/Magento/Rule/Test/Unit/Model/Condition/Product/AbstractProductTest.php @@ -21,7 +21,7 @@ class AbstractProductTest extends \PHPUnit_Framework_TestCase /** * Framework object * - * @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject */ protected $_object; @@ -64,7 +64,7 @@ class AbstractProductTest extends \PHPUnit_Framework_TestCase { $product = $this->getMock('Magento\Framework\Model\AbstractModel', ["getAttribute"], [], '', false); $this->_condition->setAttribute('category_ids'); - $product->setAvailableInCategories(new \Magento\Framework\Object()); + $product->setAvailableInCategories(new \Magento\Framework\DataObject()); $this->assertFalse($this->_condition->validate($product)); } @@ -116,7 +116,7 @@ class AbstractProductTest extends \PHPUnit_Framework_TestCase ) ); - $attribute = new \Magento\Framework\Object(); + $attribute = new \Magento\Framework\DataObject(); $attribute->setBackendType('datetime'); $newResource = $this->getMock('\Magento\Catalog\Model\Resource\Product', ['getAttribute'], [], '', false); @@ -168,7 +168,7 @@ class AbstractProductTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\Eav\Model\Config', [], [], '', false) ); - $attribute = new \Magento\Framework\Object(); + $attribute = new \Magento\Framework\DataObject(); $attribute->setBackendType('datetime'); $newResource = $this->getMock('\Magento\Catalog\Model\Resource\Product', ['getAttribute'], [], '', false); @@ -228,7 +228,7 @@ class AbstractProductTest extends \PHPUnit_Framework_TestCase ) ); - $attribute = new \Magento\Framework\Object(); + $attribute = new \Magento\Framework\DataObject(); $attribute->setBackendType('multiselect'); $newResource = $this->getMock('\Magento\Catalog\Model\Resource\Product', ['getAttribute'], [], '', false); @@ -253,7 +253,7 @@ class AbstractProductTest extends \PHPUnit_Framework_TestCase $this->assertFalse($this->_condition->validate($product)); - $attribute = new \Magento\Framework\Object(); + $attribute = new \Magento\Framework\DataObject(); $attribute->setBackendType(null); $attribute->setFrontendInput('multiselect'); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Items/AbstractItems.php b/app/code/Magento/Sales/Block/Adminhtml/Items/AbstractItems.php index dc79dd5a7de..4308f223f14 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Items/AbstractItems.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Items/AbstractItems.php @@ -132,10 +132,10 @@ class AbstractItems extends \Magento\Backend\Block\Template /** * Retrieve rendered item html content * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return string */ - public function getItemHtml(\Magento\Framework\Object $item) + public function getItemHtml(\Magento\Framework\DataObject $item) { if ($item->getOrderItem()) { $type = $item->getOrderItem()->getProductType(); @@ -149,10 +149,10 @@ class AbstractItems extends \Magento\Backend\Block\Template /** * Retrieve rendered item extra info html content * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return string */ - public function getItemExtraInfoHtml(\Magento\Framework\Object $item) + public function getItemExtraInfoHtml(\Magento\Framework\DataObject $item) { $extraInfoBlock = $this->getChildBlock('order_item_extra_info'); if ($extraInfoBlock) { @@ -164,12 +164,12 @@ class AbstractItems extends \Magento\Backend\Block\Template /** * Retrieve rendered column html content * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @param string $column the column key * @param string $field the custom item field * @return string */ - public function getColumnHtml(\Magento\Framework\Object $item, $column, $field = null) + public function getColumnHtml(\Magento\Framework\DataObject $item, $column, $field = null) { if ($item->getOrderItem()) { $block = $this->getColumnRenderer($column, $item->getOrderItem()->getProductType()); @@ -316,10 +316,10 @@ class AbstractItems extends \Magento\Backend\Block\Template /** * Retrieve tax calculation html content * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return string */ - public function displayTaxCalculation(\Magento\Framework\Object $item) + public function displayTaxCalculation(\Magento\Framework\DataObject $item) { if ($item->getTaxPercent() && $item->getTaxString() == '') { $percents = [$item->getTaxPercent()]; @@ -338,10 +338,10 @@ class AbstractItems extends \Magento\Backend\Block\Template /** * Retrieve tax with percent html content * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return string */ - public function displayTaxPercent(\Magento\Framework\Object $item) + public function displayTaxPercent(\Magento\Framework\DataObject $item) { if ($item->getTaxPercent()) { return sprintf('%s%%', $item->getTaxPercent() + 0); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/AbstractOrder.php b/app/code/Magento/Sales/Block/Adminhtml/Order/AbstractOrder.php index 0539d5cb195..fc415efbd0c 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/AbstractOrder.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/AbstractOrder.php @@ -135,7 +135,7 @@ class AbstractOrder extends \Magento\Backend\Block\Widget /** * Retrieve subtotal price include tax html formated content * - * @param \Magento\Framework\Object $order + * @param \Magento\Framework\DataObject $order * @return string */ public function displayShippingPriceInclTax($order) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage.php index 52cc36384d6..6646876eedb 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage.php @@ -54,11 +54,11 @@ class Giftmessage extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCr /** * Generate form for editing of gift message for entity * - * @param \Magento\Framework\Object $entity + * @param \Magento\Framework\DataObject $entity * @param string $entityType * @return string */ - public function getFormHtml(\Magento\Framework\Object $entity, $entityType = 'quote') + public function getFormHtml(\Magento\Framework\DataObject $entity, $entityType = 'quote') { return $this->getLayout()->createBlock( 'Magento\Sales\Block\Adminhtml\Order\Create\Giftmessage\Form' diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/Form.php index d573a445ad1..f0b4ca8a248 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/Form.php @@ -88,10 +88,10 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * Set entity for form * - * @param \Magento\Framework\Object $entity + * @param \Magento\Framework\DataObject $entity * @return $this */ - public function setEntity(\Magento\Framework\Object $entity) + public function setEntity(\Magento\Framework\DataObject $entity) { $this->_entity = $entity; return $this; @@ -100,7 +100,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * Retrieve entity for form * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getEntity() { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Price.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Price.php index 0349b5c625d..dcaed2b0524 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Price.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Price.php @@ -15,10 +15,10 @@ class Price extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Price /** * Render minimal price for downloadable products * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { if ($row->getTypeId() == 'downloadable') { $row->setPrice($row->getPrice()); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Product.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Product.php index b84a5c05e61..100f0d162d4 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Product.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Product.php @@ -15,10 +15,10 @@ class Product extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Text /** * Render product name to add Configure link * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $rendered = parent::render($row); $isConfigurable = $row->canConfigure(); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Qty.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Qty.php index 3b1bdcb40ea..f6051d01ea0 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Qty.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Qty.php @@ -36,7 +36,7 @@ class Qty extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Input /** * Returns whether this qty field must be inactive * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return bool */ protected function _isInactive($row) @@ -47,10 +47,10 @@ class Qty extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Input /** * Render product qty field * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { // Prepare values $disabled = ''; diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar.php index cb0ea9ae012..ffe19f2be80 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar.php @@ -45,7 +45,7 @@ class Sidebar extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate /** * Check if can display * - * @param \Magento\Framework\Object $child + * @param \Magento\Framework\DataObject $child * @return true */ public function canDisplay($child) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/AbstractSidebar.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/AbstractSidebar.php index ffc2acec94c..317a04d0263 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/AbstractSidebar.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/AbstractSidebar.php @@ -91,7 +91,7 @@ class AbstractSidebar extends \Magento\Sales\Block\Adminhtml\Order\Create\Abstra /** * Retrieve identifier of block item * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return int */ public function getIdentifierId($item) @@ -102,7 +102,7 @@ class AbstractSidebar extends \Magento\Sales\Block\Adminhtml\Order\Create\Abstra /** * Retrieve item identifier of block item * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return int */ public function getItemId($item) @@ -113,7 +113,7 @@ class AbstractSidebar extends \Magento\Sales\Block\Adminhtml\Order\Create\Abstra /** * Retrieve product identifier linked with item * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return int */ public function getProductId($item) @@ -167,7 +167,7 @@ class AbstractSidebar extends \Magento\Sales\Block\Adminhtml\Order\Create\Abstra } else { $type = ''; // Maybe some item, that can give us product via getProduct() - if ($item instanceof \Magento\Framework\Object || method_exists($item, 'getProduct')) { + if ($item instanceof \Magento\Framework\DataObject || method_exists($item, 'getProduct')) { $product = $item->getProduct(); if ($product && $product instanceof \Magento\Catalog\Model\Product) { $type = $product->getTypeId(); @@ -206,10 +206,10 @@ class AbstractSidebar extends \Magento\Sales\Block\Adminhtml\Order\Create\Abstra /** * Get item qty * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return int */ - public function getItemQty(\Magento\Framework\Object $item) + public function getItemQty(\Magento\Framework\DataObject $item) { return $item->getQty() * 1 ? $item->getQty() * 1 : 1; } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Cart.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Cart.php index acf985d354e..7ed4d9c67da 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Cart.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Cart.php @@ -69,7 +69,7 @@ class Cart extends \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\AbstractS /** * Retrieve identifier of block item * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return int */ public function getIdentifierId($item) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Compared.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Compared.php index 72952928003..d519bf8a84c 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Compared.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Compared.php @@ -70,7 +70,7 @@ class Compared extends \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Abstr /** * Get item id * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return int */ public function getItemId($item) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Pcompared.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Pcompared.php index 5291f8a46ba..1019c33a5db 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Pcompared.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Pcompared.php @@ -149,7 +149,7 @@ class Pcompared extends \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Abst /** * Retrieve product identifier of block item * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return int */ public function getProductId($item) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Pviewed.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Pviewed.php index e4900992832..0df683b1ef8 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Pviewed.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Pviewed.php @@ -136,7 +136,7 @@ class Pviewed extends \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Abstra /** * Retrieve identifier of block item * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return int */ public function getIdentifierId($item) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Reorder.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Reorder.php index b58e7e482c5..8a4abcee1c3 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Reorder.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Reorder.php @@ -151,7 +151,7 @@ class Reorder extends \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Abstra /** * Retrieve identifier of block item * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return int */ public function getIdentifierId($item) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Wishlist.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Wishlist.php index f2a3f7653d1..7b4962c4961 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Wishlist.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Wishlist.php @@ -90,7 +90,7 @@ class Wishlist extends \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Abstr /** * Retrieve identifier of block item * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return int */ public function getIdentifierId($item) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals.php index 7b64f69fa4c..cf5d44bb245 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals.php @@ -136,7 +136,7 @@ class Totals extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate /** * Render total * - * @param \Magento\Framework\Object $total + * @param \Magento\Framework\DataObject $total * @param string|null $area * @param int $colspan * @return mixed diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create/Adjustments.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create/Adjustments.php index 9a55566d840..ad76d6d8ccd 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create/Adjustments.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create/Adjustments.php @@ -12,7 +12,7 @@ class Adjustments extends \Magento\Backend\Block\Template /** * Source object * - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $_source; @@ -54,7 +54,7 @@ class Adjustments extends \Magento\Backend\Block\Template { $parent = $this->getParentBlock(); $this->_source = $parent->getSource(); - $total = new \Magento\Framework\Object(['code' => 'agjustments', 'block_name' => $this->getNameInLayout()]); + $total = new \Magento\Framework\DataObject(['code' => 'agjustments', 'block_name' => $this->getNameInLayout()]); $parent->removeTotal('shipping'); $parent->removeTotal('adjustment_positive'); $parent->removeTotal('adjustment_negative'); @@ -65,7 +65,7 @@ class Adjustments extends \Magento\Backend\Block\Template /** * Get source object * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getSource() { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Totals.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Totals.php index 8be16a26a1c..1b07170aadf 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Totals.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Totals.php @@ -59,7 +59,7 @@ class Totals extends \Magento\Sales\Block\Adminhtml\Totals { parent::_initTotals(); $this->addTotal( - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'code' => 'adjustment_positive', 'value' => $this->getSource()->getAdjustmentPositive(), @@ -69,7 +69,7 @@ class Totals extends \Magento\Sales\Block\Adminhtml\Totals ) ); $this->addTotal( - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'code' => 'adjustment_negative', 'value' => $this->getSource()->getAdjustmentNegative(), diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Totals.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Totals.php index 48197939dd9..474363029e3 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Totals.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Totals.php @@ -20,7 +20,7 @@ class Totals extends \Magento\Sales\Block\Adminhtml\Totals//\Magento\Sales\Block protected function _initTotals() { parent::_initTotals(); - $this->_totals['paid'] = new \Magento\Framework\Object( + $this->_totals['paid'] = new \Magento\Framework\DataObject( [ 'code' => 'paid', 'strong' => true, @@ -30,7 +30,7 @@ class Totals extends \Magento\Sales\Block\Adminhtml\Totals//\Magento\Sales\Block 'area' => 'footer', ] ); - $this->_totals['refunded'] = new \Magento\Framework\Object( + $this->_totals['refunded'] = new \Magento\Framework\DataObject( [ 'code' => 'refunded', 'strong' => true, @@ -40,7 +40,7 @@ class Totals extends \Magento\Sales\Block\Adminhtml\Totals//\Magento\Sales\Block 'area' => 'footer', ] ); - $this->_totals['due'] = new \Magento\Framework\Object( + $this->_totals['due'] = new \Magento\Framework\DataObject( [ 'code' => 'due', 'strong' => true, diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Item.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Item.php index 38694ce0cbe..996628c60ad 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Item.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Item.php @@ -33,7 +33,7 @@ class Item extends \Magento\Sales\Block\Adminhtml\Order\Totals */ public function initTotals() { - $total = new \Magento\Framework\Object( + $total = new \Magento\Framework\DataObject( [ 'code' => $this->getNameInLayout(), 'block_name' => $this->getNameInLayout(), diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Giftmessage.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Giftmessage.php index 2f70036c540..3f57fa3fc62 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Giftmessage.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Giftmessage.php @@ -125,10 +125,10 @@ class Giftmessage extends \Magento\Backend\Block\Widget /** * Set entity for form * - * @param \Magento\Framework\Object $entity + * @param \Magento\Framework\DataObject $entity * @return $this */ - public function setEntity(\Magento\Framework\Object $entity) + public function setEntity(\Magento\Framework\DataObject $entity) { $this->_entity = $entity; return $this; @@ -137,7 +137,7 @@ class Giftmessage extends \Magento\Backend\Block\Widget /** * Retrieve entity for form * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getEntity() { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Items/Renderer/DefaultRenderer.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Items/Renderer/DefaultRenderer.php index 92cc81fa6f2..30f059d0dbf 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Items/Renderer/DefaultRenderer.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Items/Renderer/DefaultRenderer.php @@ -244,10 +244,10 @@ class DefaultRenderer extends \Magento\Sales\Block\Adminhtml\Items\Renderer\Defa /** * Display item price including tax * - * @param Item|\Magento\Framework\Object $item + * @param Item|\Magento\Framework\DataObject $item * @return string */ - public function displayPriceInclTax(\Magento\Framework\Object $item) + public function displayPriceInclTax(\Magento\Framework\DataObject $item) { return $this->displayPrices( $this->_checkoutHelper->getBasePriceInclTax($item), diff --git a/app/code/Magento/Sales/Block/Adminhtml/Reorder/Renderer/Action.php b/app/code/Magento/Sales/Block/Adminhtml/Reorder/Renderer/Action.php index 0e664f92884..31827e5595f 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Reorder/Renderer/Action.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Reorder/Renderer/Action.php @@ -41,10 +41,10 @@ class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstract } /** - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $this->_actions = []; if ($this->_salesReorder->canReorder($row)) { @@ -83,7 +83,7 @@ class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstract protected function _actionsToHtml(array $actions = []) { $html = []; - $attributesObject = new \Magento\Framework\Object(); + $attributesObject = new \Magento\Framework\DataObject(); if (empty($actions)) { $actions = $this->_actions; diff --git a/app/code/Magento/Sales/Block/Adminhtml/System/Config/Form/Fieldset/Order/Statuses.php b/app/code/Magento/Sales/Block/Adminhtml/System/Config/Form/Fieldset/Order/Statuses.php index a0b23d801f9..8c3cf77a79c 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/System/Config/Form/Fieldset/Order/Statuses.php +++ b/app/code/Magento/Sales/Block/Adminhtml/System/Config/Form/Fieldset/Order/Statuses.php @@ -10,7 +10,7 @@ class Statuses extends \Magento\Config\Block\System\Config\Form\Fieldset /** * Dummy element * - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $_dummyElement; @@ -72,12 +72,12 @@ class Statuses extends \Magento\Config\Block\System\Config\Form\Fieldset /** * Get dummy element * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function _getDummyElement() { if (empty($this->_dummyElement)) { - $this->_dummyElement = new \Magento\Framework\Object(['showInDefault' => 1, 'showInWebsite' => 1]); + $this->_dummyElement = new \Magento\Framework\DataObject(['showInDefault' => 1, 'showInWebsite' => 1]); } return $this->_dummyElement; } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Totals.php b/app/code/Magento/Sales/Block/Adminhtml/Totals.php index e297f383989..b61e2092c20 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Totals.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Totals.php @@ -33,7 +33,7 @@ class Totals extends \Magento\Sales\Block\Order\Totals /** * Format total value based on order currency * - * @param \Magento\Framework\Object $total + * @param \Magento\Framework\DataObject $total * @return string */ public function formatValue($total) @@ -52,7 +52,7 @@ class Totals extends \Magento\Sales\Block\Order\Totals protected function _initTotals() { $this->_totals = []; - $this->_totals['subtotal'] = new \Magento\Framework\Object( + $this->_totals['subtotal'] = new \Magento\Framework\DataObject( [ 'code' => 'subtotal', 'value' => $this->getSource()->getSubtotal(), @@ -67,7 +67,7 @@ class Totals extends \Magento\Sales\Block\Order\Totals if (!$this->getSource()->getIsVirtual() && ((double)$this->getSource()->getShippingAmount() || $this->getSource()->getShippingDescription()) ) { - $this->_totals['shipping'] = new \Magento\Framework\Object( + $this->_totals['shipping'] = new \Magento\Framework\DataObject( [ 'code' => 'shipping', 'value' => $this->getSource()->getShippingAmount(), @@ -86,7 +86,7 @@ class Totals extends \Magento\Sales\Block\Order\Totals } else { $discountLabel = __('Discount'); } - $this->_totals['discount'] = new \Magento\Framework\Object( + $this->_totals['discount'] = new \Magento\Framework\DataObject( [ 'code' => 'discount', 'value' => $this->getSource()->getDiscountAmount(), @@ -96,7 +96,7 @@ class Totals extends \Magento\Sales\Block\Order\Totals ); } - $this->_totals['grand_total'] = new \Magento\Framework\Object( + $this->_totals['grand_total'] = new \Magento\Framework\DataObject( [ 'code' => 'grand_total', 'strong' => true, diff --git a/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail/Grid.php b/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail/Grid.php index 6012d8c77a4..03a20c3d74b 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail/Grid.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail/Grid.php @@ -66,7 +66,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { $collection = $this->_collectionFactory->create(); foreach ($this->getTransactionAdditionalInfo() as $key => $value) { - $data = new \Magento\Framework\Object(['key' => $key, 'value' => $value]); + $data = new \Magento\Framework\DataObject(['key' => $key, 'value' => $value]); $collection->addItem($data); } diff --git a/app/code/Magento/Sales/Block/Items/AbstractItems.php b/app/code/Magento/Sales/Block/Items/AbstractItems.php index 728b46470af..65fe4b01cac 100644 --- a/app/code/Magento/Sales/Block/Items/AbstractItems.php +++ b/app/code/Magento/Sales/Block/Items/AbstractItems.php @@ -59,10 +59,10 @@ class AbstractItems extends \Magento\Framework\View\Element\Template /** * Return product type for quote/order item * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return string */ - protected function _getItemType(\Magento\Framework\Object $item) + protected function _getItemType(\Magento\Framework\DataObject $item) { if ($item->getOrderItem()) { $type = $item->getOrderItem()->getProductType(); @@ -77,10 +77,10 @@ class AbstractItems extends \Magento\Framework\View\Element\Template /** * Get item row html * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return string */ - public function getItemHtml(\Magento\Framework\Object $item) + public function getItemHtml(\Magento\Framework\DataObject $item) { $type = $this->_getItemType($item); diff --git a/app/code/Magento/Sales/Block/Order/Creditmemo/Totals.php b/app/code/Magento/Sales/Block/Order/Creditmemo/Totals.php index a03ca172c5f..223bad0ef1d 100644 --- a/app/code/Magento/Sales/Block/Order/Creditmemo/Totals.php +++ b/app/code/Magento/Sales/Block/Order/Creditmemo/Totals.php @@ -78,7 +78,7 @@ class Totals extends \Magento\Sales\Block\Order\Totals parent::_initTotals(); $this->removeTotal('base_grandtotal'); if ((double)$this->getSource()->getAdjustmentPositive()) { - $total = new \Magento\Framework\Object( + $total = new \Magento\Framework\DataObject( [ 'code' => 'adjustment_positive', 'value' => $this->getSource()->getAdjustmentPositive(), @@ -88,7 +88,7 @@ class Totals extends \Magento\Sales\Block\Order\Totals $this->addTotal($total); } if ((double)$this->getSource()->getAdjustmentNegative()) { - $total = new \Magento\Framework\Object( + $total = new \Magento\Framework\DataObject( [ 'code' => 'adjustment_negative', 'value' => $this->getSource()->getAdjustmentNegative(), diff --git a/app/code/Magento/Sales/Block/Order/Item/Renderer/DefaultRenderer.php b/app/code/Magento/Sales/Block/Order/Item/Renderer/DefaultRenderer.php index d71bfe9ecd4..0fd2125c05e 100644 --- a/app/code/Magento/Sales/Block/Order/Item/Renderer/DefaultRenderer.php +++ b/app/code/Magento/Sales/Block/Order/Item/Renderer/DefaultRenderer.php @@ -20,7 +20,7 @@ class DefaultRenderer extends \Magento\Framework\View\Element\Template /** * Magento string lib * - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -31,13 +31,13 @@ class DefaultRenderer extends \Magento\Framework\View\Element\Template /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, array $data = [] ) { @@ -47,10 +47,10 @@ class DefaultRenderer extends \Magento\Framework\View\Element\Template } /** - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return $this */ - public function setItem(\Magento\Framework\Object $item) + public function setItem(\Magento\Framework\DataObject $item) { $this->setData('item', $item); return $this; diff --git a/app/code/Magento/Sales/Block/Order/Totals.php b/app/code/Magento/Sales/Block/Order/Totals.php index a173a51146d..30410a407bf 100644 --- a/app/code/Magento/Sales/Block/Order/Totals.php +++ b/app/code/Magento/Sales/Block/Order/Totals.php @@ -110,7 +110,7 @@ class Totals extends \Magento\Framework\View\Element\Template $source = $this->getSource(); $this->_totals = []; - $this->_totals['subtotal'] = new \Magento\Framework\Object( + $this->_totals['subtotal'] = new \Magento\Framework\DataObject( ['code' => 'subtotal', 'value' => $source->getSubtotal(), 'label' => __('Subtotal')] ); @@ -118,7 +118,7 @@ class Totals extends \Magento\Framework\View\Element\Template * Add shipping */ if (!$source->getIsVirtual() && ((double)$source->getShippingAmount() || $source->getShippingDescription())) { - $this->_totals['shipping'] = new \Magento\Framework\Object( + $this->_totals['shipping'] = new \Magento\Framework\DataObject( [ 'code' => 'shipping', 'field' => 'shipping_amount', @@ -137,7 +137,7 @@ class Totals extends \Magento\Framework\View\Element\Template } else { $discountLabel = __('Discount'); } - $this->_totals['discount'] = new \Magento\Framework\Object( + $this->_totals['discount'] = new \Magento\Framework\DataObject( [ 'code' => 'discount', 'field' => 'discount_amount', @@ -147,7 +147,7 @@ class Totals extends \Magento\Framework\View\Element\Template ); } - $this->_totals['grand_total'] = new \Magento\Framework\Object( + $this->_totals['grand_total'] = new \Magento\Framework\DataObject( [ 'code' => 'grand_total', 'field' => 'grand_total', @@ -161,7 +161,7 @@ class Totals extends \Magento\Framework\View\Element\Template * Base grandtotal */ if ($this->getOrder()->isCurrencyDifferent()) { - $this->_totals['base_grandtotal'] = new \Magento\Framework\Object( + $this->_totals['base_grandtotal'] = new \Magento\Framework\DataObject( [ 'code' => 'base_grandtotal', 'value' => $this->getOrder()->formatBasePrice($source->getBaseGrandTotal()), @@ -176,11 +176,11 @@ class Totals extends \Magento\Framework\View\Element\Template /** * Add new total to totals array after specific total or before last total by default * - * @param \Magento\Framework\Object $total + * @param \Magento\Framework\DataObject $total * @param null|string $after * @return $this */ - public function addTotal(\Magento\Framework\Object $total, $after = null) + public function addTotal(\Magento\Framework\DataObject $total, $after = null) { if ($after !== null && $after != 'last' && $after != 'first') { $totals = []; @@ -214,11 +214,11 @@ class Totals extends \Magento\Framework\View\Element\Template /** * Add new total to totals array before specific total or after first total by default * - * @param \Magento\Framework\Object $total + * @param \Magento\Framework\DataObject $total * @param null|string $before * @return $this */ - public function addTotalBefore(\Magento\Framework\Object $total, $before = null) + public function addTotalBefore(\Magento\Framework\DataObject $total, $before = null) { if ($before !== null) { if (!is_array($before)) { @@ -318,7 +318,7 @@ class Totals extends \Magento\Framework\View\Element\Template /** * Format total value based on order currency * - * @param \Magento\Framework\Object $total + * @param \Magento\Framework\DataObject $total * @return string */ public function formatValue($total) diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php index 53c999b0f05..206d3e4f50c 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php @@ -346,7 +346,7 @@ abstract class Create extends \Magento\Backend\App\Action /* @var $productHelper \Magento\Catalog\Helper\Product */ $productHelper = $this->_objectManager->get('Magento\Catalog\Helper\Product'); foreach ($items as $id => $item) { - $buyRequest = new \Magento\Framework\Object($item); + $buyRequest = new \Magento\Framework\DataObject($item); $params = ['files_prefix' => 'item_' . $id . '_']; $buyRequest = $productHelper->addParamsToBuyRequest($buyRequest, $params); if ($buyRequest->hasData()) { diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/AddConfigured.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/AddConfigured.php index c227e3e29e5..b991a11b287 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/AddConfigured.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/AddConfigured.php @@ -23,7 +23,7 @@ class AddConfigured extends \Magento\Sales\Controller\Adminhtml\Order\Create } // Form result for client javascript - $updateResult = new \Magento\Framework\Object(); + $updateResult = new \Magento\Framework\DataObject(); if ($errorMessage) { $updateResult->setError(true); $updateResult->setMessage($errorMessage); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/ConfigureProductToAdd.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/ConfigureProductToAdd.php index 3724dfc4c44..d8c70e6d63b 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/ConfigureProductToAdd.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/ConfigureProductToAdd.php @@ -17,7 +17,7 @@ class ConfigureProductToAdd extends \Magento\Sales\Controller\Adminhtml\Order\Cr // Prepare data $productId = (int)$this->getRequest()->getParam('id'); - $configureResult = new \Magento\Framework\Object(); + $configureResult = new \Magento\Framework\DataObject(); $configureResult->setOk(true); $configureResult->setProductId($productId); $sessionQuote = $this->_objectManager->get('Magento\Backend\Model\Session\Quote'); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/ConfigureQuoteItems.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/ConfigureQuoteItems.php index b7829048009..080d5103c08 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/ConfigureQuoteItems.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/ConfigureQuoteItems.php @@ -15,7 +15,7 @@ class ConfigureQuoteItems extends \Magento\Sales\Controller\Adminhtml\Order\Crea public function execute() { // Prepare data - $configureResult = new \Magento\Framework\Object(); + $configureResult = new \Magento\Framework\DataObject(); try { $quoteItemId = (int)$this->getRequest()->getParam('id'); if (!$quoteItemId) { diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/CreditmemoLoader.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/CreditmemoLoader.php index c40b1b99506..ae21770d475 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/CreditmemoLoader.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/CreditmemoLoader.php @@ -6,7 +6,7 @@ */ namespace Magento\Sales\Controller\Adminhtml\Order; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Class CreditmemoLoader @@ -21,7 +21,7 @@ use Magento\Framework\Object; * @method int getInvoiceId * @method int getOrderId */ -class CreditmemoLoader extends Object +class CreditmemoLoader extends DataObject { /** * @var \Magento\Sales\Model\Order\CreditmemoFactory diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/VoidPayment.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/VoidPayment.php index f3c2f2cee9d..03b870d71ca 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/VoidPayment.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/VoidPayment.php @@ -18,7 +18,8 @@ class VoidPayment extends \Magento\Sales\Controller\Adminhtml\Order $resultRedirect = $this->resultRedirectFactory->create(); if ($order) { try { - $order->getPayment()->void(new \Magento\Framework\Object()); // workaround for backwards compatibility + // workaround for backwards compatibility + $order->getPayment()->void(new \Magento\Framework\DataObject()); $order->save(); $this->messageManager->addSuccess(__('The payment has been voided.')); } catch (\Magento\Framework\Exception\LocalizedException $e) { diff --git a/app/code/Magento/Sales/Helper/Admin.php b/app/code/Magento/Sales/Helper/Admin.php index 2ee1bf06561..3379ee82a31 100644 --- a/app/code/Magento/Sales/Helper/Admin.php +++ b/app/code/Magento/Sales/Helper/Admin.php @@ -51,7 +51,7 @@ class Admin extends \Magento\Framework\App\Helper\AbstractHelper /** * Display price attribute value in base order currency and in place order currency * - * @param \Magento\Framework\Object $dataObject + * @param \Magento\Framework\DataObject $dataObject * @param string $code * @param bool $strong * @param string $separator @@ -75,7 +75,7 @@ class Admin extends \Magento\Framework\App\Helper\AbstractHelper /** * Get "double" prices html (block with base and place currency) * - * @param \Magento\Framework\Object $dataObject + * @param \Magento\Framework\DataObject $dataObject * @param float $basePrice * @param float $price * @param bool $strong diff --git a/app/code/Magento/Sales/Model/AdminOrder/Create.php b/app/code/Magento/Sales/Model/AdminOrder/Create.php index ff8126c3342..e10d73f241f 100644 --- a/app/code/Magento/Sales/Model/AdminOrder/Create.php +++ b/app/code/Magento/Sales/Model/AdminOrder/Create.php @@ -18,7 +18,7 @@ use Magento\Quote\Model\Quote\Item; * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Create extends \Magento\Framework\Object implements \Magento\Checkout\Model\Cart\CartInterface +class Create extends \Magento\Framework\DataObject implements \Magento\Checkout\Model\Cart\CartInterface { /** * Xml default email domain path @@ -118,7 +118,7 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode protected $_objectManager; /** - * @var \Magento\Framework\Object\Copy + * @var \Magento\Framework\DataObject\Copy */ protected $_objectCopyService; @@ -178,7 +178,7 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode protected $quoteItemUpdater; /** - * @var \Magento\Framework\Object\Factory + * @var \Magento\Framework\DataObject\Factory */ protected $objectFactory; @@ -221,7 +221,7 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode * @param \Magento\Sales\Model\Config $salesConfig * @param \Magento\Backend\Model\Session\Quote $quoteSession * @param \Psr\Log\LoggerInterface $logger - * @param \Magento\Framework\Object\Copy $objectCopyService + * @param \Magento\Framework\DataObject\Copy $objectCopyService * @param \Magento\Framework\Message\ManagerInterface $messageManager * @param Product\Quote\Initializer $quoteInitializer * @param \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository @@ -233,7 +233,7 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode * @param EmailSender $emailSender * @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry * @param Item\Updater $quoteItemUpdater - * @param \Magento\Framework\Object\Factory $objectFactory + * @param \Magento\Framework\DataObject\Factory $objectFactory * @param \Magento\Quote\Model\QuoteRepository $quoteRepository * @param \Magento\Customer\Api\AccountManagementInterface $accountManagement * @param \Magento\Customer\Api\Data\CustomerInterfaceFactory $customerFactory @@ -250,7 +250,7 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode \Magento\Sales\Model\Config $salesConfig, \Magento\Backend\Model\Session\Quote $quoteSession, \Psr\Log\LoggerInterface $logger, - \Magento\Framework\Object\Copy $objectCopyService, + \Magento\Framework\DataObject\Copy $objectCopyService, \Magento\Framework\Message\ManagerInterface $messageManager, Product\Quote\Initializer $quoteInitializer, \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository, @@ -262,7 +262,7 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode \Magento\Sales\Model\AdminOrder\EmailSender $emailSender, \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry, \Magento\Quote\Model\Quote\Item\Updater $quoteItemUpdater, - \Magento\Framework\Object\Factory $objectFactory, + \Magento\Framework\DataObject\Factory $objectFactory, \Magento\Quote\Model\QuoteRepository $quoteRepository, \Magento\Customer\Api\AccountManagementInterface $accountManagement, \Magento\Customer\Api\Data\CustomerInterfaceFactory $customerFactory, @@ -348,7 +348,7 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode { $this->_coreRegistry->register( 'rule_data', - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'store_id' => $this->_session->getStore()->getId(), 'website_id' => $this->_session->getStore()->getWebsiteId(), @@ -614,7 +614,7 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode if ($additionalOptions = $orderItem->getProductOptionByCode('additional_options')) { $item->addOption( - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'product' => $item->getProduct(), 'code' => 'additional_options', @@ -779,11 +779,11 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode $info = $item->getOptionByCode('info_buyRequest'); if ($info) { - $info = new \Magento\Framework\Object(unserialize($info->getValue())); + $info = new \Magento\Framework\DataObject(unserialize($info->getValue())); $info->setQty($qty); $info->setOptions($this->_prepareOptionsForRequest($item)); } else { - $info = new \Magento\Framework\Object( + $info = new \Magento\Framework\DataObject( [ 'product_id' => $product->getId(), 'qty' => $qty, @@ -974,16 +974,16 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode * $config can be either buyRequest config, or just qty * * @param int|\Magento\Catalog\Model\Product $product - * @param array|float|int|\Magento\Framework\Object $config + * @param array|float|int|\Magento\Framework\DataObject $config * @return $this * @throws \Magento\Framework\Exception\LocalizedException */ public function addProduct($product, $config = 1) { - if (!is_array($config) && !$config instanceof \Magento\Framework\Object) { + if (!is_array($config) && !$config instanceof \Magento\Framework\DataObject) { $config = ['qty' => $config]; } - $config = new \Magento\Framework\Object($config); + $config = new \Magento\Framework\DataObject($config); if (!$product instanceof \Magento\Catalog\Model\Product) { $productId = $product; @@ -1164,7 +1164,7 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode $item->save(); if (!empty($options['options'])) { $item->addOption( - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'product' => $item->getProduct(), 'code' => 'option_ids', @@ -1175,7 +1175,7 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode foreach ($options['options'] as $optionId => $optionValue) { $item->addOption( - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'product' => $item->getProduct(), 'code' => 'option_' . $optionId, @@ -1187,7 +1187,7 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode } if (!empty($options['additional_options'])) { $item->addOption( - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'product' => $item->getProduct(), 'code' => 'additional_options', diff --git a/app/code/Magento/Sales/Model/AdminOrder/Product/Quote/Initializer.php b/app/code/Magento/Sales/Model/AdminOrder/Product/Quote/Initializer.php index 565084d85ac..97b17006280 100644 --- a/app/code/Magento/Sales/Model/AdminOrder/Product/Quote/Initializer.php +++ b/app/code/Magento/Sales/Model/AdminOrder/Product/Quote/Initializer.php @@ -31,13 +31,13 @@ class Initializer /** * @param \Magento\Quote\Model\Quote $quote * @param \Magento\Catalog\Model\Product $product - * @param \Magento\Framework\Object $config + * @param \Magento\Framework\DataObject $config * @return \Magento\Quote\Model\Quote\Item|string */ public function init( \Magento\Quote\Model\Quote $quote, \Magento\Catalog\Model\Product $product, - \Magento\Framework\Object $config + \Magento\Framework\DataObject $config ) { $stockItem = $this->stockRegistry->getStockItem($product->getId(), $quote->getStore()->getWebsiteId()); if ($stockItem->getIsQtyDecimal()) { diff --git a/app/code/Magento/Sales/Model/Convert/Order.php b/app/code/Magento/Sales/Model/Convert/Order.php index 7ac320f8038..6e386b4c681 100644 --- a/app/code/Magento/Sales/Model/Convert/Order.php +++ b/app/code/Magento/Sales/Model/Convert/Order.php @@ -12,7 +12,7 @@ namespace Magento\Sales\Model\Convert; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Order extends \Magento\Framework\Object +class Order extends \Magento\Framework\DataObject { /** * Core event manager proxy @@ -47,7 +47,7 @@ class Order extends \Magento\Framework\Object protected $_creditmemoItemFactory; /** - * @var \Magento\Framework\Object\Copy + * @var \Magento\Framework\DataObject\Copy */ protected $_objectCopyService; @@ -59,7 +59,7 @@ class Order extends \Magento\Framework\Object * @param \Magento\Sales\Model\Order\Shipment\ItemFactory $shipmentItemFactory * @param \Magento\Sales\Model\Order\CreditmemoFactory $creditmemoFactory * @param \Magento\Sales\Model\Order\Creditmemo\ItemFactory $creditmemoItemFactory - * @param \Magento\Framework\Object\Copy $objectCopyService + * @param \Magento\Framework\DataObject\Copy $objectCopyService * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -72,7 +72,7 @@ class Order extends \Magento\Framework\Object \Magento\Sales\Model\Order\Shipment\ItemFactory $shipmentItemFactory, \Magento\Sales\Model\Order\CreditmemoFactory $creditmemoFactory, \Magento\Sales\Model\Order\Creditmemo\ItemFactory $creditmemoItemFactory, - \Magento\Framework\Object\Copy $objectCopyService, + \Magento\Framework\DataObject\Copy $objectCopyService, array $data = [] ) { $this->_eventManager = $eventManager; diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index ae28f57ab2f..f1faf18a39f 100755 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -1145,7 +1145,7 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface * Retrieve shipping method * * @param bool $asObject return carrier code and shipping method data as object - * @return string|\Magento\Framework\Object + * @return string|\Magento\Framework\DataObject */ public function getShippingMethod($asObject = false) { @@ -1154,7 +1154,7 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface return $shippingMethod; } else { list($carrierCode, $method) = explode('_', $shippingMethod, 2); - return new \Magento\Framework\Object(['carrier_code' => $carrierCode, 'method' => $method]); + return new \Magento\Framework\DataObject(['carrier_code' => $carrierCode, 'method' => $method]); } } @@ -1304,7 +1304,7 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface /** * @param mixed $itemId - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getItemById($itemId) { @@ -1313,7 +1313,7 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface /** * @param mixed $quoteItemId - * @return \Magento\Framework\Object|null + * @return \Magento\Framework\DataObject|null */ public function getItemByQuoteItemId($quoteItemId) { diff --git a/app/code/Magento/Sales/Model/Order/Address.php b/app/code/Magento/Sales/Model/Order/Address.php index 2ffcb048799..d3980760900 100644 --- a/app/code/Magento/Sales/Model/Order/Address.php +++ b/app/code/Magento/Sales/Model/Order/Address.php @@ -176,7 +176,7 @@ class Address extends AbstractModel implements OrderAddressInterface, AddressMod * * @param array|string $key * @param null $value - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function setData($key, $value = null) { diff --git a/app/code/Magento/Sales/Model/Order/Customer/Management.php b/app/code/Magento/Sales/Model/Order/Customer/Management.php index 2fd0890b7fd..8944df974d2 100644 --- a/app/code/Magento/Sales/Model/Order/Customer/Management.php +++ b/app/code/Magento/Sales/Model/Order/Customer/Management.php @@ -35,12 +35,12 @@ class Management implements \Magento\Sales\Api\OrderCustomerManagementInterface protected $orderRepository; /** - * @var \Magento\Framework\Object\Copy + * @var \Magento\Framework\DataObject\Copy */ protected $objectCopyService; /** - * @param \Magento\Framework\Object\Copy $objectCopyService + * @param \Magento\Framework\DataObject\Copy $objectCopyService * @param \Magento\Customer\Api\AccountManagementInterface $accountManagement * @param \Magento\Customer\Api\Data\CustomerInterfaceFactory $customerFactory * @param \Magento\Customer\Api\Data\AddressInterfaceFactory $addressFactory @@ -48,7 +48,7 @@ class Management implements \Magento\Sales\Api\OrderCustomerManagementInterface * @param \Magento\Sales\Api\OrderRepositoryInterface $orderRepository */ public function __construct( - \Magento\Framework\Object\Copy $objectCopyService, + \Magento\Framework\DataObject\Copy $objectCopyService, \Magento\Customer\Api\AccountManagementInterface $accountManagement, \Magento\Customer\Api\Data\CustomerInterfaceFactory $customerFactory, \Magento\Customer\Api\Data\AddressInterfaceFactory $addressFactory, diff --git a/app/code/Magento/Sales/Model/Order/Grid/Row/UrlGenerator.php b/app/code/Magento/Sales/Model/Order/Grid/Row/UrlGenerator.php index 3bb28c853f4..1924234296f 100644 --- a/app/code/Magento/Sales/Model/Order/Grid/Row/UrlGenerator.php +++ b/app/code/Magento/Sales/Model/Order/Grid/Row/UrlGenerator.php @@ -31,7 +31,7 @@ class UrlGenerator extends \Magento\Backend\Model\Widget\Grid\Row\UrlGenerator /** * Generate row url - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return bool|string */ public function getUrl($item) diff --git a/app/code/Magento/Sales/Model/Order/Invoice/Grid/Row/UrlGenerator.php b/app/code/Magento/Sales/Model/Order/Invoice/Grid/Row/UrlGenerator.php index 5afd3bbf99d..a87f49118e4 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice/Grid/Row/UrlGenerator.php +++ b/app/code/Magento/Sales/Model/Order/Invoice/Grid/Row/UrlGenerator.php @@ -32,7 +32,7 @@ class UrlGenerator extends \Magento\Backend\Model\Widget\Grid\Row\UrlGenerator /** * Generate row url * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return bool|string */ public function getUrl($item) diff --git a/app/code/Magento/Sales/Model/Order/Item.php b/app/code/Magento/Sales/Model/Order/Item.php index c4d7f501e4a..8285f46d0aa 100644 --- a/app/code/Magento/Sales/Model/Order/Item.php +++ b/app/code/Magento/Sales/Model/Order/Item.php @@ -643,7 +643,7 @@ class Item extends AbstractModel implements OrderItemInterface * Returns formatted buy request - object, holding request received from * product view page with keys and options for configured product * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getBuyRequest() { @@ -651,7 +651,7 @@ class Item extends AbstractModel implements OrderItemInterface if (!$option) { $option = []; } - $buyRequest = new \Magento\Framework\Object($option); + $buyRequest = new \Magento\Framework\DataObject($option); $buyRequest->setQty($this->getQtyOrdered() * 1); return $buyRequest; } diff --git a/app/code/Magento/Sales/Model/Order/Payment.php b/app/code/Magento/Sales/Model/Order/Payment.php index 250b46754a4..9566358cc79 100755 --- a/app/code/Magento/Sales/Model/Order/Payment.php +++ b/app/code/Magento/Sales/Model/Order/Payment.php @@ -299,7 +299,7 @@ class Payment extends Info implements OrderPaymentInterface if ($action) { if ($methodInstance->isInitializeNeeded()) { - $stateObject = new \Magento\Framework\Object(); + $stateObject = new \Magento\Framework\DataObject(); // For method initialization we have to use original config value for payment action $methodInstance->initialize($methodInstance->getConfigData('payment_action'), $stateObject); $orderState = $stateObject->getData('state') ?: $orderState; @@ -672,11 +672,11 @@ class Payment extends Info implements OrderPaymentInterface /** * Void payment online * - * @param \Magento\Framework\Object $document + * @param \Magento\Framework\DataObject $document * @return $this * @see self::_void() */ - public function void(\Magento\Framework\Object $document) + public function void(\Magento\Framework\DataObject $document) { $this->_void(true); $this->_eventManager->dispatch('sales_order_payment_void', ['payment' => $this, 'invoice' => $document]); diff --git a/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php b/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php index f324da6d3b7..8b4f585fd34 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php @@ -15,7 +15,7 @@ use Magento\Framework\App\Filesystem\DirectoryList; * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -abstract class AbstractPdf extends \Magento\Framework\Object +abstract class AbstractPdf extends \Magento\Framework\DataObject { /** * Y coordinate @@ -64,7 +64,7 @@ abstract class AbstractPdf extends \Magento\Framework\Object protected $_paymentData; /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -117,7 +117,7 @@ abstract class AbstractPdf extends \Magento\Framework\Object /** * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\Filesystem $filesystem * @param Config $pdfConfig @@ -131,7 +131,7 @@ abstract class AbstractPdf extends \Magento\Framework\Object */ public function __construct( \Magento\Payment\Helper\Data $paymentData, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\Filesystem $filesystem, Config $pdfConfig, @@ -707,7 +707,7 @@ abstract class AbstractPdf extends \Magento\Framework\Object /** * Parse item description * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return array */ protected function _parseItemDescription($item) @@ -821,12 +821,12 @@ abstract class AbstractPdf extends \Magento\Framework\Object /** * Draw Item process * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @param \Zend_Pdf_Page $page * @param \Magento\Sales\Model\Order $order * @return \Zend_Pdf_Page */ - protected function _drawItem(\Magento\Framework\Object $item, \Zend_Pdf_Page $page, \Magento\Sales\Model\Order $order) + protected function _drawItem(\Magento\Framework\DataObject $item, \Zend_Pdf_Page $page, \Magento\Sales\Model\Order $order) { $type = $item->getOrderItem()->getProductType(); $renderer = $this->_getRenderer($type); diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php index ed58b86ba42..ec6ca99a8c2 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php @@ -18,7 +18,7 @@ class Creditmemo extends AbstractPdf /** * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\Filesystem $filesystem * @param Config $pdfConfig @@ -36,7 +36,7 @@ class Creditmemo extends AbstractPdf */ public function __construct( \Magento\Payment\Helper\Data $paymentData, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\Filesystem $filesystem, Config $pdfConfig, diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php b/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php index a69597674ac..954c6c1d3c2 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php @@ -23,7 +23,7 @@ class Invoice extends AbstractPdf /** * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\Filesystem $filesystem * @param Config $pdfConfig @@ -40,7 +40,7 @@ class Invoice extends AbstractPdf */ public function __construct( \Magento\Payment\Helper\Data $paymentData, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\Filesystem $filesystem, Config $pdfConfig, diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php index 716543b5ddb..763c070e08c 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php @@ -30,7 +30,7 @@ abstract class AbstractItems extends \Magento\Framework\Model\AbstractModel /** * Item object * - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $_item; @@ -118,10 +118,10 @@ abstract class AbstractItems extends \Magento\Framework\Model\AbstractModel /** * Set item object * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return $this */ - public function setItem(\Magento\Framework\Object $item) + public function setItem(\Magento\Framework\DataObject $item) { $this->_item = $item; return $this; @@ -183,7 +183,7 @@ abstract class AbstractItems extends \Magento\Framework\Model\AbstractModel * Retrieve item object * * @throws \Magento\Framework\Exception\LocalizedException - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getItem() { diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php index 2f96bd2454f..44b76bfbc73 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php @@ -13,7 +13,7 @@ class DefaultCreditmemo extends \Magento\Sales\Model\Order\Pdf\Items\AbstractIte /** * Core string * - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -23,7 +23,7 @@ class DefaultCreditmemo extends \Magento\Sales\Model\Order\Pdf\Items\AbstractIte * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Framework\Filesystem $filesystem * @param \Magento\Framework\Filter\FilterManager $filterManager - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection * @param array $data @@ -34,7 +34,7 @@ class DefaultCreditmemo extends \Magento\Sales\Model\Order\Pdf\Items\AbstractIte \Magento\Tax\Helper\Data $taxData, \Magento\Framework\Filesystem $filesystem, \Magento\Framework\Filter\FilterManager $filterManager, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [] diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php index 33e00f83d5d..ac7e46769e5 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php @@ -13,7 +13,7 @@ class DefaultInvoice extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems /** * Core string * - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -23,7 +23,7 @@ class DefaultInvoice extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Framework\Filesystem $filesystem * @param \Magento\Framework\Filter\FilterManager $filterManager - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection * @param array $data @@ -34,7 +34,7 @@ class DefaultInvoice extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems \Magento\Tax\Helper\Data $taxData, \Magento\Framework\Filesystem $filesystem, \Magento\Framework\Filter\FilterManager $filterManager, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [] diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php index 3343f6827f8..b42f9321efa 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php @@ -13,7 +13,7 @@ class DefaultShipment extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems /** * Core string * - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -23,7 +23,7 @@ class DefaultShipment extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Framework\Filesystem $filesystem * @param \Magento\Framework\Filter\FilterManager $filterManager - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection * @param array $data @@ -34,7 +34,7 @@ class DefaultShipment extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems \Magento\Tax\Helper\Data $taxData, \Magento\Framework\Filesystem $filesystem, \Magento\Framework\Filter\FilterManager $filterManager, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [] diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php b/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php index f630bf25543..dc97fc81538 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php @@ -23,7 +23,7 @@ class Shipment extends AbstractPdf /** * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\Filesystem $filesystem * @param Config $pdfConfig @@ -40,7 +40,7 @@ class Shipment extends AbstractPdf */ public function __construct( \Magento\Payment\Helper\Data $paymentData, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\Filesystem $filesystem, Config $pdfConfig, diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Total/DefaultTotal.php b/app/code/Magento/Sales/Model/Order/Pdf/Total/DefaultTotal.php index aef42991031..9dab9d212d1 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Total/DefaultTotal.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Total/DefaultTotal.php @@ -13,7 +13,7 @@ namespace Magento\Sales\Model\Order\Pdf\Total; * * @method \Magento\Sales\Model\Order getOrder() */ -class DefaultTotal extends \Magento\Framework\Object +class DefaultTotal extends \Magento\Framework\DataObject { /** * @var \Magento\Tax\Helper\Data diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Track.php b/app/code/Magento/Sales/Model/Order/Shipment/Track.php index 35de2cdfe45..7c203248241 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Track.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Track.php @@ -112,7 +112,7 @@ class Track extends AbstractModel implements ShipmentTrackInterface * @codeCoverageIgnore * * @param string $number - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function setNumber($number) { diff --git a/app/code/Magento/Sales/Model/Order/Total.php b/app/code/Magento/Sales/Model/Order/Total.php index 70292cff40e..8714c2e9bca 100644 --- a/app/code/Magento/Sales/Model/Order/Total.php +++ b/app/code/Magento/Sales/Model/Order/Total.php @@ -5,6 +5,6 @@ */ namespace Magento\Sales\Model\Order; -class Total extends \Magento\Framework\Object +class Total extends \Magento\Framework\DataObject { } diff --git a/app/code/Magento/Sales/Model/Order/Total/AbstractTotal.php b/app/code/Magento/Sales/Model/Order/Total/AbstractTotal.php index 61706341772..f0995e0c70c 100644 --- a/app/code/Magento/Sales/Model/Order/Total/AbstractTotal.php +++ b/app/code/Magento/Sales/Model/Order/Total/AbstractTotal.php @@ -10,7 +10,7 @@ namespace Magento\Sales\Model\Order\Total; * * @author Magento Core Team <core@magentocommerce.com> */ -abstract class AbstractTotal extends \Magento\Framework\Object +abstract class AbstractTotal extends \Magento\Framework\DataObject { /** * Process model configuration array. diff --git a/app/code/Magento/Sales/Model/Resource/EntityAbstract.php b/app/code/Magento/Sales/Model/Resource/EntityAbstract.php index b095ebf88a3..fa19a972a1b 100644 --- a/app/code/Magento/Sales/Model/Resource/EntityAbstract.php +++ b/app/code/Magento/Sales/Model/Resource/EntityAbstract.php @@ -114,7 +114,7 @@ abstract class EntityAbstract extends AbstractDb * Perform actions before object save * Perform actions before object save, calculate next sequence value for increment Id * - * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\Object $object + * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\DataObject $object * @return $this */ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object) diff --git a/app/code/Magento/Sales/Model/Resource/Order/Address.php b/app/code/Magento/Sales/Model/Resource/Order/Address.php index 83453f3ca68..d55205ad7de 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Address.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Address.php @@ -126,7 +126,7 @@ class Address extends SalesResource implements OrderAddressResourceInterface /** * Update related grid table after object save * - * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\Object $object + * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\DataObject $object * @return \Magento\Framework\Model\Resource\Db\AbstractDb */ protected function _afterSave(\Magento\Framework\Model\AbstractModel $object) diff --git a/app/code/Magento/Sales/Model/Resource/Order/Attribute/Backend/Billing.php b/app/code/Magento/Sales/Model/Resource/Order/Attribute/Backend/Billing.php index 43d3441f608..ccc51081db5 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Attribute/Backend/Billing.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Attribute/Backend/Billing.php @@ -15,7 +15,7 @@ class Billing extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacken /** * Perform operation before save * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return void */ public function beforeSave($object) @@ -29,7 +29,7 @@ class Billing extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacken /** * Perform operation after save * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return void */ public function afterSave($object) diff --git a/app/code/Magento/Sales/Model/Resource/Order/Attribute/Backend/Child.php b/app/code/Magento/Sales/Model/Resource/Order/Attribute/Backend/Child.php index b9bfe3e390c..ee1920d05ea 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Attribute/Backend/Child.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Attribute/Backend/Child.php @@ -15,7 +15,7 @@ class Child extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Perform operation before save * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function beforeSave($object) diff --git a/app/code/Magento/Sales/Model/Resource/Order/Attribute/Backend/Shipping.php b/app/code/Magento/Sales/Model/Resource/Order/Attribute/Backend/Shipping.php index 46e0549a6c0..9075f40c2da 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Attribute/Backend/Shipping.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Attribute/Backend/Shipping.php @@ -15,7 +15,7 @@ class Shipping extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacke /** * Perform operation before save * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return void */ public function beforeSave($object) @@ -29,7 +29,7 @@ class Shipping extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacke /** * Perform operation after save * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return void */ public function afterSave($object) diff --git a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo.php b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo.php index 255d4cd4388..33f984d84d7 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo.php @@ -39,7 +39,7 @@ class Creditmemo extends SalesResource implements CreditmemoResourceInterface /** * Perform actions before object save * - * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\Object $object + * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\DataObject $object * @return $this */ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object) diff --git a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Attribute/Backend/Child.php b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Attribute/Backend/Child.php index 4448a8834dc..6c790491ed2 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Attribute/Backend/Child.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Attribute/Backend/Child.php @@ -15,7 +15,7 @@ class Child extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Method is invoked before save * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend */ public function beforeSave($object) diff --git a/app/code/Magento/Sales/Model/Resource/Order/Invoice.php b/app/code/Magento/Sales/Model/Resource/Order/Invoice.php index 33a095ce60c..806119110d1 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Invoice.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Invoice.php @@ -37,7 +37,7 @@ class Invoice extends SalesResource implements InvoiceResourceInterface /** * Perform actions before object save * - * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\Object $object + * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\DataObject $object * @return $this */ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object) diff --git a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Attribute/Backend/Child.php b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Attribute/Backend/Child.php index 209638e546c..ce0dfba8af1 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Attribute/Backend/Child.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Attribute/Backend/Child.php @@ -15,7 +15,7 @@ class Child extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Method is invoked before save * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend */ public function beforeSave($object) diff --git a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Attribute/Backend/Item.php b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Attribute/Backend/Item.php index acb173dc38b..76063d697ff 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Attribute/Backend/Item.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Attribute/Backend/Item.php @@ -15,7 +15,7 @@ class Item extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Method is invoked after save * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend */ public function afterSave($object) diff --git a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Attribute/Backend/Order.php b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Attribute/Backend/Order.php index d1af55b9631..5afdb2cbc26 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Attribute/Backend/Order.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Attribute/Backend/Order.php @@ -15,7 +15,7 @@ class Order extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Method is invoked before save * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function beforeSave($object) diff --git a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Item.php b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Item.php index 03c13845e9b..985ec139665 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Item.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Item.php @@ -32,7 +32,7 @@ class Item extends \Magento\Sales\Model\Resource\EntityAbstract /** * Perform actions before object save * - * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\Object $object + * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\DataObject $object * @return $this */ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object) diff --git a/app/code/Magento/Sales/Model/Resource/Order/Item.php b/app/code/Magento/Sales/Model/Resource/Order/Item.php index 426b9b3e2d5..4c1482d66ad 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Item.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Item.php @@ -39,7 +39,7 @@ class Item extends SalesResource /** * Perform actions before object save * - * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\Object $object + * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\DataObject $object * @return $this */ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object) diff --git a/app/code/Magento/Sales/Model/Resource/Order/Payment.php b/app/code/Magento/Sales/Model/Resource/Order/Payment.php index 2d4603ec740..cf6780d4002 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Payment.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Payment.php @@ -40,7 +40,7 @@ class Payment extends SalesResource /** * Perform actions before object save * - * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\Object $object + * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\DataObject $object * @return $this */ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object) diff --git a/app/code/Magento/Sales/Model/Resource/Order/Shipment.php b/app/code/Magento/Sales/Model/Resource/Order/Shipment.php index e5afdc4e837..d0cbc8df97b 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Shipment.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Shipment.php @@ -45,7 +45,7 @@ class Shipment extends SalesResource implements ShipmentResourceInterface /** * Perform actions before object save * - * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\Object $object + * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\DataObject $object * @return $this * @throws \Magento\Framework\Exception\LocalizedException */ diff --git a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Attribute/Backend/Child.php b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Attribute/Backend/Child.php index 234a5b08a9a..bc722641874 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Attribute/Backend/Child.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Attribute/Backend/Child.php @@ -15,7 +15,7 @@ class Child extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Performed before data is saved * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return $this */ public function beforeSave($object) diff --git a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Item.php b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Item.php index fb13970fe19..dc762e4546b 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Item.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Item.php @@ -35,7 +35,7 @@ class Item extends SalesResource implements ShipmentItemResourceInterface /** * Perform actions before object save * - * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\Object $object + * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\DataObject $object * @return $this */ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object) diff --git a/app/code/Magento/Sales/Model/Resource/Sale/Collection.php b/app/code/Magento/Sales/Model/Resource/Sale/Collection.php index ade497aa07d..e47e38093a5 100644 --- a/app/code/Magento/Sales/Model/Resource/Sale/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Sale/Collection.php @@ -192,7 +192,7 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac $stores = $this->_storeCollectionFactory->create()->setWithoutDefaultFilter()->load()->toOptionHash(); $this->_items = []; foreach ($data as $v) { - $storeObject = new \Magento\Framework\Object($v); + $storeObject = new \Magento\Framework\DataObject($v); $storeId = $v['store_id']; $storeName = isset($stores[$storeId]) ? $stores[$storeId] : null; $storeObject->setStoreName( @@ -218,12 +218,12 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac } /** - * Retrieve totals data converted into \Magento\Framework\Object + * Retrieve totals data converted into \Magento\Framework\DataObject * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getTotals() { - return new \Magento\Framework\Object($this->_totals); + return new \Magento\Framework\DataObject($this->_totals); } } diff --git a/app/code/Magento/Sales/Model/Rss/OrderStatus.php b/app/code/Magento/Sales/Model/Rss/OrderStatus.php index 25af8d60028..0ccf0f3705c 100644 --- a/app/code/Magento/Sales/Model/Rss/OrderStatus.php +++ b/app/code/Magento/Sales/Model/Rss/OrderStatus.php @@ -133,7 +133,11 @@ class OrderStatus implements DataProviderInterface return $this->order; } - $data = json_decode(base64_decode((string)$this->request->getParam('data')), true); + $data = null; + $json = base64_decode((string)$this->request->getParam('data')); + if ($json) { + $data = json_decode($json, true); + } if (!is_array($data)) { return null; } diff --git a/app/code/Magento/Sales/Model/Service/OrderService.php b/app/code/Magento/Sales/Model/Service/OrderService.php index f6857df9f85..b2673a3e817 100644 --- a/app/code/Magento/Sales/Model/Service/OrderService.php +++ b/app/code/Magento/Sales/Model/Service/OrderService.php @@ -215,7 +215,7 @@ class OrderService implements OrderManagementInterface } } - $transport = new \Magento\Framework\Object( + $transport = new \Magento\Framework\DataObject( [ 'state' => $state, 'status' => $status, diff --git a/app/code/Magento/Sales/Model/Status/ListStatus.php b/app/code/Magento/Sales/Model/Status/ListStatus.php index ab2e02fd2db..369d71e673e 100644 --- a/app/code/Magento/Sales/Model/Status/ListStatus.php +++ b/app/code/Magento/Sales/Model/Status/ListStatus.php @@ -27,7 +27,7 @@ class ListStatus * @param string|null $origin Usually a name of module, that adds this status * @param int|null $code Code of status, unique for origin, that sets it * @param string|null $message Status message - * @param \Magento\Framework\Object|null $additionalData Any additional data, that caller would like to store + * @param \Magento\Framework\DataObject|null $additionalData Any additional data, that caller would like to store * @return $this */ public function addItem($origin = null, $code = null, $message = null, $additionalData = null) diff --git a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/Items/GridTest.php b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/Items/GridTest.php index f2ea36b5e32..299d79567b4 100644 --- a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/Items/GridTest.php +++ b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/Items/GridTest.php @@ -243,7 +243,7 @@ class GridTest extends \PHPUnit_Framework_TestCase false ); - $checkMock = $this->getMock('Magento\Framework\Object', ['getMessage', 'getHasError'], [], '', false); + $checkMock = $this->getMock('Magento\Framework\DataObject', ['getMessage', 'getHasError'], [], '', false); $layoutMock->expects($this->once())->method('getParentName')->will($this->returnValue('parentBlock')); $layoutMock->expects($this->once())->method('getBlock')->with('parentBlock') diff --git a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/Search/Grid/Renderer/QtyTest.php b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/Search/Grid/Renderer/QtyTest.php index 8ef8674d942..073ecf61194 100644 --- a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/Search/Grid/Renderer/QtyTest.php +++ b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/Search/Grid/Renderer/QtyTest.php @@ -26,7 +26,7 @@ class QtyTest extends \PHPUnit_Framework_TestCase { $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->rowMock = $this->getMock('Magento\Framework\Object', ['getTypeId', 'getIndex'], [], '', false); + $this->rowMock = $this->getMock('Magento\Framework\DataObject', ['getTypeId', 'getIndex'], [], '', false); $this->typeConfigMock = $this->getMock('Magento\Catalog\Model\ProductTypes\ConfigInterface'); $this->renderer = $helper->getObject( 'Magento\Sales\Block\Adminhtml\Order\Create\Search\Grid\Renderer\Qty', diff --git a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/Sidebar/AbstractSidebarTest.php b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/Sidebar/AbstractSidebarTest.php index 91f119c6375..8a808d2aaf6 100644 --- a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/Sidebar/AbstractSidebarTest.php +++ b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/Sidebar/AbstractSidebarTest.php @@ -20,7 +20,7 @@ class AbstractSidebarTest extends \PHPUnit_Framework_TestCase protected function setUp() { $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->itemMock = $this->getMock('Magento\Framework\Object', ['getQty'], [], '', false); + $this->itemMock = $this->getMock('Magento\Framework\DataObject', ['getQty'], [], '', false); $this->abstractSidebar = $helper->getObject( 'Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\AbstractSidebar', [] diff --git a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/GiftmessageTest.php b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/GiftmessageTest.php index b91098814d8..7aa9fc1bdb5 100644 --- a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/GiftmessageTest.php +++ b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/GiftmessageTest.php @@ -9,7 +9,7 @@ class GiftmessageTest extends \PHPUnit_Framework_TestCase { public function testGetSaveButtonHtml() { - $item = new \Magento\Framework\Object(); + $item = new \Magento\Framework\DataObject(); $expectedHtml = 'some_value'; /** @var $block \Magento\Sales\Block\Adminhtml\Order\View\Giftmessage */ @@ -20,7 +20,7 @@ class GiftmessageTest extends \PHPUnit_Framework_TestCase '', false ); - $block->setEntity(new \Magento\Framework\Object()); + $block->setEntity(new \Magento\Framework\DataObject()); $block->expects($this->once())->method('getChildBlock')->with('save_button')->will($this->returnValue($item)); $block->expects( $this->once() diff --git a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/InfoTest.php b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/InfoTest.php index dfb62d6058c..101c7aea6b9 100644 --- a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/InfoTest.php +++ b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/InfoTest.php @@ -86,7 +86,7 @@ class InfoTest extends \PHPUnit_Framework_TestCase ->with('Magento_Sales::actions_edit') ->will($this->returnValue(false)); - $address = new \Magento\Framework\Object(); + $address = new \Magento\Framework\DataObject(); $this->assertEmpty($block->getAddressEditLink($address)); } diff --git a/app/code/Magento/Sales/Test/Unit/Helper/AdminTest.php b/app/code/Magento/Sales/Test/Unit/Helper/AdminTest.php index d9ccb497065..da013477ba3 100644 --- a/app/code/Magento/Sales/Test/Unit/Helper/AdminTest.php +++ b/app/code/Magento/Sales/Test/Unit/Helper/AdminTest.php @@ -25,7 +25,7 @@ class AdminTest extends \PHPUnit_Framework_TestCase protected $salesConfigMock; /** - * @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject */ protected $magentoObjectMock; @@ -77,7 +77,7 @@ class AdminTest extends \PHPUnit_Framework_TestCase ] ); - $this->magentoObjectMock = $this->getMockBuilder('Magento\Framework\Object') + $this->magentoObjectMock = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->setMethods(['getOrder', 'getData']) ->getMock(); diff --git a/app/code/Magento/Sales/Test/Unit/Model/AdminOrder/CreateTest.php b/app/code/Magento/Sales/Test/Unit/Model/AdminOrder/CreateTest.php index ee460d0635f..fb922ec7fb2 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/AdminOrder/CreateTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/AdminOrder/CreateTest.php @@ -92,7 +92,7 @@ class CreateTest extends \PHPUnit_Framework_TestCase $configMock = $this->getMock('Magento\Sales\Model\Config', [], [], '', false); $this->sessionQuoteMock = $this->getMock('Magento\Backend\Model\Session\Quote', [], [], '', false); $loggerMock = $this->getMock('Psr\Log\LoggerInterface'); - $copyMock = $this->getMock('Magento\Framework\Object\Copy', [], [], '', false); + $copyMock = $this->getMock('Magento\Framework\DataObject\Copy', [], [], '', false); $messageManagerMock = $this->getMock('Magento\Framework\Message\ManagerInterface'); $this->formFactoryMock = $this->getMock( 'Magento\Customer\Model\Metadata\FormFactory', @@ -111,7 +111,7 @@ class CreateTest extends \PHPUnit_Framework_TestCase $this->itemUpdater = $this->getMock('Magento\Quote\Model\Quote\Item\Updater', [], [], '', false); - $this->objectFactory = $this->getMockBuilder('\Magento\Framework\Object\Factory') + $this->objectFactory = $this->getMockBuilder('\Magento\Framework\DataObject\Factory') ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); diff --git a/app/code/Magento/Sales/Test/Unit/Model/AdminOrder/Product/Quote/InitializerTest.php b/app/code/Magento/Sales/Test/Unit/Model/AdminOrder/Product/Quote/InitializerTest.php index e22e5956445..579397e7ec6 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/AdminOrder/Product/Quote/InitializerTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/AdminOrder/Product/Quote/InitializerTest.php @@ -27,7 +27,7 @@ class InitializerTest extends \PHPUnit_Framework_TestCase protected $productMock; /** - * @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject */ protected $configMock; @@ -63,7 +63,7 @@ class InitializerTest extends \PHPUnit_Framework_TestCase ); $this->configMock = $this->getMock( - 'Magento\Framework\Object', + 'Magento\Framework\DataObject', ['getQty', 'setQty'], [], '', diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php index 0cfd5e052ef..9a845304e23 100755 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php @@ -46,28 +46,28 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function testGetInvisibleOnFrontStatuses() { $statuses = [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'status' => 'canceled', 'is_default' => 1, 'visible_on_front' => 1, ] ), - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'status' => 'complete', 'is_default' => 1, 'visible_on_front' => 0, ] ), - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'status' => 'processing', 'is_default' => 1, 'visible_on_front' => 1, ] ), - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'status' => 'pending_payment', 'is_default' => 1, diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Total/ShippingTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Total/ShippingTest.php index 6017ebc09a0..54391701b8c 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Total/ShippingTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Total/ShippingTest.php @@ -78,7 +78,7 @@ class ShippingTest extends \PHPUnit_Framework_TestCase ->method('format') ->with($allowedShippingAmount, null, false) ->willReturn($allowedShippingAmount); - $order = new \Magento\Framework\Object( + $order = new \Magento\Framework\DataObject( [ 'base_shipping_amount' => $orderShippingAmount, 'base_shipping_refunded' => $orderShippingRefunded, @@ -122,7 +122,7 @@ class ShippingTest extends \PHPUnit_Framework_TestCase $expectedGrandTotal = $grandTotalBefore + $allowedShippingAmount; $expectedBaseGrandTtoal = $baseGrandTotalBefore + $baseAllowedShippingAmount; - $order = new \Magento\Framework\Object( + $order = new \Magento\Framework\DataObject( [ 'shipping_amount' => $orderShippingAmount, 'shipping_refunded' => $orderShippingRefunded, @@ -209,7 +209,7 @@ class ShippingTest extends \PHPUnit_Framework_TestCase $expectedGrandTotal = $grandTotalBefore + $expectedShippingAmount; $expectedBaseGrandTtoal = $baseGrandTotalBefore + $expectedBaseShippingAmount; - $order = new \Magento\Framework\Object( + $order = new \Magento\Framework\DataObject( [ 'shipping_amount' => $orderShippingAmount, 'shipping_refunded' => $orderShippingAmountRefunded, diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Total/TaxTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Total/TaxTest.php index e4a36e24263..669369a1d4b 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Total/TaxTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Total/TaxTest.php @@ -8,7 +8,7 @@ namespace Magento\Sales\Test\Unit\Model\Order\Creditmemo\Total; -use Magento\Framework\Object as MagentoObject; +use Magento\Framework\DataObject as MagentoObject; class TaxTest extends \PHPUnit_Framework_TestCase { diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Customer/ManagementTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Customer/ManagementTest.php index a837fd66e86..f7f64f25d41 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Customer/ManagementTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Customer/ManagementTest.php @@ -47,7 +47,7 @@ class ManagementTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->objectCopyService = $this->getMock('\Magento\Framework\Object\Copy', [], [], '', false); + $this->objectCopyService = $this->getMock('\Magento\Framework\DataObject\Copy', [], [], '', false); $this->accountManagement = $this->getMock('\Magento\Customer\Api\AccountManagementInterface'); $this->customerFactory = $this->getMock( '\Magento\Customer\Api\Data\CustomerInterfaceFactory', diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Grid/Row/UrlGeneratorTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Grid/Row/UrlGeneratorTest.php index 7ff72976db9..37e17346f4f 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Grid/Row/UrlGeneratorTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Grid/Row/UrlGeneratorTest.php @@ -72,6 +72,6 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase ->method('isAllowed') ->with('Magento_Sales::actions_view', null) ->willReturn($isAllowed); - $this->assertEquals($url, $this->urlGenerator->getUrl(new \Magento\Framework\Object())); + $this->assertEquals($url, $this->urlGenerator->getUrl(new \Magento\Framework\DataObject())); } } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Invoice/Grid/Row/UrlGeneratorTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Invoice/Grid/Row/UrlGeneratorTest.php index 6d237d96e64..aa252b1a201 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Invoice/Grid/Row/UrlGeneratorTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Invoice/Grid/Row/UrlGeneratorTest.php @@ -74,6 +74,6 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase ->method('isAllowed') ->with('Magento_Sales::sales_invoice', null) ->willReturn($isAllowed); - $this->assertEquals($url, $this->urlGenerator->getUrl(new \Magento\Framework\Object())); + $this->assertEquals($url, $this->urlGenerator->getUrl(new \Magento\Framework\DataObject())); } } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Pdf/AbstractTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Pdf/AbstractTest.php index abdd2d101a8..bfe33bffbab 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Pdf/AbstractTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Pdf/AbstractTest.php @@ -23,7 +23,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase // Setup most constructor dependencies $paymentData = $this->getMock('Magento\Payment\Helper\Data', [], [], '', false); $addressRenderer = $this->getMock('Magento\Sales\Model\Order\Address\Renderer', [], [], '', false); - $string = $this->getMock('Magento\Framework\Stdlib\String', [], [], '', false); + $string = $this->getMock('Magento\Framework\Stdlib\StringUtils', [], [], '', false); $scopeConfig = $this->getMock('Magento\Framework\App\Config\ScopeConfigInterface'); $translate = $this->getMock('Magento\Framework\Translate\Inline\StateInterface', [], [], '', false); $filesystem = $this->getMock('Magento\Framework\Filesystem', [], [], '', false); diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/TrackTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/TrackTest.php index 9815fdcd521..4fb1b63fcbb 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/TrackTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/TrackTest.php @@ -41,7 +41,7 @@ class TrackTest extends \PHPUnit_Framework_TestCase public function testGetStoreId() { $storeId = 10; - $storeObject = new \Magento\Framework\Object(['id' => $storeId]); + $storeObject = new \Magento\Framework\DataObject(['id' => $storeId]); $shipmentMock = $this->getMock( 'Magento\Sales\Model\Order\Shipment', diff --git a/app/code/Magento/Sales/etc/fieldset.xml b/app/code/Magento/Sales/etc/fieldset.xml index 628fc7e7546..1720b5f3c11 100644 --- a/app/code/Magento/Sales/etc/fieldset.xml +++ b/app/code/Magento/Sales/etc/fieldset.xml @@ -6,7 +6,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Object/etc/fieldset.xsd"> + xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/DataObject/etc/fieldset.xsd"> <scope id="global"> <fieldset id="sales_copy_order"> <field name="customer_email"> diff --git a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Grid/Column/Renderer/Used.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Grid/Column/Renderer/Used.php index 4a516201c93..9ee9d2b8f4f 100644 --- a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Grid/Column/Renderer/Used.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Grid/Column/Renderer/Used.php @@ -13,10 +13,10 @@ namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid\Co class Used extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Text { /** - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $value = (int)$row->getData($this->getColumn()->getIndex()); return empty($value) ? __('No') : __('Yes'); diff --git a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main.php index e43baa34e44..319b5ef3ae6 100644 --- a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main.php @@ -13,7 +13,7 @@ use Magento\Backend\Block\Widget\Form\Generic; use Magento\Backend\Block\Widget\Tab\TabInterface; use Magento\Customer\Api\GroupRepositoryInterface; use Magento\Framework\Api\SearchCriteriaBuilder; -use Magento\Framework\Convert\Object as ObjectConverter; +use Magento\Framework\Convert\DataObject as ObjectConverter; use Magento\Framework\Data\FormFactory; use Magento\Framework\Registry; use Magento\SalesRule\Model\RuleFactory; @@ -33,7 +33,7 @@ class Main extends Generic implements TabInterface protected $_systemStore; /** - * @var \Magento\Framework\Convert\Object + * @var \Magento\Framework\Convert\DataObject */ protected $_objectConverter; diff --git a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php index 055668dc165..9434b07ed0b 100644 --- a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php +++ b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php @@ -42,7 +42,7 @@ class Save extends \Magento\SalesRule\Controller\Adminhtml\Promo\Quote $session = $this->_objectManager->get('Magento\Backend\Model\Session'); - $validateResult = $model->validateData(new \Magento\Framework\Object($data)); + $validateResult = $model->validateData(new \Magento\Framework\DataObject($data)); if ($validateResult !== true) { foreach ($validateResult as $errorMessage) { $this->messageManager->addError($errorMessage); diff --git a/app/code/Magento/SalesRule/Model/Coupon/Codegenerator.php b/app/code/Magento/SalesRule/Model/Coupon/Codegenerator.php index 806814a3063..7200a131e08 100644 --- a/app/code/Magento/SalesRule/Model/Coupon/Codegenerator.php +++ b/app/code/Magento/SalesRule/Model/Coupon/Codegenerator.php @@ -5,7 +5,7 @@ */ namespace Magento\SalesRule\Model\Coupon; -class Codegenerator extends \Magento\Framework\Object implements \Magento\SalesRule\Model\Coupon\CodegeneratorInterface +class Codegenerator extends \Magento\Framework\DataObject implements CodegeneratorInterface { /** * The minimum length of the default diff --git a/app/code/Magento/SalesRule/Model/Resource/Coupon/Usage.php b/app/code/Magento/SalesRule/Model/Resource/Coupon/Usage.php index c310061177d..1b98b4b3e04 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Coupon/Usage.php +++ b/app/code/Magento/SalesRule/Model/Resource/Coupon/Usage.php @@ -61,12 +61,12 @@ class Usage extends \Magento\Framework\Model\Resource\Db\AbstractDb /** * Load an object by customer_id & coupon_id * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @param int $customerId * @param mixed $couponId * @return $this */ - public function loadByCustomerCoupon(\Magento\Framework\Object $object, $customerId, $couponId) + public function loadByCustomerCoupon(\Magento\Framework\DataObject $object, $customerId, $couponId) { $read = $this->_getReadAdapter(); if ($read && $couponId && $customerId) { diff --git a/app/code/Magento/SalesRule/Model/Resource/Rule.php b/app/code/Magento/SalesRule/Model/Resource/Rule.php index 0a9b3fbd4d4..fb8d3fa404a 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Rule.php +++ b/app/code/Magento/SalesRule/Model/Resource/Rule.php @@ -33,7 +33,7 @@ class Rule extends \Magento\Rule\Model\Resource\AbstractResource /** * Magento string lib * - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -44,13 +44,13 @@ class Rule extends \Magento\Rule\Model\Resource\AbstractResource /** * @param \Magento\Framework\Model\Resource\Db\Context $context - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\SalesRule\Model\Resource\Coupon $resourceCoupon * @param string|null $resourcePrefix */ public function __construct( \Magento\Framework\Model\Resource\Db\Context $context, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\SalesRule\Model\Resource\Coupon $resourceCoupon, $resourcePrefix = null ) { diff --git a/app/code/Magento/SalesRule/Model/Rule.php b/app/code/Magento/SalesRule/Model/Rule.php index dd709002460..8c74862c5e0 100644 --- a/app/code/Magento/SalesRule/Model/Rule.php +++ b/app/code/Magento/SalesRule/Model/Rule.php @@ -419,7 +419,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel \Magento\SalesRule\Model\Rule::COUPON_TYPE_NO_COUPON => __('No Coupon'), \Magento\SalesRule\Model\Rule::COUPON_TYPE_SPECIFIC => __('Specific Coupon'), ]; - $transport = new \Magento\Framework\Object( + $transport = new \Magento\Framework\DataObject( ['coupon_types' => $this->_couponTypes, 'is_coupon_type_auto_visible' => false] ); $this->_eventManager->dispatch('salesrule_rule_get_coupon_types', ['transport' => $transport]); diff --git a/app/code/Magento/SalesRule/Model/Rule/Condition/Combine.php b/app/code/Magento/SalesRule/Model/Rule/Condition/Combine.php index 21514053310..4649a854e9f 100644 --- a/app/code/Magento/SalesRule/Model/Rule/Condition/Combine.php +++ b/app/code/Magento/SalesRule/Model/Rule/Condition/Combine.php @@ -73,7 +73,7 @@ class Combine extends \Magento\Rule\Model\Condition\Combine ] ); - $additional = new \Magento\Framework\Object(); + $additional = new \Magento\Framework\DataObject(); $this->_eventManager->dispatch('salesrule_rule_condition_combine', ['additional' => $additional]); $additionalConditions = $additional->getConditions(); if ($additionalConditions) { diff --git a/app/code/Magento/SalesRule/Model/Utility.php b/app/code/Magento/SalesRule/Model/Utility.php index 3b170bc61e7..fe0ec375306 100644 --- a/app/code/Magento/SalesRule/Model/Utility.php +++ b/app/code/Magento/SalesRule/Model/Utility.php @@ -41,7 +41,7 @@ class Utility protected $customerFactory; /** - * @var \Magento\Framework\ObjectFactory + * @var \Magento\Framework\DataObjectFactory */ protected $objectFactory; @@ -54,14 +54,14 @@ class Utility * @param Resource\Coupon\UsageFactory $usageFactory * @param CouponFactory $couponFactory * @param Rule\CustomerFactory $customerFactory - * @param \Magento\Framework\ObjectFactory $objectFactory + * @param \Magento\Framework\DataObjectFactory $objectFactory * @param PriceCurrencyInterface $priceCurrency */ public function __construct( \Magento\SalesRule\Model\Resource\Coupon\UsageFactory $usageFactory, \Magento\SalesRule\Model\CouponFactory $couponFactory, \Magento\SalesRule\Model\Rule\CustomerFactory $customerFactory, - \Magento\Framework\ObjectFactory $objectFactory, + \Magento\Framework\DataObjectFactory $objectFactory, PriceCurrencyInterface $priceCurrency ) { $this->couponFactory = $couponFactory; diff --git a/app/code/Magento/SalesRule/Test/Unit/Model/Quote/DiscountTest.php b/app/code/Magento/SalesRule/Test/Unit/Model/Quote/DiscountTest.php index dcdf40e11d3..ef0d91ce32f 100644 --- a/app/code/Magento/SalesRule/Test/Unit/Model/Quote/DiscountTest.php +++ b/app/code/Magento/SalesRule/Test/Unit/Model/Quote/DiscountTest.php @@ -5,7 +5,7 @@ */ namespace Magento\SalesRule\Test\Unit\Model\Quote; -use Magento\Framework\Object as MagentoObject; +use Magento\Framework\DataObject as MagentoObject; /** * Class DiscountTest diff --git a/app/code/Magento/SalesRule/Test/Unit/Model/Rule/Action/Discount/CartFixedTest.php b/app/code/Magento/SalesRule/Test/Unit/Model/Rule/Action/Discount/CartFixedTest.php index d01b7c2cdce..41f64739c75 100644 --- a/app/code/Magento/SalesRule/Test/Unit/Model/Rule/Action/Discount/CartFixedTest.php +++ b/app/code/Magento/SalesRule/Test/Unit/Model/Rule/Action/Discount/CartFixedTest.php @@ -49,7 +49,7 @@ class CartFixedTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->rule = $this->getMock('Magento\Framework\Object', null, [], 'Rule', true); + $this->rule = $this->getMock('Magento\Framework\DataObject', null, [], 'Rule', true); $this->item = $this->getMock('Magento\Quote\Model\Quote\Item\AbstractItem', [], [], '', false); $this->data = $this->getMock('Magento\SalesRule\Model\Rule\Action\Discount\Data', null); diff --git a/app/code/Magento/SalesRule/Test/Unit/Model/UtilityTest.php b/app/code/Magento/SalesRule/Test/Unit/Model/UtilityTest.php index e99e595d5bc..d9fd1a1ffc6 100644 --- a/app/code/Magento/SalesRule/Test/Unit/Model/UtilityTest.php +++ b/app/code/Magento/SalesRule/Test/Unit/Model/UtilityTest.php @@ -53,7 +53,7 @@ class UtilityTest extends \PHPUnit_Framework_TestCase protected $rule; /** - * @var \Magento\Framework\ObjectFactory | \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObjectFactory | \PHPUnit_Framework_MockObject_MockObject */ protected $objectFactory; @@ -82,7 +82,7 @@ class UtilityTest extends \PHPUnit_Framework_TestCase false ); $this->couponFactory = $this->getMock('Magento\SalesRule\Model\CouponFactory', ['create'], [], '', false); - $this->objectFactory = $this->getMock('Magento\Framework\ObjectFactory', ['create'], [], '', false); + $this->objectFactory = $this->getMock('Magento\Framework\DataObjectFactory', ['create'], [], '', false); $this->customerFactory = $this->getMock( 'Magento\SalesRule\Model\Rule\CustomerFactory', ['create'], @@ -260,7 +260,7 @@ class UtilityTest extends \PHPUnit_Framework_TestCase ->method('create') ->will($this->returnValue($this->coupon)); - $couponUsage = new \Magento\Framework\Object(); + $couponUsage = new \Magento\Framework\DataObject(); $this->objectFactory->expects($this->once()) ->method('create') ->will($this->returnValue($couponUsage)); diff --git a/app/code/Magento/SalesRule/etc/fieldset.xml b/app/code/Magento/SalesRule/etc/fieldset.xml index 638d265b69c..43b3c247450 100644 --- a/app/code/Magento/SalesRule/etc/fieldset.xml +++ b/app/code/Magento/SalesRule/etc/fieldset.xml @@ -6,7 +6,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Object/etc/fieldset.xsd"> + xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/DataObject/etc/fieldset.xsd"> <scope id="global"> <fieldset id="sales_convert_quote_address"> <field name="discount_description"> diff --git a/app/code/Magento/Search/Block/Term.php b/app/code/Magento/Search/Block/Term.php index 2339cb39bad..3b010fa8589 100644 --- a/app/code/Magento/Search/Block/Term.php +++ b/app/code/Magento/Search/Block/Term.php @@ -113,7 +113,7 @@ class Term extends Template } /** - * @param \Magento\Framework\Object $obj + * @param \Magento\Framework\DataObject $obj * @return string */ public function getSearchUrl($obj) diff --git a/app/code/Magento/Search/Helper/Data.php b/app/code/Magento/Search/Helper/Data.php index 94b4208c75f..d1abd18d7d0 100644 --- a/app/code/Magento/Search/Helper/Data.php +++ b/app/code/Magento/Search/Helper/Data.php @@ -9,7 +9,7 @@ use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\Helper\AbstractHelper; use Magento\Framework\App\Helper\Context; use Magento\Framework\Escaper; -use Magento\Framework\Stdlib\String; +use Magento\Framework\Stdlib\StringUtils; use Magento\Store\Model\StoreManagerInterface; use Magento\Search\Model\Query as SearchQuery; use Magento\Search\Model\QueryFactory; @@ -87,7 +87,7 @@ class Data extends AbstractHelper */ public function __construct( Context $context, - String $string, + StringUtils $string, QueryFactory $queryFactory, Escaper $escaper, StoreManagerInterface $storeManager diff --git a/app/code/Magento/Search/Model/Autocomplete/Item.php b/app/code/Magento/Search/Model/Autocomplete/Item.php index 4c208a5f03d..77052c9518c 100644 --- a/app/code/Magento/Search/Model/Autocomplete/Item.php +++ b/app/code/Magento/Search/Model/Autocomplete/Item.php @@ -6,7 +6,7 @@ namespace Magento\Search\Model\Autocomplete; -class Item extends \Magento\Framework\Object implements ItemInterface +class Item extends \Magento\Framework\DataObject implements ItemInterface { /** * {@inheritdoc} diff --git a/app/code/Magento/Search/Model/QueryFactory.php b/app/code/Magento/Search/Model/QueryFactory.php index 6cad9f9de9b..7cafda6466c 100644 --- a/app/code/Magento/Search/Model/QueryFactory.php +++ b/app/code/Magento/Search/Model/QueryFactory.php @@ -8,7 +8,7 @@ namespace Magento\Search\Model; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\Helper\Context; use Magento\Framework\ObjectManagerInterface; -use Magento\Framework\Stdlib\String as StdlibString; +use Magento\Framework\Stdlib\StringUtils as StdlibString; use Magento\Store\Model\ScopeInterface; class QueryFactory implements QueryFactoryInterface diff --git a/app/code/Magento/Search/Test/Unit/Helper/DataTest.php b/app/code/Magento/Search/Test/Unit/Helper/DataTest.php index 21748333e41..f05858c8022 100644 --- a/app/code/Magento/Search/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/Search/Test/Unit/Helper/DataTest.php @@ -21,7 +21,7 @@ class DataTest extends \PHPUnit_Framework_TestCase protected $_contextMock; /** - * @var \Magento\Framework\Stdlib\String|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Stdlib\StringUtils|\PHPUnit_Framework_MockObject_MockObject */ protected $_stringMock; @@ -47,7 +47,7 @@ class DataTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->_stringMock = $this->getMock('Magento\Framework\Stdlib\String'); + $this->_stringMock = $this->getMock('Magento\Framework\Stdlib\StringUtils'); $this->_queryFactoryMock = $this->getMock('Magento\Search\Model\QueryFactory', [], [], '', false); $this->_scopeConfigMock = $this->getMock('Magento\Framework\App\Config\ScopeConfigInterface'); $this->_escaperMock = $this->getMock('Magento\Framework\Escaper'); diff --git a/app/code/Magento/Search/Test/Unit/Model/QueryFactoryTest.php b/app/code/Magento/Search/Test/Unit/Model/QueryFactoryTest.php index 0d678344222..2608fbae4b2 100644 --- a/app/code/Magento/Search/Test/Unit/Model/QueryFactoryTest.php +++ b/app/code/Magento/Search/Test/Unit/Model/QueryFactoryTest.php @@ -32,7 +32,7 @@ class QueryFactoryTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $objectManagerMock; - /** @var \Magento\Framework\Stdlib\String|\PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Framework\Stdlib\StringUtils|\PHPUnit_Framework_MockObject_MockObject */ protected $stringMock; /** @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ @@ -54,7 +54,7 @@ class QueryFactoryTest extends \PHPUnit_Framework_TestCase $this->objectManagerMock = $this->getMockBuilder('Magento\Framework\ObjectManagerInterface') ->setMethods([]) ->getMock(); - $this->stringMock = $this->getMockBuilder('Magento\Framework\Stdlib\String') + $this->stringMock = $this->getMockBuilder('Magento\Framework\Stdlib\StringUtils') ->setMethods(['cleanString', 'substr']) ->getMock(); $this->stringMock->expects($this->any()) diff --git a/app/code/Magento/SendFriend/Block/Send.php b/app/code/Magento/SendFriend/Block/Send.php index 00a9c1ba177..ed4336b872a 100644 --- a/app/code/Magento/SendFriend/Block/Send.php +++ b/app/code/Magento/SendFriend/Block/Send.php @@ -135,15 +135,15 @@ class Send extends \Magento\Framework\View\Element\Template } /** - * Retrieve Form data or empty \Magento\Framework\Object + * Retrieve Form data or empty \Magento\Framework\DataObject * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getFormData() { $data = $this->getData('form_data'); - if (!$data instanceof \Magento\Framework\Object) { - $data = new \Magento\Framework\Object(); + if (!$data instanceof \Magento\Framework\DataObject) { + $data = new \Magento\Framework\DataObject(); $this->setData('form_data', $data); } @@ -159,7 +159,7 @@ class Send extends \Magento\Framework\View\Element\Template public function setFormData($data) { if (is_array($data)) { - $this->setData('form_data', new \Magento\Framework\Object($data)); + $this->setData('form_data', new \Magento\Framework\DataObject($data)); } return $this; diff --git a/app/code/Magento/SendFriend/Model/SendFriend.php b/app/code/Magento/SendFriend/Model/SendFriend.php index a2152106c83..d1c5b82fe71 100644 --- a/app/code/Magento/SendFriend/Model/SendFriend.php +++ b/app/code/Magento/SendFriend/Model/SendFriend.php @@ -39,7 +39,7 @@ class SendFriend extends \Magento\Framework\Model\AbstractModel /** * Sender data array * - * @var \Magento\Framework\Object|array + * @var \Magento\Framework\DataObject|array */ protected $_sender = []; @@ -307,20 +307,20 @@ class SendFriend extends \Magento\Framework\Model\AbstractModel return $this->setData( '_recipients', - new \Magento\Framework\Object(['emails' => $emails, 'names' => $names]) + new \Magento\Framework\DataObject(['emails' => $emails, 'names' => $names]) ); } /** * Retrieve Recipients object * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getRecipients() { $recipients = $this->_getData('_recipients'); - if (!$recipients instanceof \Magento\Framework\Object) { - $recipients = new \Magento\Framework\Object(['emails' => [], 'names' => []]); + if (!$recipients instanceof \Magento\Framework\DataObject) { + $recipients = new \Magento\Framework\DataObject(['emails' => [], 'names' => []]); $this->setData('_recipients', $recipients); } return $recipients; @@ -364,19 +364,19 @@ class SendFriend extends \Magento\Framework\Model\AbstractModel __('Invalid Sender Information'); } - return $this->setData('_sender', new \Magento\Framework\Object($sender)); + return $this->setData('_sender', new \Magento\Framework\DataObject($sender)); } /** * Retrieve Sender Information Object * * @throws \Magento\Framework\Exception\LocalizedException - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getSender() { $sender = $this->_getData('_sender'); - if (!$sender instanceof \Magento\Framework\Object) { + if (!$sender instanceof \Magento\Framework\DataObject) { throw new \Magento\Framework\Exception\LocalizedException( __('Please define the correct sender information.') ); diff --git a/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging.php b/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging.php index 1a325851978..e1c268a1889 100644 --- a/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging.php +++ b/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging.php @@ -148,7 +148,7 @@ class Packaging extends \Magento\Backend\Block\Template $storeId ); if ($carrier) { - $params = new \Magento\Framework\Object( + $params = new \Magento\Framework\DataObject( [ 'method' => $order->getShippingMethod(true)->getMethod(), 'country_shipper' => $countryShipper, @@ -205,7 +205,7 @@ class Packaging extends \Magento\Backend\Block\Template $order = $this->getShipment()->getOrder(); $carrier = $this->_carrierFactory->create($order->getShippingMethod(true)->getCarrierCode()); if ($carrier) { - $params = new \Magento\Framework\Object(['country_recipient' => $countryId]); + $params = new \Magento\Framework\DataObject(['country_recipient' => $countryId]); $confirmationTypes = $carrier->getDeliveryConfirmationTypes($params); $confirmationType = !empty($confirmationTypes[$code]) ? $confirmationTypes[$code] : ''; return $confirmationType; @@ -243,7 +243,7 @@ class Packaging extends \Magento\Backend\Block\Template * * @param string $itemId * @param string $itemsOf - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getShipmentItem($itemId, $itemsOf) { @@ -257,7 +257,7 @@ class Packaging extends \Magento\Backend\Block\Template } } } - return new \Magento\Framework\Object(); + return new \Magento\Framework\DataObject(); } /** @@ -292,7 +292,7 @@ class Packaging extends \Magento\Backend\Block\Template $countryId = $this->getShipment()->getOrder()->getShippingAddress()->getCountryId(); $order = $this->getShipment()->getOrder(); $carrier = $this->_carrierFactory->create($order->getShippingMethod(true)->getCarrierCode()); - $params = new \Magento\Framework\Object(['country_recipient' => $countryId]); + $params = new \Magento\Framework\DataObject(['country_recipient' => $countryId]); if ($carrier && is_array($carrier->getDeliveryConfirmationTypes($params))) { return $carrier->getDeliveryConfirmationTypes($params); } @@ -354,7 +354,7 @@ class Packaging extends \Magento\Backend\Block\Template $storeId ); if ($carrier) { - $params = new \Magento\Framework\Object( + $params = new \Magento\Framework\DataObject( [ 'method' => $order->getShippingMethod(true)->getMethod(), 'country_shipper' => $countryShipper, diff --git a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/CreateLabel.php b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/CreateLabel.php index 934123f5fb0..facbc5192d7 100644 --- a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/CreateLabel.php +++ b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/CreateLabel.php @@ -50,7 +50,7 @@ class CreateLabel extends \Magento\Backend\App\Action */ public function execute() { - $response = new \Magento\Framework\Object(); + $response = new \Magento\Framework\DataObject(); try { $this->shipmentLoader->setOrderId($this->getRequest()->getParam('order_id')); $this->shipmentLoader->setShipmentId($this->getRequest()->getParam('shipment_id')); diff --git a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Save.php b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Save.php index c187d9bb21b..ec2d611f3b7 100644 --- a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Save.php +++ b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Save.php @@ -114,7 +114,7 @@ class Save extends \Magento\Backend\App\Action $shipment->register(); $shipment->getOrder()->setCustomerNoteNotify(!empty($data['send_email'])); - $responseAjax = new \Magento\Framework\Object(); + $responseAjax = new \Magento\Framework\DataObject(); $isNeedCreateLabel = isset($data['create_shipping_label']) && $data['create_shipping_label']; if ($isNeedCreateLabel) { diff --git a/app/code/Magento/Shipping/Controller/Adminhtml/Order/ShipmentLoader.php b/app/code/Magento/Shipping/Controller/Adminhtml/Order/ShipmentLoader.php index 6fc5b8b308a..52cd9c81760 100644 --- a/app/code/Magento/Shipping/Controller/Adminhtml/Order/ShipmentLoader.php +++ b/app/code/Magento/Shipping/Controller/Adminhtml/Order/ShipmentLoader.php @@ -6,7 +6,7 @@ */ namespace Magento\Shipping\Controller\Adminhtml\Order; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Class ShipmentLoader @@ -21,7 +21,7 @@ use Magento\Framework\Object; * @method array getShipment * @method array getTracking */ -class ShipmentLoader extends Object +class ShipmentLoader extends DataObject { /** * @var \Magento\Framework\Message\ManagerInterface diff --git a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php index 04e8bc658ad..c803695d08c 100644 --- a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php +++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php @@ -14,7 +14,7 @@ use Magento\Shipping\Model\Shipment\Request; /** * Class AbstractCarrier */ -abstract class AbstractCarrier extends \Magento\Framework\Object implements AbstractCarrierInterface +abstract class AbstractCarrier extends \Magento\Framework\DataObject implements AbstractCarrierInterface { /** * Carrier's code @@ -157,23 +157,23 @@ abstract class AbstractCarrier extends \Magento\Framework\Object implements Abst /** * Collect and get rates * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return \Magento\Shipping\Model\Rate\Result|bool|null * @abstract */ - abstract public function collectRates(\Magento\Framework\Object $request); + abstract public function collectRates(\Magento\Framework\DataObject $request); /** * Do request to shipment * Implementation must be in overridden method * * @param Request $request - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function requestToShipment($request) { - return new \Magento\Framework\Object(); + return new \Magento\Framework\DataObject(); } /** @@ -181,22 +181,22 @@ abstract class AbstractCarrier extends \Magento\Framework\Object implements Abst * Implementation must be in overridden method * * @param Request $request - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function returnOfShipment($request) { - return new \Magento\Framework\Object(); + return new \Magento\Framework\DataObject(); } /** * Return container types of carrier * - * @param \Magento\Framework\Object|null $params + * @param \Magento\Framework\DataObject|null $params * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function getContainerTypes(\Magento\Framework\Object $params = null) + public function getContainerTypes(\Magento\Framework\DataObject $params = null) { return []; } @@ -204,12 +204,12 @@ abstract class AbstractCarrier extends \Magento\Framework\Object implements Abst /** * Get allowed containers of carrier * - * @param \Magento\Framework\Object|null $params + * @param \Magento\Framework\DataObject|null $params * @return array|bool * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - protected function _getAllowedContainers(\Magento\Framework\Object $params = null) + protected function _getAllowedContainers(\Magento\Framework\DataObject $params = null) { $containersAll = $this->getContainerTypesAll(); if (empty($containersAll)) { @@ -269,21 +269,21 @@ abstract class AbstractCarrier extends \Magento\Framework\Object implements Abst /** * Return delivery confirmation types of carrier * - * @param \Magento\Framework\Object|null $params + * @param \Magento\Framework\DataObject|null $params * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function getDeliveryConfirmationTypes(\Magento\Framework\Object $params = null) + public function getDeliveryConfirmationTypes(\Magento\Framework\DataObject $params = null) { return []; } /** - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return $this|bool|false|\Magento\Framework\Model\AbstractModel * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - public function checkAvailableShipCountries(\Magento\Framework\Object $request) + public function checkAvailableShipCountries(\Magento\Framework\DataObject $request) { $speCountriesAllow = $this->getConfigData('sallowspecific'); /* @@ -326,11 +326,11 @@ abstract class AbstractCarrier extends \Magento\Framework\Object implements Abst /** * Processing additional validation to check is carrier applicable. * - * @param \Magento\Framework\Object $request - * @return $this|bool|\Magento\Framework\Object + * @param \Magento\Framework\DataObject $request + * @return $this|bool|\Magento\Framework\DataObject * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function proccessAdditionalValidation(\Magento\Framework\Object $request) + public function proccessAdditionalValidation(\Magento\Framework\DataObject $request) { return $this; } @@ -627,11 +627,11 @@ abstract class AbstractCarrier extends \Magento\Framework\Object implements Abst /** * Return content types of package * - * @param \Magento\Framework\Object $params + * @param \Magento\Framework\DataObject $params * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function getContentTypes(\Magento\Framework\Object $params) + public function getContentTypes(\Magento\Framework\DataObject $params) { return []; } diff --git a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierInterface.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierInterface.php index a8a9f2f747c..22346c35967 100644 --- a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierInterface.php +++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierInterface.php @@ -22,18 +22,18 @@ interface AbstractCarrierInterface /** * Collect and get rates * - * @param \Magento\Framework\Object $request - * @return \Magento\Framework\Object|bool|null + * @param \Magento\Framework\DataObject $request + * @return \Magento\Framework\DataObject|bool|null * @api */ - public function collectRates(\Magento\Framework\Object $request); + public function collectRates(\Magento\Framework\DataObject $request); /** * Do request to shipment * Implementation must be in overridden method * - * @param \Magento\Framework\Object $request - * @return \Magento\Framework\Object + * @param \Magento\Framework\DataObject $request + * @return \Magento\Framework\DataObject * @api */ public function requestToShipment($request); @@ -42,8 +42,8 @@ interface AbstractCarrierInterface * Do return of shipment * Implementation must be in overridden method * - * @param \Magento\Framework\Object $request - * @return \Magento\Framework\Object + * @param \Magento\Framework\DataObject $request + * @return \Magento\Framework\DataObject * @api */ public function returnOfShipment($request); @@ -51,11 +51,11 @@ interface AbstractCarrierInterface /** * Return container types of carrier * - * @param \Magento\Framework\Object|null $params + * @param \Magento\Framework\DataObject|null $params * @return array * @api */ - public function getContainerTypes(\Magento\Framework\Object $params = null); + public function getContainerTypes(\Magento\Framework\DataObject $params = null); /** * Get Container Types, that could be customized @@ -68,27 +68,27 @@ interface AbstractCarrierInterface /** * Return delivery confirmation types of carrier * - * @param \Magento\Framework\Object|null $params + * @param \Magento\Framework\DataObject|null $params * @return array * @api */ - public function getDeliveryConfirmationTypes(\Magento\Framework\Object $params = null); + public function getDeliveryConfirmationTypes(\Magento\Framework\DataObject $params = null); /** - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return $this|bool|false|\Magento\Framework\Model\AbstractModel * @api */ - public function checkAvailableShipCountries(\Magento\Framework\Object $request); + public function checkAvailableShipCountries(\Magento\Framework\DataObject $request); /** * Processing additional validation to check is carrier applicable. * - * @param \Magento\Framework\Object $request - * @return $this|\Magento\Framework\Object|boolean + * @param \Magento\Framework\DataObject $request + * @return $this|\Magento\Framework\DataObject|boolean * @api */ - public function proccessAdditionalValidation(\Magento\Framework\Object $request); + public function proccessAdditionalValidation(\Magento\Framework\DataObject $request); /** * Determine whether current carrier enabled for activity @@ -202,9 +202,9 @@ interface AbstractCarrierInterface /** * Return content types of package * - * @param \Magento\Framework\Object $params + * @param \Magento\Framework\DataObject $params * @return array * @api */ - public function getContentTypes(\Magento\Framework\Object $params); + public function getContentTypes(\Magento\Framework\DataObject $params); } diff --git a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php index 047130de3ec..d4d448e7fa5 100644 --- a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php +++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php @@ -99,7 +99,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier /** * Raw rate request data * - * @var \Magento\Framework\Object|null + * @var \Magento\Framework\DataObject|null */ protected $_rawRequest = null; @@ -293,12 +293,12 @@ abstract class AbstractCarrierOnline extends AbstractCarrier /** * Processing additional validation to check if carrier applicable. * - * @param \Magento\Framework\Object $request - * @return $this|bool|\Magento\Framework\Object + * @param \Magento\Framework\DataObject $request + * @return $this|bool|\Magento\Framework\DataObject * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - public function proccessAdditionalValidation(\Magento\Framework\Object $request) + public function proccessAdditionalValidation(\Magento\Framework\DataObject $request) { //Skip by item validation if there is no items in request if (!count($this->getAllItems($request))) { @@ -419,10 +419,10 @@ abstract class AbstractCarrierOnline extends AbstractCarrier * Prepare shipment request. * Validate and correct request information * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return void */ - protected function _prepareShipmentRequest(\Magento\Framework\Object $request) + protected function _prepareShipmentRequest(\Magento\Framework\DataObject $request) { $phonePattern = '/[\s\_\-\(\)]+/'; $phoneNumber = $request->getShipperContactPhoneNumber(); @@ -437,7 +437,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier * Do request to shipment * * @param Request $request - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject * @throws \Magento\Framework\Exception\LocalizedException */ public function requestToShipment($request) @@ -454,7 +454,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier $request->setPackageId($packageId); $request->setPackagingType($package['params']['container']); $request->setPackageWeight($package['params']['weight']); - $request->setPackageParams(new \Magento\Framework\Object($package['params'])); + $request->setPackageParams(new \Magento\Framework\DataObject($package['params'])); $request->setPackageItems($package['items']); $result = $this->_doShipmentRequest($request); @@ -473,7 +473,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier } } - $response = new \Magento\Framework\Object(['info' => $data]); + $response = new \Magento\Framework\DataObject(['info' => $data]); if ($result->getErrors()) { $response->setErrors($result->getErrors()); } @@ -484,7 +484,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier * Do request to RMA shipment * * @param Request $request - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject * @throws \Magento\Framework\Exception\LocalizedException */ public function returnOfShipment($request) @@ -502,7 +502,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier $request->setPackageId($packageId); $request->setPackagingType($package['params']['container']); $request->setPackageWeight($package['params']['weight']); - $request->setPackageParams(new \Magento\Framework\Object($package['params'])); + $request->setPackageParams(new \Magento\Framework\DataObject($package['params'])); $request->setPackageItems($package['items']); $result = $this->_doShipmentRequest($request); @@ -521,7 +521,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier } } - $response = new \Magento\Framework\Object(['info' => $data]); + $response = new \Magento\Framework\DataObject(['info' => $data]); if ($result->getErrors()) { $response->setErrors($result->getErrors()); } @@ -547,10 +547,10 @@ abstract class AbstractCarrierOnline extends AbstractCarrier /** * Do shipment request to carrier web service, obtain Print Shipping Labels and process errors in response * - * @param \Magento\Framework\Object $request - * @return \Magento\Framework\Object + * @param \Magento\Framework\DataObject $request + * @return \Magento\Framework\DataObject */ - abstract protected function _doShipmentRequest(\Magento\Framework\Object $request); + abstract protected function _doShipmentRequest(\Magento\Framework\DataObject $request); /** * Check is Country U.S. Possessions and Trust Territories @@ -595,7 +595,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier } /** - * @param \Magento\Framework\Object|null $request + * @param \Magento\Framework\DataObject|null $request * @return $this * @api */ diff --git a/app/code/Magento/Shipping/Model/Config.php b/app/code/Magento/Shipping/Model/Config.php index c5ac94f1ef5..8194e65e803 100644 --- a/app/code/Magento/Shipping/Model/Config.php +++ b/app/code/Magento/Shipping/Model/Config.php @@ -8,7 +8,7 @@ namespace Magento\Shipping\Model; -class Config extends \Magento\Framework\Object +class Config extends \Magento\Framework\DataObject { /** * Shipping origin settings diff --git a/app/code/Magento/Shipping/Model/Info.php b/app/code/Magento/Shipping/Model/Info.php index c455c59d91e..ac9fdd69202 100644 --- a/app/code/Magento/Shipping/Model/Info.php +++ b/app/code/Magento/Shipping/Model/Info.php @@ -10,7 +10,7 @@ namespace Magento\Shipping\Model; use Magento\Sales\Model\Order\Shipment; -class Info extends \Magento\Framework\Object +class Info extends \Magento\Framework\DataObject { /** * Tracking info diff --git a/app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php b/app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php index 0be28fa810b..f71f7b1ebb1 100644 --- a/app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php +++ b/app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php @@ -36,7 +36,7 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf /** * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\Filesystem $filesystem * @param \Magento\Sales\Model\Order\Pdf\Config $pdfConfig @@ -55,7 +55,7 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf */ public function __construct( \Magento\Payment\Helper\Data $paymentData, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\Filesystem $filesystem, \Magento\Sales\Model\Order\Pdf\Config $pdfConfig, @@ -177,8 +177,8 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf $page->drawText($packageText, 525, $this->y, 'UTF-8'); $packageNum++; - $package = new \Magento\Framework\Object($package); - $params = new \Magento\Framework\Object($package->getParams()); + $package = new \Magento\Framework\DataObject($package); + $params = new \Magento\Framework\DataObject($package->getParams()); $dimensionUnits = $this->_carrierHelper->getMeasureDimensionName($params->getDimensionUnits()); $typeText = __('Type') . ' : ' . $packaging->getContainerTypeByCode($params->getContainer()); @@ -299,7 +299,7 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf $i = 0; foreach ($package->getItems() as $itemId => $item) { - $item = new \Magento\Framework\Object($item); + $item = new \Magento\Framework\DataObject($item); $i = 0; $page->setFillColor(new \Zend_Pdf_Color_GrayScale(1)); diff --git a/app/code/Magento/Shipping/Model/Shipment/Request.php b/app/code/Magento/Shipping/Model/Shipment/Request.php index 0dc2e390935..9d489dbf9df 100644 --- a/app/code/Magento/Shipping/Model/Shipment/Request.php +++ b/app/code/Magento/Shipping/Model/Shipment/Request.php @@ -63,6 +63,6 @@ namespace Magento\Shipping\Model\Shipment; * * @author Magento Core Team <core@magentocommerce.com> */ -class Request extends \Magento\Framework\Object +class Request extends \Magento\Framework\DataObject { } diff --git a/app/code/Magento/Shipping/Model/Shipment/ReturnShipment.php b/app/code/Magento/Shipping/Model/Shipment/ReturnShipment.php index 7a9e55c9ebb..52d7cea5efc 100644 --- a/app/code/Magento/Shipping/Model/Shipment/ReturnShipment.php +++ b/app/code/Magento/Shipping/Model/Shipment/ReturnShipment.php @@ -63,6 +63,6 @@ namespace Magento\Shipping\Model\Shipment; * * @author Magento Core Team <core@magentocommerce.com> */ -class ReturnShipment extends \Magento\Framework\Object +class ReturnShipment extends \Magento\Framework\DataObject { } diff --git a/app/code/Magento/Shipping/Model/Shipping.php b/app/code/Magento/Shipping/Model/Shipping.php index bcb067aba82..b5dea329ca1 100644 --- a/app/code/Magento/Shipping/Model/Shipping.php +++ b/app/code/Magento/Shipping/Model/Shipping.php @@ -456,11 +456,11 @@ class Shipping implements RateCollectorInterface /** * Collect rates by address * - * @param \Magento\Framework\Object $address + * @param \Magento\Framework\DataObject $address * @param null|bool|array $limitCarrier * @return $this */ - public function collectRatesByAddress(\Magento\Framework\Object $address, $limitCarrier = null) + public function collectRatesByAddress(\Magento\Framework\DataObject $address, $limitCarrier = null) { /** @var $request \Magento\Quote\Model\Quote\Address\RateRequest */ $request = $this->_shipmentRequestFactory->create(); diff --git a/app/code/Magento/Shipping/Model/Shipping/Labels.php b/app/code/Magento/Shipping/Model/Shipping/Labels.php index 41a04928dcf..37cb4b6715a 100644 --- a/app/code/Magento/Shipping/Model/Shipping/Labels.php +++ b/app/code/Magento/Shipping/Model/Shipping/Labels.php @@ -72,7 +72,7 @@ class Labels extends \Magento\Shipping\Model\Shipping * Prepare and do request to shipment * * @param Shipment $orderShipment - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) @@ -112,7 +112,7 @@ class Labels extends \Magento\Shipping\Model\Shipping \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $shipmentStoreId ); - $storeInfo = new \Magento\Framework\Object( + $storeInfo = new \Magento\Framework\DataObject( (array)$this->_scopeConfig->getValue( 'general/store_information', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, diff --git a/app/code/Magento/Shipping/Model/Tracking/Result/AbstractResult.php b/app/code/Magento/Shipping/Model/Tracking/Result/AbstractResult.php index c712060c720..6c80d311a3a 100644 --- a/app/code/Magento/Shipping/Model/Tracking/Result/AbstractResult.php +++ b/app/code/Magento/Shipping/Model/Tracking/Result/AbstractResult.php @@ -5,6 +5,6 @@ */ namespace Magento\Shipping\Model\Tracking\Result; -class AbstractResult extends \Magento\Framework\Object +class AbstractResult extends \Magento\Framework\DataObject { } diff --git a/app/code/Magento/Shipping/Test/Unit/Block/Adminhtml/Order/TrackingTest.php b/app/code/Magento/Shipping/Test/Unit/Block/Adminhtml/Order/TrackingTest.php index 3edaa99596b..d079f1bf1db 100644 --- a/app/code/Magento/Shipping/Test/Unit/Block/Adminhtml/Order/TrackingTest.php +++ b/app/code/Magento/Shipping/Test/Unit/Block/Adminhtml/Order/TrackingTest.php @@ -11,7 +11,7 @@ class TrackingTest extends \PHPUnit_Framework_TestCase { $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $shipment = new \Magento\Framework\Object(['store_id' => 1]); + $shipment = new \Magento\Framework\DataObject(['store_id' => 1]); $registry = $this->getMock('Magento\Framework\Registry', ['registry'], [], '', false); $registry->expects( diff --git a/app/code/Magento/Shipping/Test/Unit/Controller/Adminhtml/Order/Shipment/NewActionTest.php b/app/code/Magento/Shipping/Test/Unit/Controller/Adminhtml/Order/Shipment/NewActionTest.php index cb48b51d07f..df9cc23823b 100644 --- a/app/code/Magento/Shipping/Test/Unit/Controller/Adminhtml/Order/Shipment/NewActionTest.php +++ b/app/code/Magento/Shipping/Test/Unit/Controller/Adminhtml/Order/Shipment/NewActionTest.php @@ -260,9 +260,9 @@ class NewActionTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor()->getMock(); $itemId = 'Magento_Sales::sales_order'; $parents = [ - new \Magento\Framework\Object(['title' => 'title1']), - new \Magento\Framework\Object(['title' => 'title2']), - new \Magento\Framework\Object(['title' => 'title3']), + new \Magento\Framework\DataObject(['title' => 'title1']), + new \Magento\Framework\DataObject(['title' => 'title2']), + new \Magento\Framework\DataObject(['title' => 'title3']), ]; $menuModel->expects($this->once()) ->method('getParentItems') diff --git a/app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/packed.phtml b/app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/packed.phtml index 595ec01356a..a910c139b04 100644 --- a/app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/packed.phtml +++ b/app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/packed.phtml @@ -17,8 +17,8 @@ <div class="popup-window-content"> <?php foreach ($block->getPackages() as $packageId => $package): ?> <div class="package"> - <?php $package = new \Magento\Framework\Object($package) ?> - <?php $params = new \Magento\Framework\Object($package->getParams()) ?> + <?php $package = new \Magento\Framework\DataObject($package) ?> + <?php $params = new \Magento\Framework\DataObject($package->getParams()) ?> <div class="package-number popup-fieldset-title"> <div class="title"><?php echo __('Package') . ' ' . $packageId ?></div> </div> @@ -130,7 +130,7 @@ </thead> <tbody id=""> <?php foreach ($package->getItems() as $itemId => $item) : ?> - <?php $item = new \Magento\Framework\Object($item) ?> + <?php $item = new \Magento\Framework\DataObject($item) ?> <tr title="#" id="" class=""> <td class="col-product name"> <?php echo $item->getName(); ?> diff --git a/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Action.php b/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Action.php index 6c05cb3c6c8..635332fbca2 100644 --- a/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Action.php +++ b/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Action.php @@ -11,10 +11,10 @@ namespace Magento\Sitemap\Block\Adminhtml\Grid\Renderer; class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Action { /** - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $this->getColumn()->setActions( [ diff --git a/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Link.php b/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Link.php index d7516b2c18b..a49993dbefd 100644 --- a/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Link.php +++ b/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Link.php @@ -44,10 +44,10 @@ class Link extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRe /** * Prepare link to display in grid * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { /** @var $sitemap \Magento\Sitemap\Model\Sitemap */ $sitemap = $this->_sitemapFactory->create(); diff --git a/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Time.php b/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Time.php index a099b13a912..6bcc8b32d19 100644 --- a/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Time.php +++ b/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Time.php @@ -34,10 +34,10 @@ class Time extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRe /** * Prepare link to display in grid * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function render(\Magento\Framework\Object $row) + public function render(\Magento\Framework\DataObject $row) { $time = date('Y-m-d H:i:s', strtotime($row->getSitemapTime()) + $this->_date->getGmtOffset()); return $time; diff --git a/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php b/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php index 3dacd9647d8..fff42fee1a9 100644 --- a/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php +++ b/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php @@ -123,11 +123,11 @@ class Category extends \Magento\Framework\Model\Resource\Db\AbstractDb * Prepare category * * @param array $categoryRow - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function _prepareCategory(array $categoryRow) { - $category = new \Magento\Framework\Object(); + $category = new \Magento\Framework\DataObject(); $category->setId($categoryRow[$this->getIdFieldName()]); $categoryUrl = !empty($categoryRow['url']) ? $categoryRow['url'] : 'catalog/category/view/id/' . $category->getId(); diff --git a/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php b/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php index 48d90a540c9..471ac44f392 100644 --- a/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php +++ b/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php @@ -320,11 +320,11 @@ class Product extends \Magento\Framework\Model\Resource\Db\AbstractDb * * @param array $productRow * @param int $storeId - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function _prepareProduct(array $productRow, $storeId) { - $product = new \Magento\Framework\Object(); + $product = new \Magento\Framework\DataObject(); $product['id'] = $productRow[$this->getIdFieldName()]; if (empty($productRow['url'])) { @@ -339,7 +339,7 @@ class Product extends \Magento\Framework\Model\Resource\Db\AbstractDb /** * Load product images * - * @param \Magento\Framework\Object $product + * @param \Magento\Framework\DataObject $product * @param int $storeId * @return void */ @@ -358,7 +358,7 @@ class Product extends \Magento\Framework\Model\Resource\Db\AbstractDb $product->getImage() != self::NOT_SELECTED_IMAGE ) { $imagesCollection = [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( ['url' => $this->_getMediaConfig()->getBaseMediaUrlAddition() . $product->getImage()] ), ]; @@ -374,7 +374,7 @@ class Product extends \Magento\Framework\Model\Resource\Db\AbstractDb } $product->setImages( - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( ['collection' => $imagesCollection, 'title' => $product->getName(), 'thumbnail' => $thumbnail] ) ); @@ -384,7 +384,7 @@ class Product extends \Magento\Framework\Model\Resource\Db\AbstractDb /** * Get all product images * - * @param \Magento\Framework\Object $product + * @param \Magento\Framework\DataObject $product * @param int $storeId * @return array */ @@ -397,7 +397,7 @@ class Product extends \Magento\Framework\Model\Resource\Db\AbstractDb if ($gallery) { $productMediaPath = $this->_getMediaConfig()->getBaseMediaUrlAddition(); foreach ($gallery as $image) { - $imagesCollection[] = new \Magento\Framework\Object( + $imagesCollection[] = new \Magento\Framework\DataObject( [ 'url' => $productMediaPath . $image['file'], 'caption' => $image['label'] ? $image['label'] : $image['label_default'], diff --git a/app/code/Magento/Sitemap/Model/Resource/Cms/Page.php b/app/code/Magento/Sitemap/Model/Resource/Cms/Page.php index 31db6386097..bf8e9afb69b 100644 --- a/app/code/Magento/Sitemap/Model/Resource/Cms/Page.php +++ b/app/code/Magento/Sitemap/Model/Resource/Cms/Page.php @@ -62,11 +62,11 @@ class Page extends \Magento\Framework\Model\Resource\Db\AbstractDb * Prepare page object * * @param array $data - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function _prepareObject(array $data) { - $object = new \Magento\Framework\Object(); + $object = new \Magento\Framework\DataObject(); $object->setId($data[$this->getIdFieldName()]); $object->setUrl($data['url']); $object->setUpdatedAt($data['updated_at']); diff --git a/app/code/Magento/Sitemap/Model/Sitemap.php b/app/code/Magento/Sitemap/Model/Sitemap.php index 165f9dd2020..841e232dd0b 100644 --- a/app/code/Magento/Sitemap/Model/Sitemap.php +++ b/app/code/Magento/Sitemap/Model/Sitemap.php @@ -230,7 +230,7 @@ class Sitemap extends \Magento\Framework\Model\AbstractModel $helper = $this->_sitemapData; $storeId = $this->getStoreId(); - $this->_sitemapItems[] = new \Magento\Framework\Object( + $this->_sitemapItems[] = new \Magento\Framework\DataObject( [ 'changefreq' => $helper->getCategoryChangefreq($storeId), 'priority' => $helper->getCategoryPriority($storeId), @@ -238,7 +238,7 @@ class Sitemap extends \Magento\Framework\Model\AbstractModel ] ); - $this->_sitemapItems[] = new \Magento\Framework\Object( + $this->_sitemapItems[] = new \Magento\Framework\DataObject( [ 'changefreq' => $helper->getProductChangefreq($storeId), 'priority' => $helper->getProductPriority($storeId), @@ -246,7 +246,7 @@ class Sitemap extends \Magento\Framework\Model\AbstractModel ] ); - $this->_sitemapItems[] = new \Magento\Framework\Object( + $this->_sitemapItems[] = new \Magento\Framework\DataObject( [ 'changefreq' => $helper->getPageChangefreq($storeId), 'priority' => $helper->getPagePriority($storeId), @@ -336,7 +336,7 @@ class Sitemap extends \Magento\Framework\Model\AbstractModel public function generateXml() { $this->_initSitemapItems(); - /** @var $sitemapItem \Magento\Framework\Object */ + /** @var $sitemapItem \Magento\Framework\DataObject */ foreach ($this->_sitemapItems as $sitemapItem) { $changefreq = $sitemapItem->getChangefreq(); $priority = $sitemapItem->getPriority(); diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php index 08f35e314b6..449516d07be 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php @@ -508,10 +508,10 @@ class SitemapTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValue( [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( ['url' => 'category.html', 'updated_at' => '2012-12-21 00:00:00'] ), - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( ['url' => '/category/sub-category.html', 'updated_at' => '2012-12-21 00:00:00'] ), ] @@ -524,20 +524,20 @@ class SitemapTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValue( [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( ['url' => 'product.html', 'updated_at' => '2012-12-21 00:00:00'] ), - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'url' => 'product2.html', 'updated_at' => '2012-12-21 00:00:00', - 'images' => new \Magento\Framework\Object( + 'images' => new \Magento\Framework\DataObject( [ 'collection' => [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( ['url' => 'image1.png', 'caption' => 'caption & > title < "'] ), - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( ['url' => 'image_no_caption.png', 'caption' => null] ), ], diff --git a/app/code/Magento/Store/Model/App/Emulation.php b/app/code/Magento/Store/Model/App/Emulation.php index 46bead4ce7a..5cec0ea2b30 100644 --- a/app/code/Magento/Store/Model/App/Emulation.php +++ b/app/code/Magento/Store/Model/App/Emulation.php @@ -13,7 +13,7 @@ namespace Magento\Store\Model\App; use Magento\Framework\Translate\Inline\ConfigInterface; -class Emulation extends \Magento\Framework\Object +class Emulation extends \Magento\Framework\DataObject { /** * @var \Magento\Store\Model\StoreManagerInterface @@ -55,7 +55,7 @@ class Emulation extends \Magento\Framework\Object /** * Ini * - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ private $initialEnvironmentInfo; @@ -188,7 +188,7 @@ class Emulation extends \Magento\Framework\Object */ public function storeCurrentEnvironmentInfo() { - $this->initialEnvironmentInfo = new \Magento\Framework\Object(); + $this->initialEnvironmentInfo = new \Magento\Framework\DataObject(); $this->initialEnvironmentInfo->setInitialTranslateInline( $this->inlineTranslation->isEnabled() )->setInitialDesign( diff --git a/app/code/Magento/Store/Model/Group.php b/app/code/Magento/Store/Model/Group.php index 232f9b7bb65..a146058009c 100644 --- a/app/code/Magento/Store/Model/Group.php +++ b/app/code/Magento/Store/Model/Group.php @@ -18,7 +18,7 @@ namespace Magento\Store\Model; -class Group extends \Magento\Framework\Model\AbstractModel implements \Magento\Framework\Object\IdentityInterface +class Group extends \Magento\Framework\Model\AbstractModel implements \Magento\Framework\DataObject\IdentityInterface { const ENTITY = 'store_group'; diff --git a/app/code/Magento/Store/Model/Store.php b/app/code/Magento/Store/Model/Store.php index e206f2b22d9..9af534589b5 100644 --- a/app/code/Magento/Store/Model/Store.php +++ b/app/code/Magento/Store/Model/Store.php @@ -30,7 +30,7 @@ use Magento\Store\Model\StoreManagerInterface; class Store extends AbstractModel implements \Magento\Framework\App\ScopeInterface, \Magento\Framework\Url\ScopeInterface, - \Magento\Framework\Object\IdentityInterface + \Magento\Framework\DataObject\IdentityInterface { /** * Entity name @@ -427,7 +427,7 @@ class Store extends AbstractModel implements */ protected function _getValidationRulesBeforeSave() { - $validator = new \Magento\Framework\Validator\Object(); + $validator = new \Magento\Framework\Validator\DataObject(); $storeLabelRule = new \Zend_Validate_NotEmpty(); $storeLabelRule->setMessage(__('Name is required'), \Zend_Validate_NotEmpty::IS_EMPTY); diff --git a/app/code/Magento/Store/Model/System/Store.php b/app/code/Magento/Store/Model/System/Store.php index c3382ce1968..15452e7093e 100644 --- a/app/code/Magento/Store/Model/System/Store.php +++ b/app/code/Magento/Store/Model/System/Store.php @@ -10,7 +10,7 @@ use Magento\Framework\Data\OptionSourceInterface; /** * Core System Store Model */ -class Store extends \Magento\Framework\Object implements OptionSourceInterface +class Store extends \Magento\Framework\DataObject implements OptionSourceInterface { /** * Website collection diff --git a/app/code/Magento/Store/Model/Website.php b/app/code/Magento/Store/Model/Website.php index ec75da1a5b5..6bf4cd3f3f9 100644 --- a/app/code/Magento/Store/Model/Website.php +++ b/app/code/Magento/Store/Model/Website.php @@ -30,7 +30,7 @@ use Magento\Store\Model\StoreManagerInterface; * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Website extends \Magento\Framework\Model\AbstractModel implements - \Magento\Framework\Object\IdentityInterface, + \Magento\Framework\DataObject\IdentityInterface, \Magento\Framework\App\ScopeInterface { const ENTITY = 'store_website'; diff --git a/app/code/Magento/Store/Test/Unit/Model/Config/Reader/DefaultReaderTest.php b/app/code/Magento/Store/Test/Unit/Model/Config/Reader/DefaultReaderTest.php index 25875ae67dd..60abe2b3b92 100644 --- a/app/code/Magento/Store/Test/Unit/Model/Config/Reader/DefaultReaderTest.php +++ b/app/code/Magento/Store/Test/Unit/Model/Config/Reader/DefaultReaderTest.php @@ -61,8 +61,8 @@ class DefaultReaderTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValue( [ - new \Magento\Framework\Object(['path' => 'config/key1', 'value' => 'default_db_value1']), - new \Magento\Framework\Object(['path' => 'config/key3', 'value' => 'default_db_value3']), + new \Magento\Framework\DataObject(['path' => 'config/key1', 'value' => 'default_db_value1']), + new \Magento\Framework\DataObject(['path' => 'config/key3', 'value' => 'default_db_value3']), ] ) ); diff --git a/app/code/Magento/Store/Test/Unit/Model/Config/Reader/StoreTest.php b/app/code/Magento/Store/Test/Unit/Model/Config/Reader/StoreTest.php index 5efea71aeb2..6f116452d51 100644 --- a/app/code/Magento/Store/Test/Unit/Model/Config/Reader/StoreTest.php +++ b/app/code/Magento/Store/Test/Unit/Model/Config/Reader/StoreTest.php @@ -6,7 +6,7 @@ namespace Magento\Store\Test\Unit\Model\Config\Reader; use Magento\Framework\App\Config\ScopeConfigInterface; -use Magento\Framework\Object; +use Magento\Framework\DataObject; class StoreTest extends \PHPUnit_Framework_TestCase { @@ -123,8 +123,8 @@ class StoreTest extends \PHPUnit_Framework_TestCase ->with(['scope' => 'stores', 'scopeId' => $storeId]) ->will($this->returnValue( [ - new Object(['path' => 'config/key1', 'value' => 'store_db_value1']), - new Object(['path' => 'config/key3', 'value' => 'store_db_value3']), + new DataObject(['path' => 'config/key1', 'value' => 'store_db_value1']), + new DataObject(['path' => 'config/key3', 'value' => 'store_db_value3']), ] )); diff --git a/app/code/Magento/Store/Test/Unit/Model/Config/Reader/WebsiteTest.php b/app/code/Magento/Store/Test/Unit/Model/Config/Reader/WebsiteTest.php index 6e42675533c..2b2ec4f7193 100644 --- a/app/code/Magento/Store/Test/Unit/Model/Config/Reader/WebsiteTest.php +++ b/app/code/Magento/Store/Test/Unit/Model/Config/Reader/WebsiteTest.php @@ -113,8 +113,8 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValue( [ - new \Magento\Framework\Object(['path' => 'config/key1', 'value' => 'website_db_value1']), - new \Magento\Framework\Object(['path' => 'config/key3', 'value' => 'website_db_value3']), + new \Magento\Framework\DataObject(['path' => 'config/key1', 'value' => 'website_db_value1']), + new \Magento\Framework\DataObject(['path' => 'config/key3', 'value' => 'website_db_value3']), ] ) ); diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rate/Grid/Renderer/Data.php b/app/code/Magento/Tax/Block/Adminhtml/Rate/Grid/Renderer/Data.php index c0185573815..cf2a4a5f308 100644 --- a/app/code/Magento/Tax/Block/Adminhtml/Rate/Grid/Renderer/Data.php +++ b/app/code/Magento/Tax/Block/Adminhtml/Rate/Grid/Renderer/Data.php @@ -14,10 +14,10 @@ namespace Magento\Tax\Block\Adminhtml\Rate\Grid\Renderer; class Data extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { /** - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return int|string */ - protected function _getValue(\Magento\Framework\Object $row) + protected function _getValue(\Magento\Framework\DataObject $row) { $data = parent::_getValue($row); if (intval($data) == $data) { diff --git a/app/code/Magento/Tax/Block/Sales/Order/Tax.php b/app/code/Magento/Tax/Block/Sales/Order/Tax.php index 6bf91735a92..3376d551d7b 100644 --- a/app/code/Magento/Tax/Block/Sales/Order/Tax.php +++ b/app/code/Magento/Tax/Block/Sales/Order/Tax.php @@ -26,7 +26,7 @@ class Tax extends \Magento\Framework\View\Element\Template protected $_order; /** - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $_source; @@ -57,7 +57,7 @@ class Tax extends \Magento\Framework\View\Element\Template /** * Get data (totals) source model * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getSource() { @@ -98,7 +98,7 @@ class Tax extends \Magento\Framework\View\Element\Template */ protected function _addTax($after = 'discount') { - $taxTotal = new \Magento\Framework\Object(['code' => 'tax', 'block_name' => $this->getNameInLayout()]); + $taxTotal = new \Magento\Framework\DataObject(['code' => 'tax', 'block_name' => $this->getNameInLayout()]); $this->getParentBlock()->addTotal($taxTotal, $after); return $this; } @@ -151,7 +151,7 @@ class Tax extends \Magento\Framework\View\Element\Template $subtotalIncl = max(0, $subtotalIncl); $baseSubtotalIncl = max(0, $baseSubtotalIncl); - $totalExcl = new \Magento\Framework\Object( + $totalExcl = new \Magento\Framework\DataObject( [ 'code' => 'subtotal_excl', 'value' => $subtotal, @@ -159,7 +159,7 @@ class Tax extends \Magento\Framework\View\Element\Template 'label' => __('Subtotal (Excl.Tax)'), ] ); - $totalIncl = new \Magento\Framework\Object( + $totalIncl = new \Magento\Framework\DataObject( [ 'code' => 'subtotal_incl', 'value' => $subtotalIncl, @@ -218,7 +218,7 @@ class Tax extends \Magento\Framework\View\Element\Template $baseShippingIncl = $baseShipping + (double)$this->_source->getBaseShippingTaxAmount(); } - $totalExcl = new \Magento\Framework\Object( + $totalExcl = new \Magento\Framework\DataObject( [ 'code' => 'shipping', 'value' => $shipping, @@ -226,7 +226,7 @@ class Tax extends \Magento\Framework\View\Element\Template 'label' => __('Shipping & Handling (Excl.Tax)'), ] ); - $totalIncl = new \Magento\Framework\Object( + $totalIncl = new \Magento\Framework\DataObject( [ 'code' => 'shipping_incl', 'value' => $shippingIncl, @@ -287,7 +287,7 @@ class Tax extends \Magento\Framework\View\Element\Template $baseGrandtotalExcl = $baseGrandtotal - $this->_source->getBaseTaxAmount(); $grandtotalExcl = max($grandtotalExcl, 0); $baseGrandtotalExcl = max($baseGrandtotalExcl, 0); - $totalExcl = new \Magento\Framework\Object( + $totalExcl = new \Magento\Framework\DataObject( [ 'code' => 'grand_total', 'strong' => true, @@ -296,7 +296,7 @@ class Tax extends \Magento\Framework\View\Element\Template 'label' => __('Grand Total (Excl.Tax)'), ] ); - $totalIncl = new \Magento\Framework\Object( + $totalIncl = new \Magento\Framework\DataObject( [ 'code' => 'grand_total_incl', 'strong' => true, diff --git a/app/code/Magento/Tax/Helper/Data.php b/app/code/Magento/Tax/Helper/Data.php index 56ab6d4541a..d7510ce7293 100644 --- a/app/code/Magento/Tax/Helper/Data.php +++ b/app/code/Magento/Tax/Helper/Data.php @@ -494,7 +494,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper */ public function getShippingPrice($price, $includingTax = null, $shippingAddress = null, $ctc = null, $store = null) { - $pseudoProduct = new \Magento\Framework\Object(); + $pseudoProduct = new \Magento\Framework\DataObject(); $pseudoProduct->setTaxClassId($this->getShippingTaxClass($store)); $billingAddress = false; diff --git a/app/code/Magento/Tax/Model/Calculation.php b/app/code/Magento/Tax/Model/Calculation.php index 4fc6ecf33e8..4fc42634f77 100644 --- a/app/code/Magento/Tax/Model/Calculation.php +++ b/app/code/Magento/Tax/Model/Calculation.php @@ -351,7 +351,7 @@ class Calculation extends \Magento\Framework\Model\AbstractModel /** * Get calculation tax rate by specific request * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return float */ public function getRate($request) @@ -382,7 +382,7 @@ class Calculation extends \Magento\Framework\Model\AbstractModel /** * Get cache key value for specific tax rate request * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return string */ protected function _getRequestCacheKey($request) @@ -407,7 +407,7 @@ class Calculation extends \Magento\Framework\Model\AbstractModel * This rate can be used for conversion store price including tax to * store price excluding tax * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @param null|string|bool|int|Store $store * @return float */ @@ -421,11 +421,11 @@ class Calculation extends \Magento\Framework\Model\AbstractModel * Get request object for getting tax rate based on store shipping original address * * @param null|string|bool|int|Store $store - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function getRateOriginRequest($store = null) { - $request = new \Magento\Framework\Object(); + $request = new \Magento\Framework\DataObject(); $request->setCountryId( $this->_scopeConfig->getValue( \Magento\Shipping\Model\Config::XML_PATH_ORIGIN_COUNTRY_ID, @@ -457,7 +457,7 @@ class Calculation extends \Magento\Framework\Model\AbstractModel * * @param null|int|string|Store $store * @param int $customerId - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getDefaultRateRequest($store = null, $customerId = null) { @@ -490,12 +490,12 @@ class Calculation extends \Magento\Framework\Model\AbstractModel * customer_class_id (->getCustomerClassId()) * store (->getStore()) * - * @param null|bool|\Magento\Framework\Object|CustomerAddress $shippingAddress - * @param null|bool|\Magento\Framework\Object|CustomerAddress $billingAddress + * @param null|bool|\Magento\Framework\DataObject|CustomerAddress $shippingAddress + * @param null|bool|\Magento\Framework\DataObject|CustomerAddress $billingAddress * @param null|int $customerTaxClass * @param null|int|\Magento\Store\Model\Store $store * @param int $customerId - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) @@ -510,7 +510,7 @@ class Calculation extends \Magento\Framework\Model\AbstractModel if ($shippingAddress === false && $billingAddress === false && $customerTaxClass === false) { return $this->getRateOriginRequest($store); } - $address = new \Magento\Framework\Object(); + $address = new \Magento\Framework\DataObject(); $basedOn = $this->_scopeConfig->getValue( \Magento\Tax\Model\Config::CONFIG_XML_PATH_BASED_ON, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, @@ -597,7 +597,7 @@ class Calculation extends \Magento\Framework\Model\AbstractModel } } - $request = new \Magento\Framework\Object(); + $request = new \Magento\Framework\DataObject(); //TODO: Address is not completely refactored to use Data objects if ($address->getRegion() instanceof AddressRegion) { $regionId = $address->getRegion()->getRegionId(); @@ -615,7 +615,7 @@ class Calculation extends \Magento\Framework\Model\AbstractModel /** * Get information about tax rates applied to request * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return array */ public function getAppliedRates($request) @@ -691,10 +691,10 @@ class Calculation extends \Magento\Framework\Model\AbstractModel $billingAddressObj = null; $shippingAddressObj = null; if (!empty($billingAddress)) { - $billingAddressObj = new \Magento\Framework\Object($billingAddress); + $billingAddressObj = new \Magento\Framework\DataObject($billingAddress); } if (!empty($shippingAddress)) { - $shippingAddressObj = new \Magento\Framework\Object($shippingAddress); + $shippingAddressObj = new \Magento\Framework\DataObject($shippingAddress); } $rateRequest = $this->getRateRequest($shippingAddressObj, $billingAddressObj, $customerTaxClassId); diff --git a/app/code/Magento/Tax/Model/Calculation/AbstractCalculator.php b/app/code/Magento/Tax/Model/Calculation/AbstractCalculator.php index 18ed9ba62a4..d8ab3e259b2 100644 --- a/app/code/Magento/Tax/Model/Calculation/AbstractCalculator.php +++ b/app/code/Magento/Tax/Model/Calculation/AbstractCalculator.php @@ -95,7 +95,7 @@ abstract class AbstractCalculator * customer_class_id (->getCustomerClassId()) * store (->getStore()) * - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ private $addressRateRequest = null; @@ -139,7 +139,7 @@ abstract class AbstractCalculator * @param Calculation $calculationTool * @param \Magento\Tax\Model\Config $config * @param int $storeId - * @param \Magento\Framework\Object $addressRateRequest + * @param \Magento\Framework\DataObject $addressRateRequest */ public function __construct( TaxClassManagementInterface $taxClassService, @@ -149,7 +149,7 @@ abstract class AbstractCalculator Calculation $calculationTool, \Magento\Tax\Model\Config $config, $storeId, - \Magento\Framework\Object $addressRateRequest = null + \Magento\Framework\DataObject $addressRateRequest = null ) { $this->taxClassManagement = $taxClassService; $this->taxDetailsItemDataObjectFactory = $taxDetailsItemDataObjectFactory; @@ -254,7 +254,7 @@ abstract class AbstractCalculator * customer_class_id (->getCustomerClassId()) * store (->getStore()) * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function getAddressRateRequest() { diff --git a/app/code/Magento/Tax/Model/Rate/Source.php b/app/code/Magento/Tax/Model/Rate/Source.php index 0d999d6698b..4fa9ddedaec 100644 --- a/app/code/Magento/Tax/Model/Rate/Source.php +++ b/app/code/Magento/Tax/Model/Rate/Source.php @@ -7,7 +7,7 @@ namespace Magento\Tax\Model\Rate; use Magento\Framework\Api\SearchCriteriaBuilder; -use Magento\Framework\Convert\Object as Converter; +use Magento\Framework\Convert\DataObject as Converter; use Magento\Tax\Api\TaxRateRepositoryInterface; use Magento\Tax\Model\Calculation\Rate; diff --git a/app/code/Magento/Tax/Model/Resource/Calculation.php b/app/code/Magento/Tax/Model/Resource/Calculation.php index 24f9063bee5..72bd64d72b7 100644 --- a/app/code/Magento/Tax/Model/Resource/Calculation.php +++ b/app/code/Magento/Tax/Model/Resource/Calculation.php @@ -103,7 +103,7 @@ class Calculation extends \Magento\Framework\Model\Resource\Db\AbstractDb /** * Get tax rate information: calculation process data and tax rate * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return array */ public function getRateInfo($request) @@ -118,7 +118,7 @@ class Calculation extends \Magento\Framework\Model\Resource\Db\AbstractDb /** * Get tax rate for specific tax rate request * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return int */ public function getRate($request) @@ -129,7 +129,7 @@ class Calculation extends \Magento\Framework\Model\Resource\Db\AbstractDb /** * Retrieve Calculation Process * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @param array|null $rates * @return array * @SuppressWarnings(PHPMD.CyclomaticComplexity) @@ -265,7 +265,7 @@ class Calculation extends \Magento\Framework\Model\Resource\Db\AbstractDb * Returns tax rates for request - either pereforms SELECT from DB, or returns already cached result * Notice that productClassId due to optimization can be array of ids * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return array * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) @@ -458,7 +458,7 @@ class Calculation extends \Magento\Framework\Model\Resource\Db\AbstractDb /** * Retrieve rate ids * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return array */ public function getRateIds($request) diff --git a/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Collection.php b/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Collection.php index 916bc860e88..8157a35a07e 100644 --- a/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Collection.php +++ b/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Collection.php @@ -25,7 +25,7 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac /** * Retrieve order tax collection by order identifier * - * @param \Magento\Framework\Object $order + * @param \Magento\Framework\DataObject $order * @return \Magento\Tax\Model\Resource\Sales\Order\Tax\Collection */ public function loadByOrder($order) diff --git a/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php b/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php index 740004bb127..e82154f6ed7 100644 --- a/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php +++ b/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php @@ -11,7 +11,7 @@ namespace Magento\Tax\Model\Sales\Total\Quote; use Magento\Customer\Api\Data\AddressInterfaceFactory as CustomerAddressFactory; use Magento\Customer\Api\Data\AddressInterface as CustomerAddress; use Magento\Customer\Api\Data\RegionInterfaceFactory as CustomerAddressRegionFactory; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Quote\Model\Quote\Address as QuoteAddress; use Magento\Quote\Model\Quote\Address\Total\AbstractTotal; use Magento\Quote\Model\Quote\Item\AbstractItem; diff --git a/app/code/Magento/Tax/Model/TaxClass/AbstractType.php b/app/code/Magento/Tax/Model/TaxClass/AbstractType.php index 5dc2cc1465f..d5f0191c654 100644 --- a/app/code/Magento/Tax/Model/TaxClass/AbstractType.php +++ b/app/code/Magento/Tax/Model/TaxClass/AbstractType.php @@ -9,7 +9,7 @@ */ namespace Magento\Tax\Model\TaxClass; -abstract class AbstractType extends \Magento\Framework\Object implements \Magento\Tax\Model\TaxClass\Type\TypeInterface +abstract class AbstractType extends \Magento\Framework\DataObject implements Type\TypeInterface { /** * @var \Magento\Tax\Model\Calculation\Rule diff --git a/app/code/Magento/Tax/Model/TaxRateCollection.php b/app/code/Magento/Tax/Model/TaxRateCollection.php index ca5b8c48630..4c762196360 100644 --- a/app/code/Magento/Tax/Model/TaxRateCollection.php +++ b/app/code/Magento/Tax/Model/TaxRateCollection.php @@ -74,11 +74,11 @@ class TaxRateCollection extends AbstractServiceCollection * Creates a collection item that represents a tax rate for the tax rates grid. * * @param TaxRate $taxRate Input data for creating the item. - * @return \Magento\Framework\Object Collection item that represents a tax rate + * @return \Magento\Framework\DataObject Collection item that represents a tax rate */ protected function createTaxRateCollectionItem(TaxRate $taxRate) { - $collectionItem = new \Magento\Framework\Object(); + $collectionItem = new \Magento\Framework\DataObject(); $collectionItem->setTaxCalculationRateId($taxRate->getId()); $collectionItem->setCode($taxRate->getCode()); $collectionItem->setTaxCountryId($taxRate->getTaxCountryId()); diff --git a/app/code/Magento/Tax/Model/TaxRuleCollection.php b/app/code/Magento/Tax/Model/TaxRuleCollection.php index 10b215fc612..8b8f290472a 100644 --- a/app/code/Magento/Tax/Model/TaxRuleCollection.php +++ b/app/code/Magento/Tax/Model/TaxRuleCollection.php @@ -65,11 +65,11 @@ class TaxRuleCollection extends AbstractServiceCollection * Creates a collection item that represents a tax rule for the tax rules grid. * * @param TaxRuleInterface $taxRule Input data for creating the item. - * @return \Magento\Framework\Object Collection item that represents a tax rule + * @return \Magento\Framework\DataObject Collection item that represents a tax rule */ protected function createTaxRuleCollectionItem(TaxRuleInterface $taxRule) { - $collectionItem = new \Magento\Framework\Object(); + $collectionItem = new \Magento\Framework\DataObject(); $collectionItem->setTaxCalculationRuleId($taxRule->getId()); $collectionItem->setCode($taxRule->getCode()); /* should cast to string so that some optional fields won't be null on the collection grid pages */ diff --git a/app/code/Magento/Tax/Test/Unit/Helper/DataTest.php b/app/code/Magento/Tax/Test/Unit/Helper/DataTest.php index 48bf55cbb10..0bf2bc453ea 100644 --- a/app/code/Magento/Tax/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/Tax/Test/Unit/Helper/DataTest.php @@ -8,7 +8,7 @@ namespace Magento\Tax\Test\Unit\Helper; -use Magento\Framework\Object as MagentoObject; +use Magento\Framework\DataObject as MagentoObject; /** * Class DataTest diff --git a/app/code/Magento/Tax/Test/Unit/Model/Calculation/RowBaseAndTotalBaseCalculatorTestCase.php b/app/code/Magento/Tax/Test/Unit/Model/Calculation/RowBaseAndTotalBaseCalculatorTestCase.php index e73b7b9d73f..39323015b6c 100644 --- a/app/code/Magento/Tax/Test/Unit/Model/Calculation/RowBaseAndTotalBaseCalculatorTestCase.php +++ b/app/code/Magento/Tax/Test/Unit/Model/Calculation/RowBaseAndTotalBaseCalculatorTestCase.php @@ -124,7 +124,7 @@ class RowBaseAndTotalBaseCalculatorTestCase extends \PHPUnit_Framework_TestCase $this->mockAppliedTax = $this->getMockBuilder('Magento\Tax\Api\Data\AppliedTaxInterface')->getMock(); $this->mockAppliedTax->expects($this->any())->method('getTaxRateKey')->will($this->returnValue('taxKey')); - $this->addressRateRequest = new \Magento\Framework\Object(); + $this->addressRateRequest = new \Magento\Framework\DataObject(); } /** diff --git a/app/code/Magento/Tax/Test/Unit/Model/Calculation/UnitBaseCalculatorTest.php b/app/code/Magento/Tax/Test/Unit/Model/Calculation/UnitBaseCalculatorTest.php index 313f016a59a..c9c7b354493 100644 --- a/app/code/Magento/Tax/Test/Unit/Model/Calculation/UnitBaseCalculatorTest.php +++ b/app/code/Magento/Tax/Test/Unit/Model/Calculation/UnitBaseCalculatorTest.php @@ -72,7 +72,7 @@ class UnitBaseCalculatorTest extends \PHPUnit_Framework_TestCase $this->mockConfig = $this->getMockBuilder('\Magento\Tax\Model\Config') ->disableOriginalConstructor() ->getMock(); - $this->addressRateRequest = new \Magento\Framework\Object(); + $this->addressRateRequest = new \Magento\Framework\DataObject(); $this->appliedTaxRate = $objectManager->getObject('Magento\Tax\Model\TaxDetails\AppliedTaxRate'); $this->appliedTaxRateDataObjectFactoryMock = $this->getMock( diff --git a/app/code/Magento/Tax/Test/Unit/Model/ObserverTest.php b/app/code/Magento/Tax/Test/Unit/Model/ObserverTest.php index ade2187342a..a9308c6b883 100644 --- a/app/code/Magento/Tax/Test/Unit/Model/ObserverTest.php +++ b/app/code/Magento/Tax/Test/Unit/Model/ObserverTest.php @@ -28,7 +28,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $displayPriceExcludingTax ) { - $frameworkObject= new \Magento\Framework\Object(); + $frameworkObject= new \Magento\Framework\DataObject(); $frameworkObject->setAdditionalOptions([]); $product=$this->getMock('Magento\Catalog\Model\Product', [], [], '', false); diff --git a/app/code/Magento/Tax/Test/Unit/Model/TaxCalculationTest.php b/app/code/Magento/Tax/Test/Unit/Model/TaxCalculationTest.php index d88ea2756c2..380f64ba4b3 100644 --- a/app/code/Magento/Tax/Test/Unit/Model/TaxCalculationTest.php +++ b/app/code/Magento/Tax/Test/Unit/Model/TaxCalculationTest.php @@ -113,7 +113,7 @@ class TaxCalculationTest extends \PHPUnit_Framework_TestCase $this->storeManager->expects($this->once())->method('getStore')->willReturn($storeMock); $storeMock->expects($this->once())->method('getStoreId')->willReturn($storeId); - $rateRequestMock = $this->getMock('\Magento\Framework\Object', ['setProductClassId'], [], '', false); + $rateRequestMock = $this->getMock('\Magento\Framework\DataObject', ['setProductClassId'], [], '', false); $this->calculationTool->expects($this->once()) ->method('getRateRequest') ->with(null, null, null, $storeId, $customerId) @@ -142,7 +142,7 @@ class TaxCalculationTest extends \PHPUnit_Framework_TestCase $this->storeManager->expects($this->once())->method('getStore')->willReturn($storeMock); $storeMock->expects($this->once())->method('getStoreId')->willReturn($storeId); - $rateRequestMock = $this->getMock('\Magento\Framework\Object', ['setProductClassId'], [], '', false); + $rateRequestMock = $this->getMock('\Magento\Framework\DataObject', ['setProductClassId'], [], '', false); $this->calculationTool->expects($this->once()) ->method('getDefaultRateRequest') ->with($storeId, $customerId) diff --git a/app/code/Magento/Tax/etc/fieldset.xml b/app/code/Magento/Tax/etc/fieldset.xml index 675462863e7..0433e85a3cf 100644 --- a/app/code/Magento/Tax/etc/fieldset.xml +++ b/app/code/Magento/Tax/etc/fieldset.xml @@ -6,7 +6,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Object/etc/fieldset.xsd"> + xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/DataObject/etc/fieldset.xsd"> <scope id="global"> <fieldset id="quote_convert_address"> <field name="subtotal_incl_tax"> diff --git a/app/code/Magento/TaxImportExport/Block/Adminhtml/Rate/Grid/Renderer/Country.php b/app/code/Magento/TaxImportExport/Block/Adminhtml/Rate/Grid/Renderer/Country.php index cf47c22cad7..16481d2ea34 100644 --- a/app/code/Magento/TaxImportExport/Block/Adminhtml/Rate/Grid/Renderer/Country.php +++ b/app/code/Magento/TaxImportExport/Block/Adminhtml/Rate/Grid/Renderer/Country.php @@ -16,10 +16,10 @@ class Country extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Country /** * Render column for export * - * @param \Magento\Framework\Object $row + * @param \Magento\Framework\DataObject $row * @return string */ - public function renderExport(\Magento\Framework\Object $row) + public function renderExport(\Magento\Framework\DataObject $row) { return $row->getData($this->getColumn()->getIndex()); } diff --git a/app/code/Magento/TaxImportExport/Controller/Adminhtml/Rate/ExportPost.php b/app/code/Magento/TaxImportExport/Controller/Adminhtml/Rate/ExportPost.php index 92e825650f8..cc4a105cee6 100644 --- a/app/code/Magento/TaxImportExport/Controller/Adminhtml/Rate/ExportPost.php +++ b/app/code/Magento/TaxImportExport/Controller/Adminhtml/Rate/ExportPost.php @@ -18,7 +18,7 @@ class ExportPost extends \Magento\TaxImportExport\Controller\Adminhtml\Rate public function execute() { /** start csv content and set template */ - $headers = new \Magento\Framework\Object( + $headers = new \Magento\Framework\DataObject( [ 'code' => __('Code'), 'country_name' => __('Country'), diff --git a/app/code/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/Content.php b/app/code/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/Content.php index 90de128cc3d..2ce96b0ef56 100644 --- a/app/code/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/Content.php +++ b/app/code/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/Content.php @@ -114,7 +114,7 @@ class Content extends \Magento\Backend\Block\Widget\Container */ public function getFilebrowserSetupObject() { - $setupObject = new \Magento\Framework\Object(); + $setupObject = new \Magento\Framework\DataObject(); $setupObject->setData( [ diff --git a/app/code/Magento/Theme/Block/Html/Footer.php b/app/code/Magento/Theme/Block/Html/Footer.php index db5e9285005..cb765224092 100644 --- a/app/code/Magento/Theme/Block/Html/Footer.php +++ b/app/code/Magento/Theme/Block/Html/Footer.php @@ -10,7 +10,7 @@ use Magento\Customer\Model\Context; /** * Html page footer block */ -class Footer extends \Magento\Framework\View\Element\Template implements \Magento\Framework\Object\IdentityInterface +class Footer extends \Magento\Framework\View\Element\Template implements \Magento\Framework\DataObject\IdentityInterface { /** * Copyright information diff --git a/app/code/Magento/Theme/Block/Html/Topmenu.php b/app/code/Magento/Theme/Block/Html/Topmenu.php index f3dd2b134b1..bacb7046274 100644 --- a/app/code/Magento/Theme/Block/Html/Topmenu.php +++ b/app/code/Magento/Theme/Block/Html/Topmenu.php @@ -5,7 +5,7 @@ */ namespace Magento\Theme\Block\Html; -use Magento\Framework\Object\IdentityInterface; +use Magento\Framework\DataObject\IdentityInterface; use Magento\Framework\View\Element\Template; use Magento\Framework\Data\TreeFactory; use Magento\Framework\Data\Tree\Node; @@ -79,7 +79,7 @@ class Topmenu extends Template implements IdentityInterface $html = $this->_getHtml($this->_menu, $childrenWrapClass, $limit); - $transportObject = new \Magento\Framework\Object(['html' => $html]); + $transportObject = new \Magento\Framework\DataObject(['html' => $html]); $this->_eventManager->dispatch( 'page_block_html_topmenu_gethtml_after', ['menu' => $this->_menu, 'transportObject' => $transportObject] diff --git a/app/code/Magento/Theme/Console/Command/ThemeUninstallCommand.php b/app/code/Magento/Theme/Console/Command/ThemeUninstallCommand.php index b2af6f7e45f..68b05f1d4e6 100644 --- a/app/code/Magento/Theme/Console/Command/ThemeUninstallCommand.php +++ b/app/code/Magento/Theme/Console/Command/ThemeUninstallCommand.php @@ -361,7 +361,11 @@ class ThemeUninstallCommand extends Command { $themesDirRead = $this->filesystem->getDirectoryRead(DirectoryList::THEMES); if ($themesDirRead->isExist($themePath . '/composer.json')) { - $rawData = \Zend_Json::decode($themesDirRead->readFile($themePath . '/composer.json')); + $rawData = []; + $themeFile = $themesDirRead->readFile($themePath . '/composer.json'); + if ($themeFile) { + $rawData = \Zend_Json::decode($themeFile); + } return isset($rawData['name']) ? $rawData['name'] : ''; } return ''; diff --git a/app/code/Magento/Theme/Model/Design.php b/app/code/Magento/Theme/Model/Design.php index 52cd618ad20..402d067d6cf 100644 --- a/app/code/Magento/Theme/Model/Design.php +++ b/app/code/Magento/Theme/Model/Design.php @@ -8,7 +8,7 @@ namespace Magento\Theme\Model; use Magento\Framework\App\DesignInterface; use Magento\Framework\Model\AbstractModel; use Magento\Framework\Model\Resource\AbstractResource; -use Magento\Framework\Object\IdentityInterface; +use Magento\Framework\DataObject\IdentityInterface; /** * Design settings change model diff --git a/app/code/Magento/Theme/Model/Layout/Config.php b/app/code/Magento/Theme/Model/Layout/Config.php index d58ab46ec17..2593f9ade2e 100644 --- a/app/code/Magento/Theme/Model/Layout/Config.php +++ b/app/code/Magento/Theme/Model/Layout/Config.php @@ -41,7 +41,7 @@ class Config $this->_pageLayouts = []; foreach ($this->_dataStorage->get(null) as $layoutCode => $layoutConfig) { $layoutConfig['label'] = __($layoutConfig['label']); - $this->_pageLayouts[$layoutCode] = new \Magento\Framework\Object($layoutConfig); + $this->_pageLayouts[$layoutCode] = new \Magento\Framework\DataObject($layoutConfig); } } return $this; @@ -50,7 +50,7 @@ class Config /** * Retrieve available page layouts * - * @return \Magento\Framework\Object[] + * @return \Magento\Framework\DataObject[] */ public function getPageLayouts() { @@ -62,7 +62,7 @@ class Config * Retrieve page layout by code * * @param string $layoutCode - * @return \Magento\Framework\Object|boolean + * @return \Magento\Framework\DataObject|boolean */ public function getPageLayout($layoutCode) { diff --git a/app/code/Magento/Theme/Model/Theme/Collection.php b/app/code/Magento/Theme/Model/Theme/Collection.php index 2b04f02a1ec..0fea3c7d8d7 100644 --- a/app/code/Magento/Theme/Model/Theme/Collection.php +++ b/app/code/Magento/Theme/Model/Theme/Collection.php @@ -145,7 +145,7 @@ class Collection extends \Magento\Framework\Data\Collection implements ListInter protected function _updateRelations() { $themeItems = $this->getItems(); - /** @var $theme \Magento\Framework\Object|ThemeInterface */ + /** @var $theme \Magento\Framework\DataObject|ThemeInterface */ foreach ($themeItems as $theme) { $parentThemePath = $theme->getData('parent_theme_path'); if ($parentThemePath) { @@ -276,10 +276,10 @@ class Collection extends \Magento\Framework\Data\Collection implements ListInter /** * Retrieve item id * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return string */ - protected function _getItemId(\Magento\Framework\Object $item) + protected function _getItemId(\Magento\Framework\DataObject $item) { return $item->getFullPath(); } diff --git a/app/code/Magento/Theme/Test/Unit/Model/Config/CustomizationTest.php b/app/code/Magento/Theme/Test/Unit/Model/Config/CustomizationTest.php index 2d18a877fde..2e7716a68eb 100644 --- a/app/code/Magento/Theme/Test/Unit/Model/Config/CustomizationTest.php +++ b/app/code/Magento/Theme/Test/Unit/Model/Config/CustomizationTest.php @@ -171,26 +171,26 @@ class CustomizationTest extends \PHPUnit_Framework_TestCase } /** - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function getAssignedTheme() { - return new \Magento\Framework\Object(['id' => 1, 'theme_path' => 'Magento/luma']); + return new \Magento\Framework\DataObject(['id' => 1, 'theme_path' => 'Magento/luma']); } /** - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function getUnassignedTheme() { - return new \Magento\Framework\Object(['id' => 2, 'theme_path' => 'Magento/blank']); + return new \Magento\Framework\DataObject(['id' => 2, 'theme_path' => 'Magento/blank']); } /** - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function getStore() { - return new \Magento\Framework\Object(['id' => 55]); + return new \Magento\Framework\DataObject(['id' => 55]); } } diff --git a/app/code/Magento/Theme/Test/Unit/Model/ConfigTest.php b/app/code/Magento/Theme/Test/Unit/Model/ConfigTest.php index d9ee87333fc..838ee2c0d1f 100644 --- a/app/code/Magento/Theme/Test/Unit/Model/ConfigTest.php +++ b/app/code/Magento/Theme/Test/Unit/Model/ConfigTest.php @@ -103,7 +103,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $themePath = 'Magento/blank'; /** Unassign themes from store */ - $configEntity = new \Magento\Framework\Object(['value' => 6, 'scope_id' => 8]); + $configEntity = new \Magento\Framework\DataObject(['value' => 6, 'scope_id' => 8]); $this->_configData->expects( $this->once() @@ -154,7 +154,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $themePath = 'Magento/blank'; /** Unassign themes from store */ - $configEntity = new \Magento\Framework\Object(['value' => 6, 'scope_id' => 8]); + $configEntity = new \Magento\Framework\DataObject(['value' => 6, 'scope_id' => 8]); $this->_configData->expects( $this->once() diff --git a/app/code/Magento/Theme/Test/Unit/Model/Layout/ConfigTest.php b/app/code/Magento/Theme/Test/Unit/Model/Layout/ConfigTest.php index 62c5670761f..7b5a89579c5 100644 --- a/app/code/Magento/Theme/Test/Unit/Model/Layout/ConfigTest.php +++ b/app/code/Magento/Theme/Test/Unit/Model/Layout/ConfigTest.php @@ -5,7 +5,7 @@ */ namespace Magento\Theme\Test\Unit\Model\Layout; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Theme\Model\Layout\Config; class ConfigTest extends \PHPUnit_Framework_TestCase @@ -41,7 +41,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase { $data = ['code' => ['label' => 'Test Label', 'code' => 'testCode']]; $expectedResult = [ - 'code' => new Object(['label' => __('Test Label'), 'code' => 'testCode']), + 'code' => new DataObject(['label' => __('Test Label'), 'code' => 'testCode']), ]; $this->dataStorage->expects($this->once()) diff --git a/app/code/Magento/Theme/Test/Unit/Model/Layout/Source/LayoutTest.php b/app/code/Magento/Theme/Test/Unit/Model/Layout/Source/LayoutTest.php index 874847903b6..9393da12bf5 100644 --- a/app/code/Magento/Theme/Test/Unit/Model/Layout/Source/LayoutTest.php +++ b/app/code/Magento/Theme/Test/Unit/Model/Layout/Source/LayoutTest.php @@ -5,7 +5,7 @@ */ namespace Magento\Theme\Test\Unit\Model\Layout\Source; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Theme\Model\Layout\Source\Layout; class LayoutTest extends \PHPUnit_Framework_TestCase @@ -46,7 +46,7 @@ class LayoutTest extends \PHPUnit_Framework_TestCase $this->config->expects($this->once()) ->method('getPageLayouts') - ->willReturn([new Object($data)]); + ->willReturn([new DataObject($data)]); $this->assertEquals($expectedResult, $this->_model->toOptionArray(true)); $this->assertEquals('testCode', $this->_model->getDefaultValue()); diff --git a/app/code/Magento/Theme/Test/Unit/Model/Theme/Domain/VirtualTest.php b/app/code/Magento/Theme/Test/Unit/Model/Theme/Domain/VirtualTest.php index 938127be992..3f243be0306 100644 --- a/app/code/Magento/Theme/Test/Unit/Model/Theme/Domain/VirtualTest.php +++ b/app/code/Magento/Theme/Test/Unit/Model/Theme/Domain/VirtualTest.php @@ -70,7 +70,7 @@ class VirtualTest extends \PHPUnit_Framework_TestCase $appState->expects($this->any())->method('getAreaCode')->will($this->returnValue('fixture_area')); $appStateProperty = new \ReflectionProperty('Magento\Theme\Model\Theme', '_appState'); $appStateProperty->setAccessible(true); - /** @var $theme \Magento\Framework\Object */ + /** @var $theme \Magento\Framework\DataObject */ $theme->setData( [ 'id' => 'fixture_theme_id', diff --git a/app/code/Magento/Theme/Test/Unit/Model/Theme/ValidationTest.php b/app/code/Magento/Theme/Test/Unit/Model/Theme/ValidationTest.php index 5912fe622bb..6d8b58d6ce3 100644 --- a/app/code/Magento/Theme/Test/Unit/Model/Theme/ValidationTest.php +++ b/app/code/Magento/Theme/Test/Unit/Model/Theme/ValidationTest.php @@ -21,8 +21,8 @@ class ValidationTest extends \PHPUnit_Framework_TestCase */ public function testValidate(array $data, $result, array $messages) { - /** @var $themeMock \Magento\Framework\Object */ - $themeMock = new \Magento\Framework\Object(); + /** @var $themeMock \Magento\Framework\DataObject */ + $themeMock = new \Magento\Framework\DataObject(); $themeMock->setData($data); $validator = new \Magento\Framework\View\Design\Theme\Validator(); diff --git a/app/code/Magento/Theme/Test/Unit/Model/ThemeValidatorTest.php b/app/code/Magento/Theme/Test/Unit/Model/ThemeValidatorTest.php index f4b7d2a5d4f..3448b9b7c25 100644 --- a/app/code/Magento/Theme/Test/Unit/Model/ThemeValidatorTest.php +++ b/app/code/Magento/Theme/Test/Unit/Model/ThemeValidatorTest.php @@ -59,9 +59,9 @@ class ThemeValidatorTest extends \PHPUnit_Framework_TestCase { $theme = $this->getMock('Magento\Theme\Model\Theme', [], [], '', false); $theme->expects($this->once())->method('getId')->willReturn(6); - $defaultEntity = new \Magento\Framework\Object(['value' => 6, 'scope' => 'default', 'scope_id' => 8]); - $websitesEntity = new \Magento\Framework\Object(['value' => 6, 'scope' => 'websites', 'scope_id' => 8]); - $storesEntity = new \Magento\Framework\Object(['value' => 6, 'scope' => 'stores', 'scope_id' => 8]); + $defaultEntity = new \Magento\Framework\DataObject(['value' => 6, 'scope' => 'default', 'scope_id' => 8]); + $websitesEntity = new \Magento\Framework\DataObject(['value' => 6, 'scope' => 'websites', 'scope_id' => 8]); + $storesEntity = new \Magento\Framework\DataObject(['value' => 6, 'scope' => 'stores', 'scope_id' => 8]); $this->themeProvider->expects($this->once())->method('getThemeByFullPath')->willReturn($theme); $this->configData->expects($this->once())->method('getCollection')->willReturn($this->configData); $this->configData diff --git a/app/code/Magento/Translation/Model/Inline/Parser.php b/app/code/Magento/Translation/Model/Inline/Parser.php index a7e7016904b..60dabb7d2db 100644 --- a/app/code/Magento/Translation/Model/Inline/Parser.php +++ b/app/code/Magento/Translation/Model/Inline/Parser.php @@ -123,14 +123,14 @@ class Parser implements \Magento\Framework\Translate\Inline\ParserInterface * Initialize base inline translation model * * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Translation\Model\Resource\StringFactory $resource + * @param \Magento\Translation\Model\Resource\StringUtilsFactory $resource * @param \Zend_Filter_Interface $inputFilter * @param \Magento\Framework\App\State $appState * @param \Magento\Framework\App\Cache\TypeListInterface $appCache, * @param \Magento\Framework\Translate\InlineInterface $translateInline */ public function __construct( - \Magento\Translation\Model\Resource\StringFactory $resource, + \Magento\Translation\Model\Resource\StringUtilsFactory $resource, \Magento\Store\Model\StoreManagerInterface $storeManager, \Zend_Filter_Interface $inputFilter, \Magento\Framework\App\State $appState, @@ -164,7 +164,7 @@ class Parser implements \Magento\Framework\Translate\Inline\ParserInterface /** @var $validStoreId int */ $validStoreId = $this->_storeManager->getStore()->getId(); - /** @var $resource \Magento\Translation\Model\Resource\String */ + /** @var $resource \Magento\Translation\Model\Resource\StringUtils */ $resource = $this->_resourceFactory->create(); foreach ($translateParams as $param) { if ($this->_appState->getAreaCode() == \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) { diff --git a/app/code/Magento/Translation/Model/Resource/String.php b/app/code/Magento/Translation/Model/Resource/String.php deleted file mode 100644 index 2fbb17cadb8..00000000000 --- a/app/code/Magento/Translation/Model/Resource/String.php +++ /dev/null @@ -1,276 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Translation\Model\Resource; - -class String extends \Magento\Framework\Model\Resource\Db\AbstractDb -{ - /** - * @var \Magento\Framework\Locale\ResolverInterface - */ - protected $_localeResolver; - - /** - * @var \Magento\Framework\App\ScopeResolverInterface - */ - protected $scopeResolver; - - /** - * @var null|string - */ - protected $scope; - - /** - * @param \Magento\Framework\Model\Resource\Db\Context $context - * @param \Magento\Framework\Locale\ResolverInterface $localeResolver - * @param \Magento\Framework\App\ScopeResolverInterface $scopeResolver - * @param string|null $resourcePrefix - * @param string|null $scope - */ - public function __construct( - \Magento\Framework\Model\Resource\Db\Context $context, - \Magento\Framework\Locale\ResolverInterface $localeResolver, - \Magento\Framework\App\ScopeResolverInterface $scopeResolver, - $resourcePrefix = null, - $scope = null - ) { - $this->_localeResolver = $localeResolver; - $this->scopeResolver = $scopeResolver; - $this->scope = $scope; - parent::__construct($context, $resourcePrefix); - } - - /** - * Define main table - * - * @return void - */ - protected function _construct() - { - $this->_init('translation', 'key_id'); - } - - /** - * Load - * - * @param \Magento\Framework\Model\AbstractModel $object - * @param String $value - * @param String $field - * @return array|$this - */ - public function load(\Magento\Framework\Model\AbstractModel $object, $value, $field = null) - { - if (is_string($value)) { - $select = $this->_getReadAdapter()->select()->from( - $this->getMainTable() - )->where( - $this->getMainTable() . '.string=:tr_string' - ); - $result = $this->_getReadAdapter()->fetchRow($select, ['tr_string' => $value]); - $object->setData($result); - $this->_afterLoad($object); - return $result; - } else { - return parent::load($object, $value, $field); - } - } - - /** - * Retrieve select for load - * - * @param String $field - * @param String $value - * @param \Magento\Framework\Model\AbstractModel $object - * @return \Magento\Framework\DB\Select - */ - protected function _getLoadSelect($field, $value, $object) - { - $select = parent::_getLoadSelect($field, $value, $object); - $select->where('store_id = ?', \Magento\Store\Model\Store::DEFAULT_STORE_ID); - return $select; - } - - /** - * After translation loading - * - * @param \Magento\Framework\Model\AbstractModel $object - * @return $this - */ - public function _afterLoad(\Magento\Framework\Model\AbstractModel $object) - { - $adapter = $this->_getReadAdapter(); - $select = $adapter->select()->from( - $this->getMainTable(), - ['store_id', 'translate'] - )->where( - 'string = :translate_string' - ); - $translations = $adapter->fetchPairs($select, ['translate_string' => $object->getString()]); - $object->setStoreTranslations($translations); - return parent::_afterLoad($object); - } - - /** - * Before save - * - * @param \Magento\Framework\Model\AbstractModel $object - * @return $this - */ - protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object) - { - $adapter = $this->_getWriteAdapter(); - $select = $adapter->select() - ->from($this->getMainTable(), 'key_id') - ->where('string = :string') - ->where('store_id = :store_id'); - - $bind = ['string' => $object->getString(), 'store_id' => \Magento\Store\Model\Store::DEFAULT_STORE_ID]; - - $object->setId($adapter->fetchOne($select, $bind)); - return parent::_beforeSave($object); - } - - /** - * After save - * - * @param \Magento\Framework\Model\AbstractModel $object - * @return $this - */ - protected function _afterSave(\Magento\Framework\Model\AbstractModel $object) - { - $adapter = $this->_getWriteAdapter(); - $select = $adapter->select()->from( - $this->getMainTable(), - ['store_id', 'key_id'] - )->where( - 'string = :string' - ); - $stores = $adapter->fetchPairs($select, ['string' => $object->getString()]); - - $translations = $object->getStoreTranslations(); - - if (is_array($translations)) { - foreach ($translations as $storeId => $translate) { - if ($translate === null || $translate == '') { - $where = ['store_id = ?' => $storeId, 'string = ?' => $object->getString()]; - $adapter->delete($this->getMainTable(), $where); - } else { - $data = ['store_id' => $storeId, 'string' => $object->getString(), 'translate' => $translate]; - - if (isset($stores[$storeId])) { - $adapter->update($this->getMainTable(), $data, ['key_id = ?' => $stores[$storeId]]); - } else { - $adapter->insert($this->getMainTable(), $data); - } - } - } - } - return parent::_afterSave($object); - } - - /** - * Delete translates - * - * @param string $string - * @param string $locale - * @param int|null $storeId - * @return $this - */ - public function deleteTranslate($string, $locale = null, $storeId = null) - { - if ($locale === null) { - $locale = $this->_localeResolver->getLocale(); - } - - $where = ['locale = ?' => $locale, 'string = ?' => $string]; - - if ($storeId === false) { - $where['store_id > ?'] = \Magento\Store\Model\Store::DEFAULT_STORE_ID; - } elseif ($storeId !== null) { - $where['store_id = ?'] = $storeId; - } - - $this->_getWriteAdapter()->delete($this->getMainTable(), $where); - - return $this; - } - - /** - * Save translation - * - * @param String $string - * @param String $translate - * @param String $locale - * @param int|null $storeId - * @return $this - */ - public function saveTranslate($string, $translate, $locale = null, $storeId = null) - { - $write = $this->_getWriteAdapter(); - $table = $this->getMainTable(); - - if ($locale === null) { - $locale = $this->_localeResolver->getLocale(); - } - - if ($storeId === null) { - $storeId = $this->getStoreId(); - } - - $select = $write->select()->from( - $table, - ['key_id', 'translate'] - )->where( - 'store_id = :store_id' - )->where( - 'locale = :locale' - )->where( - 'string = :string' - )->where( - 'crc_string = :crc_string' - ); - $bind = [ - 'store_id' => $storeId, - 'locale' => $locale, - 'string' => $string, - 'crc_string' => crc32($string), - ]; - - if ($row = $write->fetchRow($select, $bind)) { - $original = $string; - if (strpos($original, '::') !== false) { - list(, $original) = explode('::', $original); - } - if ($original == $translate) { - $write->delete($table, ['key_id=?' => $row['key_id']]); - } elseif ($row['translate'] != $translate) { - $write->update($table, ['translate' => $translate], ['key_id=?' => $row['key_id']]); - } - } else { - $write->insert( - $table, - [ - 'store_id' => $storeId, - 'locale' => $locale, - 'string' => $string, - 'translate' => $translate, - 'crc_string' => crc32($string) - ] - ); - } - - return $this; - } - - /** - * Retrieve current store identifier - * - * @return int - */ - protected function getStoreId() - { - return $this->scopeResolver->getScope($this->scope)->getId(); - } -} diff --git a/app/code/Magento/Translation/Model/String.php b/app/code/Magento/Translation/Model/String.php deleted file mode 100644 index 32649d1a600..00000000000 --- a/app/code/Magento/Translation/Model/String.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -/** - * String translation model - * - * @method \Magento\Translation\Model\Resource\String _getResource() - * @method \Magento\Translation\Model\Resource\String getResource() - * @method int getStoreId() - * @method \Magento\Translation\Model\String setStoreId(int $value) - * @method string getTranslate() - * @method \Magento\Translation\Model\String setTranslate(string $value) - * @method string getLocale() - * @method \Magento\Translation\Model\String setLocale(string $value) - */ -namespace Magento\Translation\Model; - -class String extends \Magento\Framework\Model\AbstractModel -{ - /** - * @return void - */ - protected function _construct() - { - $this->_init('Magento\Translation\Model\Resource\String'); - } - - /** - * @param string $string - * @return $this - */ - public function setString($string) - { - $this->setData('string', $string); - return $this; - } - - /** - * Retrieve string - * - * @return string - */ - public function getString() - { - return $this->getData('string'); - } -} diff --git a/app/code/Magento/Translation/etc/adminhtml/di.xml b/app/code/Magento/Translation/etc/adminhtml/di.xml index 95f32894466..0070de836a9 100644 --- a/app/code/Magento/Translation/etc/adminhtml/di.xml +++ b/app/code/Magento/Translation/etc/adminhtml/di.xml @@ -12,7 +12,7 @@ <argument name="scope" xsi:type="string">admin</argument> </arguments> </type> - <type name="Magento\Translation\Model\Resource\String"> + <type name="Magento\Translation\Model\Resource\StringUtils"> <arguments> <argument name="scope" xsi:type="string">admin</argument> </arguments> diff --git a/app/code/Magento/Ui/Component/AbstractComponent.php b/app/code/Magento/Ui/Component/AbstractComponent.php index 0a15bafe991..b7a5b06c2de 100644 --- a/app/code/Magento/Ui/Component/AbstractComponent.php +++ b/app/code/Magento/Ui/Component/AbstractComponent.php @@ -5,7 +5,7 @@ */ namespace Magento\Ui\Component; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\View\Element\UiComponentInterface; use Magento\Framework\View\Element\UiComponent\ContextInterface; use Magento\Framework\View\Element\UiComponent\DataSourceInterface; @@ -14,7 +14,7 @@ use Magento\Framework\View\Element\UiComponent\DataSourceInterface; * Abstract class AbstractComponent * @SuppressWarnings(PHPMD.NumberOfChildren) */ -abstract class AbstractComponent extends Object implements UiComponentInterface +abstract class AbstractComponent extends DataObject implements UiComponentInterface { /** * Render context diff --git a/app/code/Magento/Ui/Component/Control/Item.php b/app/code/Magento/Ui/Component/Control/Item.php index 689daaca0c9..e12f0ea07a1 100644 --- a/app/code/Magento/Ui/Component/Control/Item.php +++ b/app/code/Magento/Ui/Component/Control/Item.php @@ -5,12 +5,12 @@ */ namespace Magento\Ui\Component\Control; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Class Item */ -class Item extends Object +class Item extends DataObject { // } diff --git a/app/code/Magento/Ui/Controller/Adminhtml/Bookmark/Save.php b/app/code/Magento/Ui/Controller/Adminhtml/Bookmark/Save.php index ceb603942ae..bde48047b77 100644 --- a/app/code/Magento/Ui/Controller/Adminhtml/Bookmark/Save.php +++ b/app/code/Magento/Ui/Controller/Adminhtml/Bookmark/Save.php @@ -91,6 +91,9 @@ class Save extends AbstractAction { $bookmark = $this->bookmarkFactory->create(); $jsonData = $this->_request->getParam('data'); + if (!$jsonData) { + throw new \InvalidArgumentException('Invalid parameter "data"'); + } $data = $this->jsonDecoder->decode($jsonData); $action = key($data); switch($action) { diff --git a/app/code/Magento/Ui/Model/Bookmark.php b/app/code/Magento/Ui/Model/Bookmark.php index 7ff285d9343..11a017febeb 100644 --- a/app/code/Magento/Ui/Model/Bookmark.php +++ b/app/code/Magento/Ui/Model/Bookmark.php @@ -110,7 +110,11 @@ class Bookmark extends AbstractModel implements BookmarkInterface */ public function getConfig() { - return $this->jsonDecoder->decode($this->getData(self::CONFIG)); + $config = $this->getData(self::CONFIG); + if ($config) { + return $this->jsonDecoder->decode($config); + } + return []; } /** diff --git a/app/code/Magento/Ui/Model/Resource/Bookmark.php b/app/code/Magento/Ui/Model/Resource/Bookmark.php index 7a673c669ca..a0a5ac9a4da 100644 --- a/app/code/Magento/Ui/Model/Resource/Bookmark.php +++ b/app/code/Magento/Ui/Model/Resource/Bookmark.php @@ -43,7 +43,7 @@ class Bookmark extends AbstractDb /** * Prepare data to be saved to database - * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\Object $object + * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\DataObject $object * * @return $this */ diff --git a/app/code/Magento/Ui/TemplateEngine/Xhtml/Compiler/Element/Content.php b/app/code/Magento/Ui/TemplateEngine/Xhtml/Compiler/Element/Content.php index fd6426a41c6..8b41cd5dd30 100644 --- a/app/code/Magento/Ui/TemplateEngine/Xhtml/Compiler/Element/Content.php +++ b/app/code/Magento/Ui/TemplateEngine/Xhtml/Compiler/Element/Content.php @@ -5,7 +5,7 @@ */ namespace Magento\Ui\TemplateEngine\Xhtml\Compiler\Element; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\View\Element\UiComponentInterface; use Magento\Framework\View\TemplateEngine\Xhtml\CompilerInterface; use Magento\Framework\View\TemplateEngine\Xhtml\Compiler\Element\ElementInterface; @@ -20,12 +20,16 @@ class Content implements ElementInterface * * @param CompilerInterface $compiler * @param \DOMElement $node - * @param Object $processedObject - * @param Object $context + * @param DataObject $processedObject + * @param DataObject $context * @return void */ - public function compile(CompilerInterface $compiler, \DOMElement $node, Object $processedObject, Object $context) - { + public function compile( + CompilerInterface $compiler, + \DOMElement $node, + DataObject $processedObject, + DataObject $context + ) { $name = $node->getAttribute('name'); /** @var UiComponentInterface $processedObject */ $content = (string)$processedObject->renderChildComponent($name); diff --git a/app/code/Magento/Ui/TemplateEngine/Xhtml/Compiler/Element/Form.php b/app/code/Magento/Ui/TemplateEngine/Xhtml/Compiler/Element/Form.php index 8af7844c08e..865e6e056df 100644 --- a/app/code/Magento/Ui/TemplateEngine/Xhtml/Compiler/Element/Form.php +++ b/app/code/Magento/Ui/TemplateEngine/Xhtml/Compiler/Element/Form.php @@ -5,7 +5,7 @@ */ namespace Magento\Ui\TemplateEngine\Xhtml\Compiler\Element; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\View\TemplateEngine\Xhtml\CompilerInterface; use Magento\Framework\View\TemplateEngine\Xhtml\Compiler\Element\ElementInterface; @@ -19,12 +19,16 @@ class Form implements ElementInterface * * @param CompilerInterface $compiler * @param \DOMElement $node - * @param Object $processedObject - * @param Object $context + * @param DataObject $processedObject + * @param DataObject $context * @return void */ - public function compile(CompilerInterface $compiler, \DOMElement $node, Object $processedObject, Object $context) - { + public function compile( + CompilerInterface $compiler, + \DOMElement $node, + DataObject $processedObject, + DataObject $context + ) { foreach ($this->getChildNodes($node) as $child) { $compiler->compile($child, $processedObject, $context); } diff --git a/app/code/Magento/Ui/TemplateEngine/Xhtml/Compiler/Element/Render.php b/app/code/Magento/Ui/TemplateEngine/Xhtml/Compiler/Element/Render.php index 6ab676b876d..7d12fdc4642 100644 --- a/app/code/Magento/Ui/TemplateEngine/Xhtml/Compiler/Element/Render.php +++ b/app/code/Magento/Ui/TemplateEngine/Xhtml/Compiler/Element/Render.php @@ -5,7 +5,7 @@ */ namespace Magento\Ui\TemplateEngine\Xhtml\Compiler\Element; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\View\Element\UiComponentInterface; use Magento\Framework\View\TemplateEngine\Xhtml\ResultInterface; use Magento\Framework\View\TemplateEngine\Xhtml\CompilerInterface; @@ -21,14 +21,18 @@ class Render implements ElementInterface * * @param CompilerInterface $compiler * @param \DOMElement $node - * @param Object $processedObject - * @param Object $context + * @param DataObject $processedObject + * @param DataObject $context * @return void * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function compile(CompilerInterface $compiler, \DOMElement $node, Object $processedObject, Object $context) - { + public function compile( + CompilerInterface $compiler, + \DOMElement $node, + DataObject $processedObject, + DataObject $context + ) { /** @var UiComponentInterface $processedObject */ $result = $processedObject->renderChildComponent($node->getAttribute('name')); if ($result instanceof ResultInterface) { diff --git a/app/code/Magento/Ui/Test/Unit/Component/Control/ActionPoolTest.php b/app/code/Magento/Ui/Test/Unit/Component/Control/ActionPoolTest.php index 8d62c797c2f..1e23a45abd8 100644 --- a/app/code/Magento/Ui/Test/Unit/Component/Control/ActionPoolTest.php +++ b/app/code/Magento/Ui/Test/Unit/Component/Control/ActionPoolTest.php @@ -7,7 +7,7 @@ namespace Magento\Ui\Test\Unit\Component\Control; use \Magento\Ui\Component\Control\ActionPool; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\View\Element\AbstractBlock; use Magento\Framework\View\Element\UiComponent\Context; use Magento\Framework\View\Element\UiComponentInterface; diff --git a/app/code/Magento/Ui/etc/di.xml b/app/code/Magento/Ui/etc/di.xml index df69d1edebb..a29e842f3ea 100644 --- a/app/code/Magento/Ui/etc/di.xml +++ b/app/code/Magento/Ui/etc/di.xml @@ -185,7 +185,7 @@ <item name="array" xsi:type="object">arrayArgumentInterpreterProxy</item> <item name="boolean" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\Boolean</item> <item name="number" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\Number</item> - <item name="string" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\String</item> + <item name="string" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\StringUtils</item> <item name="null" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\NullType</item> <item name="url" xsi:type="object">Magento\Framework\View\Layout\Argument\Interpreter\Url</item> </argument> diff --git a/app/code/Magento/Ups/Model/Carrier.php b/app/code/Magento/Ups/Model/Carrier.php index fdb91b82f9d..83c7e9ba0ee 100644 --- a/app/code/Magento/Ups/Model/Carrier.php +++ b/app/code/Magento/Ups/Model/Carrier.php @@ -188,10 +188,10 @@ class Carrier extends AbstractCarrierOnline implements CarrierInterface /** * Collect and get rates * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return Result|bool|null */ - public function collectRates(\Magento\Framework\Object $request) + public function collectRates(\Magento\Framework\DataObject $request) { if (!$this->getConfigFlag($this->_activeFlag)) { return false; @@ -218,7 +218,7 @@ class Carrier extends AbstractCarrierOnline implements CarrierInterface { $this->_request = $request; - $rowRequest = new \Magento\Framework\Object(); + $rowRequest = new \Magento\Framework\DataObject(); if ($request->getLimitMethod()) { $rowRequest->setAction($this->configHelper->getCode('action', 'single')); @@ -1151,13 +1151,13 @@ XMLAuth; /** * Form XML for shipment request * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return string * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - protected function _formShipmentRequest(\Magento\Framework\Object $request) + protected function _formShipmentRequest(\Magento\Framework\DataObject $request) { $packageParams = $request->getPackageParams(); $height = $packageParams->getHeight(); @@ -1169,7 +1169,7 @@ XMLAuth; $itemsDesc = []; $itemsShipment = $request->getPackageItems(); foreach ($itemsShipment as $itemShipment) { - $item = new \Magento\Framework\Object(); + $item = new \Magento\Framework\DataObject(); $item->setData($itemShipment); $itemsDesc[] = $item->getName(); } @@ -1377,7 +1377,7 @@ XMLAuth; * Send and process shipment accept request * * @param Element $shipmentConfirmResponse - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function _sendShipmentAcceptRequest(Element $shipmentConfirmResponse) { @@ -1412,7 +1412,7 @@ XMLAuth; $debugData['result'] = ['error' => $e->getMessage(), 'code' => $e->getCode()]; } - $result = new \Magento\Framework\Object(); + $result = new \Magento\Framework\DataObject(); if (isset($response->Error)) { $result->setErrors((string)$response->Error->ErrorDescription); } else { @@ -1445,14 +1445,14 @@ XMLAuth; /** * Do shipment request to carrier web service, obtain Print Shipping Labels and process errors in response * - * @param \Magento\Framework\Object $request - * @return \Magento\Framework\Object + * @param \Magento\Framework\DataObject $request + * @return \Magento\Framework\DataObject * @throws \Exception */ - protected function _doShipmentRequest(\Magento\Framework\Object $request) + protected function _doShipmentRequest(\Magento\Framework\DataObject $request) { $this->_prepareShipmentRequest($request); - $result = new \Magento\Framework\Object(); + $result = new \Magento\Framework\DataObject(); $xmlRequest = $this->_formShipmentRequest($request); $xmlResponse = $this->_getCachedQuotes($xmlRequest); @@ -1526,11 +1526,11 @@ XMLAuth; /** * Return container types of carrier * - * @param \Magento\Framework\Object|null $params + * @param \Magento\Framework\DataObject|null $params * @return array|bool * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - public function getContainerTypes(\Magento\Framework\Object $params = null) + public function getContainerTypes(\Magento\Framework\DataObject $params = null) { if ($params === null) { return $this->_getAllowedContainers($params); @@ -1606,10 +1606,10 @@ XMLAuth; /** * Return delivery confirmation types of carrier * - * @param \Magento\Framework\Object|null $params + * @param \Magento\Framework\DataObject|null $params * @return array|bool */ - public function getDeliveryConfirmationTypes(\Magento\Framework\Object $params = null) + public function getDeliveryConfirmationTypes(\Magento\Framework\DataObject $params = null) { $countryRecipient = $params != null ? $params->getCountryRecipient() : null; $deliveryConfirmationTypes = []; diff --git a/app/code/Magento/UrlRewrite/Block/Catalog/Product/Grid.php b/app/code/Magento/UrlRewrite/Block/Catalog/Product/Grid.php index f300660f42f..cbe06cd98ea 100644 --- a/app/code/Magento/UrlRewrite/Block/Catalog/Product/Grid.php +++ b/app/code/Magento/UrlRewrite/Block/Catalog/Product/Grid.php @@ -69,7 +69,7 @@ class Grid extends \Magento\Catalog\Block\Adminhtml\Product\Grid /** * Return row url for js event handlers * - * @param \Magento\Catalog\Model\Product|\Magento\Framework\Object $row + * @param \Magento\Catalog\Model\Product|\Magento\Framework\DataObject $row * @return string */ public function getRowUrl($row) diff --git a/app/code/Magento/UrlRewrite/Block/Cms/Page/Grid.php b/app/code/Magento/UrlRewrite/Block/Cms/Page/Grid.php index 04b9b9cb510..b7b1dcd9f4c 100644 --- a/app/code/Magento/UrlRewrite/Block/Cms/Page/Grid.php +++ b/app/code/Magento/UrlRewrite/Block/Cms/Page/Grid.php @@ -86,7 +86,7 @@ class Grid extends \Magento\Cms\Block\Adminhtml\Page\Grid /** * Return row url for js event handlers * - * @param \Magento\Cms\Model\Page|\Magento\Framework\Object $row + * @param \Magento\Cms\Model\Page|\Magento\Framework\DataObject $row * @return string */ public function getRowUrl($row) diff --git a/app/code/Magento/UrlRewrite/etc/config.xml b/app/code/Magento/UrlRewrite/etc/config.xml index 0179be80676..7ba6a643b33 100644 --- a/app/code/Magento/UrlRewrite/etc/config.xml +++ b/app/code/Magento/UrlRewrite/etc/config.xml @@ -10,13 +10,13 @@ <url_rewrite> <entity_types> <product> - <generator>Magento\Framework\Object</generator> + <generator>Magento\Framework\DataObject</generator> </product> <category> - <generator>Magento\Framework\Object</generator> + <generator>Magento\Framework\DataObject</generator> </category> <cms-page> - <generator>Magento\Framework\Object</generator> + <generator>Magento\Framework\DataObject</generator> </cms-page> </entity_types> </url_rewrite> diff --git a/app/code/Magento/User/Controller/Adminhtml/User/Validate.php b/app/code/Magento/User/Controller/Adminhtml/User/Validate.php index bf4cddb3a7c..25b49ff3999 100644 --- a/app/code/Magento/User/Controller/Adminhtml/User/Validate.php +++ b/app/code/Magento/User/Controller/Adminhtml/User/Validate.php @@ -15,7 +15,7 @@ class Validate extends \Magento\User\Controller\Adminhtml\User */ public function execute() { - $response = new \Magento\Framework\Object(); + $response = new \Magento\Framework\DataObject(); $response->setError(0); $errors = null; $userId = (int)$this->getRequest()->getParam('user_id'); diff --git a/app/code/Magento/User/Model/Resource/User.php b/app/code/Magento/User/Model/Resource/User.php index 992d8e1c834..b8ca8600e80 100644 --- a/app/code/Magento/User/Model/Resource/User.php +++ b/app/code/Magento/User/Model/Resource/User.php @@ -216,12 +216,12 @@ class User extends \Magento\Framework\Model\Resource\Db\AbstractDb /** @var \Magento\Authorization\Model\Role $parentRole */ $parentRole = $this->_roleFactory->create()->load($parentId); } else { - $role = new \Magento\Framework\Object(); + $role = new \Magento\Framework\DataObject(); $role->setTreeLevel(0); } if ($parentRole->getId()) { - $data = new \Magento\Framework\Object( + $data = new \Magento\Framework\DataObject( [ 'parent_id' => $parentRole->getId(), 'tree_level' => $parentRole->getTreeLevel() + 1, diff --git a/app/code/Magento/User/Model/User.php b/app/code/Magento/User/Model/User.php index 00878d88c5e..744fae46c38 100644 --- a/app/code/Magento/User/Model/User.php +++ b/app/code/Magento/User/Model/User.php @@ -77,7 +77,7 @@ class User extends AbstractModel implements StorageInterface, UserInterface /** * Factory for validator composite object * - * @var \Magento\Framework\Validator\ObjectFactory + * @var \Magento\Framework\Validator\DataObjectFactory */ protected $_validatorObject; @@ -118,7 +118,7 @@ class User extends AbstractModel implements StorageInterface, UserInterface * @param \Magento\Framework\Registry $registry * @param \Magento\User\Helper\Data $userData * @param \Magento\Backend\App\ConfigInterface $config - * @param \Magento\Framework\Validator\ObjectFactory $validatorObjectFactory + * @param \Magento\Framework\Validator\DataObjectFactory $validatorObjectFactory * @param \Magento\Authorization\Model\RoleFactory $roleFactory * @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder * @param \Magento\Framework\Encryption\EncryptorInterface $encryptor @@ -135,7 +135,7 @@ class User extends AbstractModel implements StorageInterface, UserInterface \Magento\Framework\Registry $registry, \Magento\User\Helper\Data $userData, \Magento\Backend\App\ConfigInterface $config, - \Magento\Framework\Validator\ObjectFactory $validatorObjectFactory, + \Magento\Framework\Validator\DataObjectFactory $validatorObjectFactory, \Magento\Authorization\Model\RoleFactory $roleFactory, \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder, \Magento\Framework\Encryption\EncryptorInterface $encryptor, @@ -201,7 +201,7 @@ class User extends AbstractModel implements StorageInterface, UserInterface $this->_userData = $objectManager->get('Magento\User\Helper\Data'); $this->_config = $objectManager->get('Magento\Backend\App\ConfigInterface'); $this->_registry = $objectManager->get('Magento\Framework\Registry'); - $this->_validatorObject = $objectManager->get('Magento\Framework\Validator\ObjectFactory'); + $this->_validatorObject = $objectManager->get('Magento\Framework\Validator\DataObjectFactory'); $this->_roleFactory = $objectManager->get('Magento\Authorization\Model\RoleFactory'); $this->_encryptor = $objectManager->get('Magento\Framework\Encryption\EncryptorInterface'); $this->_transportBuilder = $objectManager->get('Magento\Framework\Mail\Template\TransportBuilder'); @@ -250,7 +250,7 @@ class User extends AbstractModel implements StorageInterface, UserInterface */ protected function _getValidationRulesBeforeSave() { - /** @var $validator \Magento\Framework\Validator\Object */ + /** @var $validator \Magento\Framework\Validator\DataObject */ $validator = $this->_validatorObject->create(); $this->validationRules->addUserInfoRules($validator); @@ -273,7 +273,7 @@ class User extends AbstractModel implements StorageInterface, UserInterface */ public function validate() { - /** @var $validator \Magento\Framework\Validator\Object */ + /** @var $validator \Magento\Framework\Validator\DataObject */ $validator = $this->_validatorObject->create(); $this->validationRules->addUserInfoRules($validator); diff --git a/app/code/Magento/User/Model/UserValidationRules.php b/app/code/Magento/User/Model/UserValidationRules.php index a598543f39d..a3a279034f1 100644 --- a/app/code/Magento/User/Model/UserValidationRules.php +++ b/app/code/Magento/User/Model/UserValidationRules.php @@ -23,10 +23,10 @@ class UserValidationRules /** * Adds validation rule for user first name, last name, username and email * - * @param \Magento\Framework\Validator\Object $validator - * @return \Magento\Framework\Validator\Object + * @param \Magento\Framework\Validator\DataObject $validator + * @return \Magento\Framework\Validator\DataObject */ - public function addUserInfoRules(\Magento\Framework\Validator\Object $validator) + public function addUserInfoRules(\Magento\Framework\Validator\DataObject $validator) { $userNameNotEmpty = new NotEmpty(); $userNameNotEmpty->setMessage(__('User Name is a required field.'), \Zend_Validate_NotEmpty::IS_EMPTY); @@ -37,7 +37,7 @@ class UserValidationRules $emailValidity = new EmailAddress(); $emailValidity->setMessage(__('Please enter a valid email.'), \Zend_Validate_EmailAddress::INVALID); - /** @var $validator \Magento\Framework\Validator\Object */ + /** @var $validator \Magento\Framework\Validator\DataObject */ $validator->addRule( $userNameNotEmpty, 'username' @@ -58,10 +58,10 @@ class UserValidationRules /** * Adds validation rule for user password * - * @param \Magento\Framework\Validator\Object $validator - * @return \Magento\Framework\Validator\Object + * @param \Magento\Framework\Validator\DataObject $validator + * @return \Magento\Framework\Validator\DataObject */ - public function addPasswordRules(\Magento\Framework\Validator\Object $validator) + public function addPasswordRules(\Magento\Framework\Validator\DataObject $validator) { $passwordNotEmpty = new NotEmpty(); $passwordNotEmpty->setMessage(__('Password is required field.'), NotEmpty::IS_EMPTY); @@ -93,12 +93,12 @@ class UserValidationRules /** * Adds validation rule for user password confirmation * - * @param \Magento\Framework\Validator\Object $validator + * @param \Magento\Framework\Validator\DataObject $validator * @param string $passwordConfirmation - * @return \Magento\Framework\Validator\Object + * @return \Magento\Framework\Validator\DataObject */ public function addPasswordConfirmationRule( - \Magento\Framework\Validator\Object $validator, + \Magento\Framework\Validator\DataObject $validator, $passwordConfirmation ) { $passwordConfirmation = new \Zend_Validate_Identical($passwordConfirmation); diff --git a/app/code/Magento/User/Test/Unit/Model/UserTest.php b/app/code/Magento/User/Test/Unit/Model/UserTest.php index 76facbc520b..33a77515ccb 100644 --- a/app/code/Magento/User/Test/Unit/Model/UserTest.php +++ b/app/code/Magento/User/Test/Unit/Model/UserTest.php @@ -84,7 +84,7 @@ class UserTest extends \PHPUnit_Framework_TestCase [] )->getMock(); $objectFactoryMock = $this->getMockBuilder( - 'Magento\Framework\Validator\ObjectFactory' + 'Magento\Framework\Validator\DataObjectFactory' )->disableOriginalConstructor()->setMethods( ['create'] )->getMock(); diff --git a/app/code/Magento/User/Test/Unit/Model/UserValidationRulesTest.php b/app/code/Magento/User/Test/Unit/Model/UserValidationRulesTest.php index cf57de11ef0..ba2b025c55f 100644 --- a/app/code/Magento/User/Test/Unit/Model/UserValidationRulesTest.php +++ b/app/code/Magento/User/Test/Unit/Model/UserValidationRulesTest.php @@ -10,7 +10,7 @@ use Magento\User\Model\UserValidationRules; class UserValidationRulesTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Framework\Validator\Object|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Validator\DataObject|\PHPUnit_Framework_MockObject_MockObject */ private $validator; @@ -21,7 +21,7 @@ class UserValidationRulesTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->validator = $this->getMock('Magento\Framework\Validator\Object', [], [], '', false); + $this->validator = $this->getMock('Magento\Framework\Validator\DataObject', [], [], '', false); $this->rules = new UserValidationRules(); } diff --git a/app/code/Magento/Usps/Block/Rma/Adminhtml/Rma/Edit/Tab/General/Shipping/Packaging/Plugin.php b/app/code/Magento/Usps/Block/Rma/Adminhtml/Rma/Edit/Tab/General/Shipping/Packaging/Plugin.php index cc5bca51fa4..0bf227caf53 100644 --- a/app/code/Magento/Usps/Block/Rma/Adminhtml/Rma/Edit/Tab/General/Shipping/Packaging/Plugin.php +++ b/app/code/Magento/Usps/Block/Rma/Adminhtml/Rma/Edit/Tab/General/Shipping/Packaging/Plugin.php @@ -43,12 +43,12 @@ class Plugin /** * Add rule to isGirthAllowed() method * - * @param \Magento\Framework\Object $subject $subject + * @param \Magento\Framework\DataObject $subject $subject * @param bool $result * @return bool * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function afterIsGirthAllowed(\Magento\Framework\Object $subject, $result) + public function afterIsGirthAllowed(\Magento\Framework\DataObject $subject, $result) { return $result && $this->uspsHelper->displayGirthValue($this->request->getParam('method')); } @@ -56,12 +56,12 @@ class Plugin /** * Add rule to isGirthAllowed() method * - * @param \Magento\Framework\Object $subject + * @param \Magento\Framework\DataObject $subject * @param \Closure $proceed * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundCheckSizeAndGirthParameter(\Magento\Framework\Object $subject, \Closure $proceed) + public function aroundCheckSizeAndGirthParameter(\Magento\Framework\DataObject $subject, \Closure $proceed) { $carrier = $subject->getCarrier(); $size = $subject->getSourceSizeModel(); diff --git a/app/code/Magento/Usps/Model/Carrier.php b/app/code/Magento/Usps/Model/Carrier.php index eb2b5f32342..f6e101b4f9c 100644 --- a/app/code/Magento/Usps/Model/Carrier.php +++ b/app/code/Magento/Usps/Model/Carrier.php @@ -181,10 +181,10 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C /** * Collect and get rates * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return Result|bool|null */ - public function collectRates(\Magento\Framework\Object $request) + public function collectRates(\Magento\Framework\DataObject $request) { if (!$this->getConfigFlag($this->_activeFlag)) { return false; @@ -212,7 +212,7 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C { $this->_request = $request; - $r = new \Magento\Framework\Object(); + $r = new \Magento\Framework\DataObject(); if ($request->getLimitMethod()) { $r->setService($request->getLimitMethod()); @@ -977,7 +977,7 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C */ protected function setTrackingReqeust() { - $r = new \Magento\Framework\Object(); + $r = new \Magento\Framework\DataObject(); $userId = $this->getConfigData('userid'); $r->setUserId($userId); @@ -1401,10 +1401,10 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C * As integration guide it is important to follow appropriate sequence for tags e.g.: <FromLastName /> must be * after <FromFirstName /> * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return string */ - protected function _formUsExpressShipmentRequest(\Magento\Framework\Object $request) + protected function _formUsExpressShipmentRequest(\Magento\Framework\DataObject $request) { $packageParams = $request->getPackageParams(); @@ -1467,13 +1467,13 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C * As integration guide it is important to follow appropriate sequence for tags e.g.: <FromLastName /> must be * after <FromFirstName /> * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @param string $serviceType * @return string * @throws \Exception * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - protected function _formUsSignatureConfirmationShipmentRequest(\Magento\Framework\Object $request, $serviceType) + protected function _formUsSignatureConfirmationShipmentRequest(\Magento\Framework\DataObject $request, $serviceType) { switch ($serviceType) { case 'PRIORITY': @@ -1569,13 +1569,13 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C * As integration guide it is important to follow appropriate sequence for tags e.g.: <FromLastName /> must be * after <FromFirstName /> * - * @param \Magento\Framework\Object $request + * @param \Magento\Framework\DataObject $request * @return string * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - protected function _formIntlShipmentRequest(\Magento\Framework\Object $request) + protected function _formIntlShipmentRequest(\Magento\Framework\DataObject $request) { $packageParams = $request->getPackageParams(); $height = $packageParams->getHeight(); @@ -1727,7 +1727,7 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C $countriesOfManufacture = []; $productIds = []; foreach ($packageItems as $itemShipment) { - $item = new \Magento\Framework\Object(); + $item = new \Magento\Framework\DataObject(); $item->setData($itemShipment); $productIds[] = $item->getProductId(); @@ -1747,7 +1747,7 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C $packagePoundsWeight = $packageOuncesWeight = 0; // for ItemDetail foreach ($packageItems as $itemShipment) { - $item = new \Magento\Framework\Object(); + $item = new \Magento\Framework\DataObject(); $item->setData($itemShipment); $itemWeight = $item->getWeight() * $item->getQty(); @@ -1823,14 +1823,14 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C /** * Do shipment request to carrier web service, obtain Print Shipping Labels and process errors in response * - * @param \Magento\Framework\Object $request - * @return \Magento\Framework\Object + * @param \Magento\Framework\DataObject $request + * @return \Magento\Framework\DataObject * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - protected function _doShipmentRequest(\Magento\Framework\Object $request) + protected function _doShipmentRequest(\Magento\Framework\DataObject $request) { $this->_prepareShipmentRequest($request); - $result = new \Magento\Framework\Object(); + $result = new \Magento\Framework\DataObject(); $service = $this->getCode('service_to_code', $request->getShippingMethod()); $recipientUSCountry = $this->_isUSCountry($request->getRecipientAddressCountryCode()); @@ -1906,10 +1906,10 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C /** * Return container types of carrier * - * @param \Magento\Framework\Object|null $params + * @param \Magento\Framework\DataObject|null $params * @return array|bool */ - public function getContainerTypes(\Magento\Framework\Object $params = null) + public function getContainerTypes(\Magento\Framework\DataObject $params = null) { if (is_null($params)) { return $this->_getAllowedContainers(); @@ -1940,10 +1940,10 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C /** * Return delivery confirmation types of carrier * - * @param \Magento\Framework\Object|null $params + * @param \Magento\Framework\DataObject|null $params * @return array */ - public function getDeliveryConfirmationTypes(\Magento\Framework\Object $params = null) + public function getDeliveryConfirmationTypes(\Magento\Framework\DataObject $params = null) { if ($params == null) { return []; @@ -1970,10 +1970,10 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C /** * Return content types of package * - * @param \Magento\Framework\Object $params + * @param \Magento\Framework\DataObject $params * @return array */ - public function getContentTypes(\Magento\Framework\Object $params) + public function getContentTypes(\Magento\Framework\DataObject $params) { $countryShipper = $params->getCountryShipper(); $countryRecipient = $params->getCountryRecipient(); diff --git a/app/code/Magento/Variable/Controller/Adminhtml/System/Variable/Validate.php b/app/code/Magento/Variable/Controller/Adminhtml/System/Variable/Validate.php index 86882a583a1..75876b96cfe 100644 --- a/app/code/Magento/Variable/Controller/Adminhtml/System/Variable/Validate.php +++ b/app/code/Magento/Variable/Controller/Adminhtml/System/Variable/Validate.php @@ -15,7 +15,7 @@ class Validate extends \Magento\Variable\Controller\Adminhtml\System\Variable */ public function execute() { - $response = new \Magento\Framework\Object(['error' => false]); + $response = new \Magento\Framework\DataObject(['error' => false]); $variable = $this->_initVariable(); $variable->addData($this->getRequest()->getPost('variable')); $result = $variable->validate(); diff --git a/app/code/Magento/Variable/Model/Resource/Variable.php b/app/code/Magento/Variable/Model/Resource/Variable.php index 6e637cc43dc..0ff49a5c54f 100644 --- a/app/code/Magento/Variable/Model/Resource/Variable.php +++ b/app/code/Magento/Variable/Model/Resource/Variable.php @@ -86,7 +86,7 @@ class Variable extends \Magento\Framework\Model\Resource\Db\AbstractDb 'plain_value' => $object->getPlainValue(), 'html_value' => $object->getHtmlValue(), ]; - $data = $this->_prepareDataForTable(new \Magento\Framework\Object($data), $this->getTable('variable_value')); + $data = $this->_prepareDataForTable(new \Magento\Framework\DataObject($data), $this->getTable('variable_value')); $this->_getWriteAdapter()->insertOnDuplicate( $this->getTable('variable_value'), $data, diff --git a/app/code/Magento/Variable/Model/Variable/Config.php b/app/code/Magento/Variable/Model/Variable/Config.php index f89c73d9fae..841419796f4 100644 --- a/app/code/Magento/Variable/Model/Variable/Config.php +++ b/app/code/Magento/Variable/Model/Variable/Config.php @@ -38,7 +38,7 @@ class Config /** * Prepare variable wysiwyg config * - * @param \Magento\Framework\Object $config + * @param \Magento\Framework\DataObject $config * @return array */ public function getWysiwygPluginSettings($config) diff --git a/app/code/Magento/Variable/Test/Unit/Model/Variable/ConfigTest.php b/app/code/Magento/Variable/Test/Unit/Model/Variable/ConfigTest.php index a00c5ca54ef..7f82b76cf15 100644 --- a/app/code/Magento/Variable/Test/Unit/Model/Variable/ConfigTest.php +++ b/app/code/Magento/Variable/Test/Unit/Model/Variable/ConfigTest.php @@ -37,7 +37,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $customKey = 'key'; $customVal = 'val'; - $configObject = new \Magento\Framework\Object(); + $configObject = new \Magento\Framework\DataObject(); $configObject->setPlugins([[$customKey => $customVal]]); $variablePluginConfig = $model->getWysiwygPluginSettings($configObject)['plugins']; diff --git a/app/code/Magento/Webapi/Test/Unit/Controller/Soap/Request/HandlerTest.php b/app/code/Magento/Webapi/Test/Unit/Controller/Soap/Request/HandlerTest.php index 8c3741c3b8d..43dc35c0b03 100644 --- a/app/code/Magento/Webapi/Test/Unit/Controller/Soap/Request/HandlerTest.php +++ b/app/code/Magento/Webapi/Test/Unit/Controller/Soap/Request/HandlerTest.php @@ -105,7 +105,7 @@ class HandlerTest extends \PHPUnit_Framework_TestCase ->method('convertStdObjectToArray') ->will($this->returnValue(['field' => 1])); $operationName = 'soapOperation'; - $className = 'Magento\Framework\Object'; + $className = 'Magento\Framework\DataObject'; $methodName = 'testMethod'; $isSecure = false; $aclResources = [['Magento_TestModule::resourceA']]; diff --git a/app/code/Magento/Webapi/Test/Unit/Model/Plugin/ManagerTest.php b/app/code/Magento/Webapi/Test/Unit/Model/Plugin/ManagerTest.php index ea633db8853..fa052a5619e 100644 --- a/app/code/Magento/Webapi/Test/Unit/Model/Plugin/ManagerTest.php +++ b/app/code/Magento/Webapi/Test/Unit/Model/Plugin/ManagerTest.php @@ -123,7 +123,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase ); $firstInegrationId = 1; - $integrationsData1 = new \Magento\Framework\Object( + $integrationsData1 = new \Magento\Framework\DataObject( [ 'id' => $firstInegrationId, Integration::NAME => 'TestIntegration1', @@ -134,7 +134,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase ); $secondIntegrationId = 2; - $integrationsData2 = new \Magento\Framework\Object( + $integrationsData2 = new \Magento\Framework\DataObject( [ 'id' => $secondIntegrationId, Integration::NAME => 'TestIntegration2', diff --git a/app/code/Magento/Weee/Block/Renderer/Weee/Tax.php b/app/code/Magento/Weee/Block/Renderer/Weee/Tax.php index 8644594b554..58dc342ff64 100644 --- a/app/code/Magento/Weee/Block/Renderer/Weee/Tax.php +++ b/app/code/Magento/Weee/Block/Renderer/Weee/Tax.php @@ -73,7 +73,7 @@ class Tax extends \Magento\Backend\Block\Widget implements \Magento\Framework\Da } /** - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getProduct() { diff --git a/app/code/Magento/Weee/Block/Sales/Order/Totals.php b/app/code/Magento/Weee/Block/Sales/Order/Totals.php index bdf68055ab4..c9762041ff9 100644 --- a/app/code/Magento/Weee/Block/Sales/Order/Totals.php +++ b/app/code/Magento/Weee/Block/Sales/Order/Totals.php @@ -50,7 +50,7 @@ class Totals extends \Magento\Framework\View\Element\Template $weeeTotal = $this->weeeData->getTotalAmounts($items, $store); if ($weeeTotal) { // Add our total information to the set of other totals - $total = new \Magento\Framework\Object( + $total = new \Magento\Framework\DataObject( [ 'code' => $this->getNameInLayout(), 'label' => __('FPT'), diff --git a/app/code/Magento/Weee/Helper/Data.php b/app/code/Magento/Weee/Helper/Data.php index a3d42882161..12b0166b8ed 100644 --- a/app/code/Magento/Weee/Helper/Data.php +++ b/app/code/Magento/Weee/Helper/Data.php @@ -260,11 +260,11 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper * Proxy for \Magento\Weee\Model\Tax::getProductWeeeAttributes() * * @param \Magento\Catalog\Model\Product $product - * @param null|false|\Magento\Framework\Object $shipping - * @param null|false|\Magento\Framework\Object $billing + * @param null|false|\Magento\Framework\DataObject $shipping + * @param null|false|\Magento\Framework\DataObject $billing * @param Website $website * @param bool $calculateTaxes - * @return \Magento\Framework\Object[] + * @return \Magento\Framework\DataObject[] */ public function getProductWeeeAttributes( $product, @@ -328,7 +328,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper * Returns array of weee attributes allowed for display * * @param \Magento\Catalog\Model\Product $product - * @return \Magento\Framework\Object[] + * @return \Magento\Framework\DataObject[] */ public function getProductWeeeAttributesForDisplay($product) { @@ -345,11 +345,11 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper * Get Product Weee attributes for price renderer * * @param \Magento\Catalog\Model\Product $product - * @param null|false|\Magento\Framework\Object $shipping Shipping Address - * @param null|false|\Magento\Framework\Object $billing Billing Address + * @param null|false|\Magento\Framework\DataObject $shipping Shipping Address + * @param null|false|\Magento\Framework\DataObject $billing Billing Address * @param null|Website $website * @param bool $calculateTaxes - * @return \Magento\Framework\Object[] + * @return \Magento\Framework\DataObject[] */ public function getProductWeeeAttributesForRenderer( $product, @@ -397,7 +397,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper /** * Returns all summed WEEE taxes with all local taxes applied * - * @param \Magento\Framework\Object[] $attributes Result from getProductWeeeAttributes() + * @param \Magento\Framework\DataObject[] $attributes Result from getProductWeeeAttributes() * @return float * @throws \Magento\Framework\Exception\LocalizedException */ @@ -409,7 +409,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper $amount = 0; foreach ($attributes as $attribute) { - /* @var $attribute \Magento\Framework\Object */ + /* @var $attribute \Magento\Framework\DataObject */ $amount += $attribute->getAmountInclTax(); } diff --git a/app/code/Magento/Weee/Model/Tax.php b/app/code/Magento/Weee/Model/Tax.php index 91dd14ffa3f..d1302b6169f 100644 --- a/app/code/Magento/Weee/Model/Tax.php +++ b/app/code/Magento/Weee/Model/Tax.php @@ -139,8 +139,8 @@ class Tax extends \Magento\Framework\Model\AbstractModel /** * @param Product $product - * @param null|false|\Magento\Framework\Object $shipping - * @param null|false|\Magento\Framework\Object $billing + * @param null|false|\Magento\Framework\DataObject $shipping + * @param null|false|\Magento\Framework\DataObject $billing * @param Website $website * @param bool $calculateTax * @return int @@ -200,7 +200,7 @@ class Tax extends \Magento\Framework\Model\AbstractModel * @param null|false|\Magento\Quote\Model\Quote\Address $billing * @param Website $website * @param bool $calculateTax - * @return \Magento\Framework\Object[] + * @return \Magento\Framework\DataObject[] * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ @@ -237,10 +237,10 @@ class Tax extends \Magento\Framework\Model\AbstractModel $shippingAddressArray = $this->_customerSession->getDefaultTaxShippingAddress(); $billingAddressArray = $this->_customerSession->getDefaultTaxBillingAddress(); if (!empty($billingAddressArray)) { - $billing = new \Magento\Framework\Object($billingAddressArray); + $billing = new \Magento\Framework\DataObject($billingAddressArray); } if (!empty($shippingAddressArray)) { - $shipping = new \Magento\Framework\Object($shippingAddressArray); + $shipping = new \Magento\Framework\DataObject($shippingAddressArray); } $customerTaxClass = $this->_customerSession->getCustomerTaxClassId(); } @@ -320,7 +320,7 @@ class Tax extends \Magento\Framework\Model\AbstractModel } } - $one = new \Magento\Framework\Object(); + $one = new \Magento\Framework\DataObject(); $one->setName(__($attribute->getFrontend()->getLabel())) ->setAmount($amount) ->setTaxAmount($taxAmount) diff --git a/app/code/Magento/Weee/Model/Total/Observer/Webapi/Item.php b/app/code/Magento/Weee/Model/Total/Observer/Webapi/Item.php index cfc430bee6c..5d851c4e2d2 100644 --- a/app/code/Magento/Weee/Model/Total/Observer/Webapi/Item.php +++ b/app/code/Magento/Weee/Model/Total/Observer/Webapi/Item.php @@ -35,7 +35,7 @@ class Item } /** - * @param \Magento\Framework\Object $observer + * @param \Magento\Framework\DataObject $observer * @return \Magento\Quote\Model\Quote\Item */ public function processTaxData($observer) diff --git a/app/code/Magento/Weee/Pricing/Render/Adjustment.php b/app/code/Magento/Weee/Pricing/Render/Adjustment.php index f13c044532f..1dea449b039 100644 --- a/app/code/Magento/Weee/Pricing/Render/Adjustment.php +++ b/app/code/Magento/Weee/Pricing/Render/Adjustment.php @@ -121,7 +121,7 @@ class Adjustment extends AbstractAdjustment /** * Obtain Weee tax attributes * - * @return array|\Magento\Framework\Object[] + * @return array|\Magento\Framework\DataObject[] */ public function getWeeeTaxAttributes() { @@ -131,10 +131,10 @@ class Adjustment extends AbstractAdjustment /** * Render Weee tax attributes name * - * @param \Magento\Framework\Object $attribute + * @param \Magento\Framework\DataObject $attribute * @return string */ - public function renderWeeeTaxAttributeName(\Magento\Framework\Object $attribute) + public function renderWeeeTaxAttributeName(\Magento\Framework\DataObject $attribute) { return $attribute->getData('name'); } @@ -142,10 +142,10 @@ class Adjustment extends AbstractAdjustment /** * Render Weee tax attributes value * - * @param \Magento\Framework\Object $attribute + * @param \Magento\Framework\DataObject $attribute * @return string */ - public function renderWeeeTaxAttribute(\Magento\Framework\Object $attribute) + public function renderWeeeTaxAttribute(\Magento\Framework\DataObject $attribute) { return $this->convertAndFormatCurrency($attribute->getData('amount')); } @@ -165,7 +165,7 @@ class Adjustment extends AbstractAdjustment /** * Get Weee attributes for display * - * @return \Magento\Framework\Object[] + * @return \Magento\Framework\DataObject[] */ protected function getWeeeAttributesForDisplay() { diff --git a/app/code/Magento/Weee/Test/Unit/Helper/DataTest.php b/app/code/Magento/Weee/Test/Unit/Helper/DataTest.php index 6e8db3462be..cf9dc2962c7 100644 --- a/app/code/Magento/Weee/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/Weee/Test/Unit/Helper/DataTest.php @@ -151,7 +151,7 @@ class DataTest extends \PHPUnit_Framework_TestCase public function testGetWeeAttributesForBundle() { - $weeObject = new \Magento\Framework\Object( + $weeObject = new \Magento\Framework\DataObject( [ 'code' => 'fpt', 'amount' => '15.0000', diff --git a/app/code/Magento/Weee/Test/Unit/Model/ObserverTest.php b/app/code/Magento/Weee/Test/Unit/Model/ObserverTest.php index 1e9fb7572bf..376674c146e 100644 --- a/app/code/Magento/Weee/Test/Unit/Model/ObserverTest.php +++ b/app/code/Magento/Weee/Test/Unit/Model/ObserverTest.php @@ -21,7 +21,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase */ public function testGetPriceConfiguration($testArray, $expectedArray) { - $configObj = new \Magento\Framework\Object( + $configObj = new \Magento\Framework\DataObject( [ 'config' => $testArray, ] @@ -212,13 +212,13 @@ class ObserverTest extends \PHPUnit_Framework_TestCase */ public function testUpdateProductOptions($testArray, $weeDisplay, $weeEnabled, $expectedArray) { - $configObj = new \Magento\Framework\Object( + $configObj = new \Magento\Framework\DataObject( [ 'additional_options' => $testArray, ] ); - $weeObject = new \Magento\Framework\Object( + $weeObject = new \Magento\Framework\DataObject( [ 'code' => 'fpt', 'amount' => '15.0000', diff --git a/app/code/Magento/Weee/Test/Unit/Model/Total/Observer/Webapi/ItemTest.php b/app/code/Magento/Weee/Test/Unit/Model/Total/Observer/Webapi/ItemTest.php index 772907c4b11..b826c8b4fa9 100644 --- a/app/code/Magento/Weee/Test/Unit/Model/Total/Observer/Webapi/ItemTest.php +++ b/app/code/Magento/Weee/Test/Unit/Model/Total/Observer/Webapi/ItemTest.php @@ -79,7 +79,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase $expectedPrice, $expectedPriceInclTax ) { - $observerMock = $this->getMock('Magento\Framework\Object', ['getEvent'], [], '', false); + $observerMock = $this->getMock('Magento\Framework\DataObject', ['getEvent'], [], '', false); $eventMock = $this->getMock('Magento\Framework\Event', ['getItem'], [], '', false); $itemMock = $this->getMock( 'Magento\Quote\Model\Quote\Item', diff --git a/app/code/Magento/Weee/Test/Unit/Model/Total/Quote/WeeeTaxTest.php b/app/code/Magento/Weee/Test/Unit/Model/Total/Quote/WeeeTaxTest.php index 0bc8817879b..740ad7cc0de 100644 --- a/app/code/Magento/Weee/Test/Unit/Model/Total/Quote/WeeeTaxTest.php +++ b/app/code/Magento/Weee/Test/Unit/Model/Total/Quote/WeeeTaxTest.php @@ -47,8 +47,8 @@ class WeeeTaxTest extends \PHPUnit_Framework_TestCase $taxCalculation = $this->getMock('Magento\Tax\Model\Calculation', [], [], '', false); - $rateRequest = new \Magento\Framework\Object(); - $defaultRateRequest = new \Magento\Framework\Object(); + $rateRequest = new \Magento\Framework\DataObject(); + $defaultRateRequest = new \Magento\Framework\DataObject(); $taxCalculation->expects($this->any())->method('getRateRequest')->will($this->returnValue($rateRequest)); $taxCalculation @@ -287,7 +287,7 @@ class WeeeTaxTest extends \PHPUnit_Framework_TestCase 'isTaxable' => true, 'getApplied' => [], 'getProductWeeeAttributes' => [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'name' => 'Recycling Fee', 'amount' => 10, @@ -331,7 +331,7 @@ class WeeeTaxTest extends \PHPUnit_Framework_TestCase 'isTaxable' => true, 'getApplied' => [], 'getProductWeeeAttributes' => [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'name' => 'Recycling Fee', 'amount' => 10, @@ -375,7 +375,7 @@ class WeeeTaxTest extends \PHPUnit_Framework_TestCase 'isTaxable' => true, 'getApplied' => [], 'getProductWeeeAttributes' => [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'name' => 'Recycling Fee', 'amount' => 10, @@ -419,7 +419,7 @@ class WeeeTaxTest extends \PHPUnit_Framework_TestCase 'isTaxable' => false, 'getApplied' => [], 'getProductWeeeAttributes' => [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'name' => 'Recycling Fee', 'amount' => 10, @@ -457,7 +457,7 @@ class WeeeTaxTest extends \PHPUnit_Framework_TestCase 'isTaxable' => false, 'getApplied' => [], 'getProductWeeeAttributes' => [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'name' => 'Recycling Fee', 'amount' => 10, @@ -495,7 +495,7 @@ class WeeeTaxTest extends \PHPUnit_Framework_TestCase 'isTaxable' => true, 'getApplied' => [], 'getProductWeeeAttributes' => [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'name' => 'Recycling Fee', 'amount' => 10, @@ -539,7 +539,7 @@ class WeeeTaxTest extends \PHPUnit_Framework_TestCase 'isTaxable' => true, 'getApplied' => [], 'getProductWeeeAttributes' => [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'name' => 'Recycling Fee', 'amount' => 10, @@ -583,7 +583,7 @@ class WeeeTaxTest extends \PHPUnit_Framework_TestCase 'isTaxable' => false, 'getApplied' => [], 'getProductWeeeAttributes' => [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'name' => 'Recycling Fee', 'amount' => 10, @@ -621,7 +621,7 @@ class WeeeTaxTest extends \PHPUnit_Framework_TestCase 'isTaxable' => false, 'getApplied' => [], 'getProductWeeeAttributes' => [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'name' => 'Recycling Fee', 'amount' => 10, diff --git a/app/code/Magento/Weee/Test/Unit/Model/Total/Quote/WeeeTest.php b/app/code/Magento/Weee/Test/Unit/Model/Total/Quote/WeeeTest.php index 57d8f74e6b0..905906feae0 100644 --- a/app/code/Magento/Weee/Test/Unit/Model/Total/Quote/WeeeTest.php +++ b/app/code/Magento/Weee/Test/Unit/Model/Total/Quote/WeeeTest.php @@ -44,8 +44,8 @@ class WeeeTest extends \PHPUnit_Framework_TestCase $taxCalculation = $this->getMock('Magento\Tax\Model\Calculation', [], [], '', false); - $rateRequest = new \Magento\Framework\Object(); - $defaultRateRequest = new \Magento\Framework\Object(); + $rateRequest = new \Magento\Framework\DataObject(); + $defaultRateRequest = new \Magento\Framework\DataObject(); $taxCalculation->expects($this->any())->method('getRateRequest')->will($this->returnValue($rateRequest)); $taxCalculation @@ -229,7 +229,7 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'isTaxable' => true, 'getApplied' => [], 'getProductWeeeAttributes' => [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'name' => 'Recycling Fee', 'amount' => 10, @@ -269,7 +269,7 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'isTaxable' => true, 'getApplied' => [], 'getProductWeeeAttributes' => [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'name' => 'Recycling Fee', 'amount' => 10, @@ -309,7 +309,7 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'isTaxable' => true, 'getApplied' => [], 'getProductWeeeAttributes' => [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'name' => 'Recycling Fee', 'amount' => 10, @@ -349,7 +349,7 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'isTaxable' => false, 'getApplied' => [], 'getProductWeeeAttributes' => [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'name' => 'Recycling Fee', 'amount' => 10, @@ -391,7 +391,7 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'isTaxable' => false, 'getApplied' => [], 'getProductWeeeAttributes' => [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'name' => 'Recycling Fee', 'amount' => 10, @@ -433,7 +433,7 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'isTaxable' => true, 'getApplied' => [], 'getProductWeeeAttributes' => [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'name' => 'Recycling Fee', 'amount' => 10, @@ -473,7 +473,7 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'isTaxable' => true, 'getApplied' => [], 'getProductWeeeAttributes' => [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'name' => 'Recycling Fee', 'amount' => 10, @@ -513,7 +513,7 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'isTaxable' => false, 'getApplied' => [], 'getProductWeeeAttributes' => [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'name' => 'Recycling Fee', 'amount' => 10, @@ -555,7 +555,7 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'isTaxable' => false, 'getApplied' => [], 'getProductWeeeAttributes' => [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'name' => 'Recycling Fee', 'amount' => 10, @@ -597,7 +597,7 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'isTaxable' => false, 'getApplied' => [], 'getProductWeeeAttributes' => [ - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'name' => 'Recycling Fee', 'amount' => 10, diff --git a/app/code/Magento/Weee/Test/Unit/Pricing/Render/AdjustmentTest.php b/app/code/Magento/Weee/Test/Unit/Pricing/Render/AdjustmentTest.php index 08bbed524df..58a596fb57f 100644 --- a/app/code/Magento/Weee/Test/Unit/Pricing/Render/AdjustmentTest.php +++ b/app/code/Magento/Weee/Test/Unit/Pricing/Render/AdjustmentTest.php @@ -333,7 +333,7 @@ class AdjustmentTest extends \PHPUnit_Framework_TestCase /** * Test for method renderWeeeTaxAttribute * - * @param \Magento\Framework\Object $attribute + * @param \Magento\Framework\DataObject $attribute * @param string $expectedResult * @dataProvider renderWeeeTaxAttributeAmountDataProvider */ @@ -353,15 +353,15 @@ class AdjustmentTest extends \PHPUnit_Framework_TestCase public function renderWeeeTaxAttributeAmountDataProvider() { return [ - [new \Magento\Framework\Object(['amount' => 51]), 51], - [new \Magento\Framework\Object(['amount' => false]), false], + [new \Magento\Framework\DataObject(['amount' => 51]), 51], + [new \Magento\Framework\DataObject(['amount' => false]), false], ]; } /** * Test for method renderWeeeTaxAttributeName * - * @param \Magento\Framework\Object $attribute + * @param \Magento\Framework\DataObject $attribute * @param string $expectedResult * @dataProvider renderWeeeTaxAttributeNameDataProvider */ @@ -381,8 +381,8 @@ class AdjustmentTest extends \PHPUnit_Framework_TestCase public function renderWeeeTaxAttributeNameDataProvider() { return [ - [new \Magento\Framework\Object(['name' => 51]), 51], - [new \Magento\Framework\Object(['name' => false]), false], + [new \Magento\Framework\DataObject(['name' => 51]), 51], + [new \Magento\Framework\DataObject(['name' => false]), false], ]; } } diff --git a/app/code/Magento/Weee/etc/fieldset.xml b/app/code/Magento/Weee/etc/fieldset.xml index 3412772efed..b61556e6758 100644 --- a/app/code/Magento/Weee/etc/fieldset.xml +++ b/app/code/Magento/Weee/etc/fieldset.xml @@ -6,7 +6,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Object/etc/fieldset.xsd"> + xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/DataObject/etc/fieldset.xsd"> <scope id="global"> <fieldset id="quote_convert_item"> <field name="weee_tax_applied"> diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Chooser.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Chooser.php index 8d49f625148..3953b63bdf0 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Chooser.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Chooser.php @@ -63,16 +63,16 @@ class Chooser extends \Magento\Backend\Block\Template /** * Convert Array config to Object * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getConfig() { - if ($this->_getData('config') instanceof \Magento\Framework\Object) { + if ($this->_getData('config') instanceof \Magento\Framework\DataObject) { return $this->_getData('config'); } $configArray = $this->_getData('config'); - $config = new \Magento\Framework\Object(); + $config = new \Magento\Framework\DataObject(); $this->setConfig($config); if (!is_array($configArray)) { return $this->_getData('config'); diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Properties.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Properties.php index e138996deac..5712fc02c88 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Properties.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Properties.php @@ -105,7 +105,7 @@ class Properties extends \Magento\Widget\Block\Adminhtml\Widget\Options implemen /** * Add field to Options form based on option configuration * - * @param \Magento\Framework\Object $parameter + * @param \Magento\Framework\DataObject $parameter * @return \Magento\Framework\Data\Form\Element\AbstractElement */ protected function _addField($parameter) diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php index b961c73a8b6..ee8b79d2f21 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php @@ -132,7 +132,7 @@ class Options extends \Magento\Backend\Block\Widget\Form\Generic /** * Add field to Options form based on parameter configuration * - * @param \Magento\Framework\Object $parameter + * @param \Magento\Framework\DataObject $parameter * @return \Magento\Framework\Data\Form\Element\AbstractElement * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) @@ -200,7 +200,7 @@ class Options extends \Magento\Backend\Block\Widget\Form\Generic '', ['data' => $helper->getData()] ); - if ($helperBlock instanceof \Magento\Framework\Object) { + if ($helperBlock instanceof \Magento\Framework\DataObject) { $helperBlock->setConfig( $helper->getData() )->setFieldsetId( diff --git a/app/code/Magento/Widget/Block/BlockInterface.php b/app/code/Magento/Widget/Block/BlockInterface.php index e29467de57f..d510ef97746 100644 --- a/app/code/Magento/Widget/Block/BlockInterface.php +++ b/app/code/Magento/Widget/Block/BlockInterface.php @@ -31,7 +31,7 @@ interface BlockInterface * * @param string|array $key * @param mixed $value - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function setData($key, $value = null); } diff --git a/app/code/Magento/Widget/Controller/Adminhtml/Widget/Instance/Validate.php b/app/code/Magento/Widget/Controller/Adminhtml/Widget/Instance/Validate.php index 52aa90613f7..fe2bb5aaf69 100644 --- a/app/code/Magento/Widget/Controller/Adminhtml/Widget/Instance/Validate.php +++ b/app/code/Magento/Widget/Controller/Adminhtml/Widget/Instance/Validate.php @@ -15,7 +15,7 @@ class Validate extends \Magento\Widget\Controller\Adminhtml\Widget\Instance */ public function execute() { - $response = new \Magento\Framework\Object(); + $response = new \Magento\Framework\DataObject(); $response->setError(false); $widgetInstance = $this->_initWidgetInstance(); $result = $widgetInstance->validate(); diff --git a/app/code/Magento/Widget/Model/Template/Filter.php b/app/code/Magento/Widget/Model/Template/Filter.php index 634ed2b9d6b..a07bdd85de4 100644 --- a/app/code/Magento/Widget/Model/Template/Filter.php +++ b/app/code/Magento/Widget/Model/Template/Filter.php @@ -22,7 +22,7 @@ class Filter extends \Magento\Cms\Model\Template\Filter protected $_widget; /** - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Psr\Log\LoggerInterface $logger * @param \Magento\Framework\Escaper $escaper * @param \Magento\Framework\View\Asset\Repository $assetRepo @@ -39,7 +39,7 @@ class Filter extends \Magento\Cms\Model\Template\Filter * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Psr\Log\LoggerInterface $logger, \Magento\Framework\Escaper $escaper, \Magento\Framework\View\Asset\Repository $assetRepo, diff --git a/app/code/Magento/Widget/Model/Widget.php b/app/code/Magento/Widget/Model/Widget.php index 9ac41338346..e560f8c7394 100644 --- a/app/code/Magento/Widget/Model/Widget.php +++ b/app/code/Magento/Widget/Model/Widget.php @@ -98,7 +98,7 @@ class Widget } /** - * Return widget XML configuration as \Magento\Framework\Object and makes some data preparations + * Return widget XML configuration as \Magento\Framework\DataObject and makes some data preparations * * @param string $type Widget type * @return null|\Magento\Framework\Simplexml\Element @@ -109,16 +109,16 @@ class Widget } /** - * Return widget XML configuration as \Magento\Framework\Object and makes some data preparations + * Return widget XML configuration as \Magento\Framework\DataObject and makes some data preparations * * @param string $type Widget type - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getConfigAsObject($type) { $widget = $this->getWidgetByClassType($type); - $object = new \Magento\Framework\Object(); + $object = new \Magento\Framework\DataObject(); if ($widget === null) { return $object; } @@ -138,10 +138,10 @@ class Widget /** * Prepare widget parameters * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return array */ - protected function prepareWidgetParameters(\Magento\Framework\Object $object) + protected function prepareWidgetParameters(\Magento\Framework\DataObject $object) { $params = $object->getData('parameters'); $newParams = []; @@ -152,7 +152,7 @@ class Widget $data = $this->prepareDropDownValues($data, $key, $sortOrder); $data = $this->prepareHelperBlock($data); - $newParams[$key] = new \Magento\Framework\Object($data); + $newParams[$key] = new \Magento\Framework\DataObject($data); $sortOrder++; } } @@ -197,7 +197,7 @@ class Widget protected function prepareHelperBlock(array $data) { if (isset($data['helper_block'])) { - $helper = new \Magento\Framework\Object(); + $helper = new \Magento\Framework\DataObject(); if (isset($data['helper_block']['data']) && is_array($data['helper_block']['data'])) { $helper->addData($data['helper_block']['data']); } @@ -404,8 +404,8 @@ class Widget /** * Widget parameters sort callback * - * @param \Magento\Framework\Object $firstElement - * @param \Magento\Framework\Object $secondElement + * @param \Magento\Framework\DataObject $firstElement + * @param \Magento\Framework\DataObject $secondElement * @return int */ protected function sortParameters($firstElement, $secondElement) diff --git a/app/code/Magento/Widget/Model/Widget/Config.php b/app/code/Magento/Widget/Model/Widget/Config.php index 201c884db77..884cc8f4859 100644 --- a/app/code/Magento/Widget/Model/Widget/Config.php +++ b/app/code/Magento/Widget/Model/Widget/Config.php @@ -63,7 +63,7 @@ class Config /** * Return config settings for widgets insertion plugin based on editor element config * - * @param \Magento\Framework\Object $config + * @param \Magento\Framework\DataObject $config * @return array */ public function getPluginSettings($config) @@ -83,7 +83,7 @@ class Config /** * Return Widgets Insertion Plugin Window URL * - * @param \Magento\Framework\Object $config Editor element config + * @param \Magento\Framework\DataObject $config Editor element config * @return string */ public function getWidgetWindowUrl($config) diff --git a/app/code/Magento/Widget/Test/Unit/Model/WidgetTest.php b/app/code/Magento/Widget/Test/Unit/Model/WidgetTest.php index dffc3bf38ac..d9975a6c419 100644 --- a/app/code/Magento/Widget/Test/Unit/Model/WidgetTest.php +++ b/app/code/Magento/Widget/Test/Unit/Model/WidgetTest.php @@ -92,7 +92,7 @@ class WidgetTest extends \PHPUnit_Framework_TestCase ->willReturn($widgets); $resultObject = $this->widget->getConfigAsObject('Magento\Cms\Block\Widget\Page\Link'); - $this->assertInstanceOf('Magento\Framework\Object', $resultObject); + $this->assertInstanceOf('Magento\Framework\DataObject', $resultObject); $this->assertSame('CMS Page Link', $resultObject->getName()); $this->assertSame('Link to a CMS Page', $resultObject->getDescription()); @@ -100,9 +100,9 @@ class WidgetTest extends \PHPUnit_Framework_TestCase $this->assertSame('Magento_Cms::images/widget_page_link.png', $resultObject->getPlaceholderImage()); $resultParameters = $resultObject->getParameters(); - $this->assertInstanceOf('Magento\Framework\Object', $resultParameters['page_id' ]); - $this->assertInstanceOf('Magento\Framework\Object', $resultParameters['anchor_text']); - $this->assertInstanceOf('Magento\Framework\Object', $resultParameters['template']); + $this->assertInstanceOf('Magento\Framework\DataObject', $resultParameters['page_id' ]); + $this->assertInstanceOf('Magento\Framework\DataObject', $resultParameters['anchor_text']); + $this->assertInstanceOf('Magento\Framework\DataObject', $resultParameters['template']); $supportedContainersExpected = [ '0' => [ @@ -124,7 +124,7 @@ class WidgetTest extends \PHPUnit_Framework_TestCase ->willReturn([]); $resultObject = $this->widget->getConfigAsObject('Magento\Cms\Block\Widget\Page\Link'); - $this->assertInstanceOf('Magento\Framework\Object', $resultObject); + $this->assertInstanceOf('Magento\Framework\DataObject', $resultObject); $this->assertSame([], $resultObject->getData()); } } diff --git a/app/code/Magento/Wishlist/Controller/Index/Add.php b/app/code/Magento/Wishlist/Controller/Index/Add.php index 392ef5f21ab..9af2513f8a5 100644 --- a/app/code/Magento/Wishlist/Controller/Index/Add.php +++ b/app/code/Magento/Wishlist/Controller/Index/Add.php @@ -12,6 +12,9 @@ use Magento\Framework\Exception\NoSuchEntityException; use Magento\Wishlist\Controller\IndexInterface; use Magento\Framework\Controller\ResultFactory; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class Add extends Action\Action implements IndexInterface { /** @@ -93,7 +96,7 @@ class Add extends Action\Action implements IndexInterface } try { - $buyRequest = new \Magento\Framework\Object($requestParams); + $buyRequest = new \Magento\Framework\DataObject($requestParams); $result = $wishlist->addNewItem($product, $buyRequest); if (is_string($result)) { diff --git a/app/code/Magento/Wishlist/Controller/Index/Configure.php b/app/code/Magento/Wishlist/Controller/Index/Configure.php index 5f19495da68..bc8e001e250 100644 --- a/app/code/Magento/Wishlist/Controller/Index/Configure.php +++ b/app/code/Magento/Wishlist/Controller/Index/Configure.php @@ -74,7 +74,7 @@ class Configure extends Action\Action implements IndexInterface $this->_coreRegistry->register('wishlist_item', $item); - $params = new \Magento\Framework\Object(); + $params = new \Magento\Framework\DataObject(); $params->setCategoryId(false); $params->setConfigureMode(true); $buyRequest = $item->getBuyRequest(); diff --git a/app/code/Magento/Wishlist/Controller/Index/UpdateItemOptions.php b/app/code/Magento/Wishlist/Controller/Index/UpdateItemOptions.php index 1796edb9d25..655844d6f11 100644 --- a/app/code/Magento/Wishlist/Controller/Index/UpdateItemOptions.php +++ b/app/code/Magento/Wishlist/Controller/Index/UpdateItemOptions.php @@ -84,7 +84,7 @@ class UpdateItemOptions extends Action\Action implements IndexInterface return $resultRedirect; } - $buyRequest = new \Magento\Framework\Object($this->getRequest()->getParams()); + $buyRequest = new \Magento\Framework\DataObject($this->getRequest()->getParams()); $wishlist->updateItem($id, $buyRequest)->save(); diff --git a/app/code/Magento/Wishlist/Model/Item.php b/app/code/Magento/Wishlist/Model/Item.php index fe713b225d6..08900ab7d1f 100644 --- a/app/code/Magento/Wishlist/Model/Item.php +++ b/app/code/Magento/Wishlist/Model/Item.php @@ -419,7 +419,7 @@ class Item extends AbstractModel implements ItemInterface if (!isset($urlData[$product->getId()])) { return false; } - $product->setUrlDataObject(new \Magento\Framework\Object($urlData)); + $product->setUrlDataObject(new \Magento\Framework\DataObject($urlData)); $visibility = $product->getUrlDataObject()->getVisibility(); if (!in_array($visibility, $product->getVisibleInSiteVisibilities())) { return false; @@ -467,18 +467,18 @@ class Item extends AbstractModel implements ItemInterface * Returns formatted buy request - object, holding request received from * product view page with keys and options for configured product * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getBuyRequest() { $option = $this->getOptionByCode('info_buyRequest'); $initialData = $option ? unserialize($option->getValue()) : null; - if ($initialData instanceof \Magento\Framework\Object) { + if ($initialData instanceof \Magento\Framework\DataObject) { $initialData = $initialData->getData(); } - $buyRequest = new \Magento\Framework\Object($initialData); + $buyRequest = new \Magento\Framework\DataObject($initialData); $buyRequest->setOriginalQty($buyRequest->getQty())->setQty($this->getQty() * 1); return $buyRequest; } @@ -486,12 +486,12 @@ class Item extends AbstractModel implements ItemInterface /** * Merge data to item info_buyRequest option * - * @param array|\Magento\Framework\Object $buyRequest + * @param array|\Magento\Framework\DataObject $buyRequest * @return $this */ public function mergeBuyRequest($buyRequest) { - if ($buyRequest instanceof \Magento\Framework\Object) { + if ($buyRequest instanceof \Magento\Framework\DataObject) { $buyRequest = $buyRequest->getData(); } @@ -516,7 +516,7 @@ class Item extends AbstractModel implements ItemInterface * Set buy request - object, holding request received from * product view page with keys and options for configured product * - * @param \Magento\Framework\Object $buyRequest + * @param \Magento\Framework\DataObject $buyRequest * @return $this */ public function setBuyRequest($buyRequest) @@ -532,7 +532,7 @@ class Item extends AbstractModel implements ItemInterface * Check product representation in item * * @param \Magento\Catalog\Model\Product $product - * @param \Magento\Framework\Object $buyRequest + * @param \Magento\Framework\DataObject $buyRequest * @return bool */ public function isRepresent($product, $buyRequest) @@ -650,7 +650,7 @@ class Item extends AbstractModel implements ItemInterface /** * Add option to item * - * @param Option|\Magento\Framework\Object|array $option + * @param Option|\Magento\Framework\DataObject|array $option * @return $this * @throws \Magento\Framework\Exception\LocalizedException */ @@ -660,7 +660,7 @@ class Item extends AbstractModel implements ItemInterface $option = $this->_wishlistOptFactory->create()->setData($option)->setItem($this); } elseif ($option instanceof Option) { $option->setItem($this); - } elseif ($option instanceof \Magento\Framework\Object) { + } elseif ($option instanceof \Magento\Framework\DataObject) { $option = $this->_wishlistOptFactory->create()->setData($option->getData()) ->setProduct($option->getProduct()) ->setItem($this); @@ -745,11 +745,11 @@ class Item extends AbstractModel implements ItemInterface * * We have to customize only controller url, so return it. * - * @return null|\Magento\Framework\Object + * @return null|\Magento\Framework\DataObject */ public function getFileDownloadParams() { - $params = new \Magento\Framework\Object(); + $params = new \Magento\Framework\DataObject(); $params->setUrl($this->_customOptionDownloadUrl); return $params; } diff --git a/app/code/Magento/Wishlist/Model/Wishlist.php b/app/code/Magento/Wishlist/Model/Wishlist.php index abd6bb10361..2ba3b7220a9 100644 --- a/app/code/Magento/Wishlist/Model/Wishlist.php +++ b/app/code/Magento/Wishlist/Model/Wishlist.php @@ -24,7 +24,7 @@ use Magento\Wishlist\Model\Resource\Wishlist\Collection; * @method \Magento\Wishlist\Model\Wishlist setUpdatedAt(string $value) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Wishlist extends \Magento\Framework\Model\AbstractModel implements \Magento\Framework\Object\IdentityInterface +class Wishlist extends \Magento\Framework\Model\AbstractModel implements \Magento\Framework\DataObject\IdentityInterface { /** * Cache tag @@ -367,7 +367,7 @@ class Wishlist extends \Magento\Framework\Model\AbstractModel implements \Magent * Returns new item or string on error. * * @param int|\Magento\Catalog\Model\Product $product - * @param \Magento\Framework\Object|array|string|null $buyRequest + * @param \Magento\Framework\DataObject|array|string|null $buyRequest * @param bool $forciblySetQty * @throws \Magento\Framework\Exception\LocalizedException * @return Item|string @@ -400,14 +400,14 @@ class Wishlist extends \Magento\Framework\Model\AbstractModel implements \Magent throw new \Magento\Framework\Exception\LocalizedException(__('Cannot specify product.')); } - if ($buyRequest instanceof \Magento\Framework\Object) { + if ($buyRequest instanceof \Magento\Framework\DataObject) { $_buyRequest = $buyRequest; } elseif (is_string($buyRequest)) { - $_buyRequest = new \Magento\Framework\Object(unserialize($buyRequest)); + $_buyRequest = new \Magento\Framework\DataObject(unserialize($buyRequest)); } elseif (is_array($buyRequest)) { - $_buyRequest = new \Magento\Framework\Object($buyRequest); + $_buyRequest = new \Magento\Framework\DataObject($buyRequest); } else { - $_buyRequest = new \Magento\Framework\Object(); + $_buyRequest = new \Magento\Framework\DataObject(); } /* @var $product \Magento\Catalog\Model\Product */ @@ -589,16 +589,16 @@ class Wishlist extends \Magento\Framework\Model\AbstractModel implements \Magent * It's passed to \Magento\Catalog\Helper\Product->addParamsToBuyRequest() to compose resulting buyRequest. * * Basically it can hold - * - 'current_config', \Magento\Framework\Object or array - current buyRequest that configures product in this item, - * used to restore currently attached files + * - 'current_config', \Magento\Framework\DataObject or array - current buyRequest + * that configures product in this item, used to restore currently attached files * - 'files_prefix': string[a-z0-9_] - prefix that was added at frontend to names of file options (file inputs), * so they won't intersect with other submitted options * * For more options see \Magento\Catalog\Helper\Product->addParamsToBuyRequest() * * @param int|Item $itemId - * @param \Magento\Framework\Object $buyRequest - * @param null|array|\Magento\Framework\Object $params + * @param \Magento\Framework\DataObject $buyRequest + * @param null|array|\Magento\Framework\DataObject $params * @return $this * @throws \Magento\Framework\Exception\LocalizedException * @@ -622,9 +622,9 @@ class Wishlist extends \Magento\Framework\Model\AbstractModel implements \Magent $productId = $product->getId(); if ($productId) { if (!$params) { - $params = new \Magento\Framework\Object(); + $params = new \Magento\Framework\DataObject(); } elseif (is_array($params)) { - $params = new \Magento\Framework\Object($params); + $params = new \Magento\Framework\DataObject($params); } $params->setCurrentConfig($item->getBuyRequest()); $buyRequest = $this->_catalogProduct->addParamsToBuyRequest($buyRequest, $params); diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/CartTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/CartTest.php index c2074246b31..d660839c021 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/CartTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/CartTest.php @@ -456,7 +456,7 @@ class CartTest extends \PHPUnit_Framework_TestCase ->method('isAjax') ->willReturn($isAjax); - $buyRequestMock = $this->getMockBuilder('Magento\Framework\Object') + $buyRequestMock = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->getMock(); @@ -662,7 +662,7 @@ class CartTest extends \PHPUnit_Framework_TestCase ->method('getParams') ->willReturn($params); - $buyRequestMock = $this->getMockBuilder('Magento\Framework\Object') + $buyRequestMock = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->getMock(); @@ -823,7 +823,7 @@ class CartTest extends \PHPUnit_Framework_TestCase ->method('getParams') ->willReturn($params); - $buyRequestMock = $this->getMockBuilder('Magento\Framework\Object') + $buyRequestMock = $this->getMockBuilder('Magento\Framework\DataObject') ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateItemOptionsTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateItemOptionsTest.php index cb8ef4cc953..f70306b6025 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateItemOptionsTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateItemOptionsTest.php @@ -315,7 +315,7 @@ class UpdateItemOptionsTest extends \PHPUnit_Framework_TestCase $wishlist ->expects($this->once()) ->method('updateItem') - ->with(3, new \Magento\Framework\Object([])) + ->with(3, new \Magento\Framework\DataObject([])) ->willReturnSelf(); $wishlist ->expects($this->once()) @@ -443,7 +443,7 @@ class UpdateItemOptionsTest extends \PHPUnit_Framework_TestCase $wishlist ->expects($this->once()) ->method('updateItem') - ->with(3, new \Magento\Framework\Object([])) + ->with(3, new \Magento\Framework\DataObject([])) ->willReturnSelf(); $wishlist ->expects($this->once()) diff --git a/app/code/Magento/Wishlist/Test/Unit/Model/ItemTest.php b/app/code/Magento/Wishlist/Test/Unit/Model/ItemTest.php index f31a0ced59d..f60558e7077 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Model/ItemTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Model/ItemTest.php @@ -186,7 +186,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase return [ ['first_key', ['code' => 'first_key', 'value' => 'first_data']], ['second_key', $optionMock], - ['third_key', new \Magento\Framework\Object(['code' => 'third_key', 'product' => $productMock])], + ['third_key', new \Magento\Framework\DataObject(['code' => 'third_key', 'product' => $productMock])], ]; } diff --git a/app/code/Magento/Wishlist/Test/Unit/Model/ObserverTest.php b/app/code/Magento/Wishlist/Test/Unit/Model/ObserverTest.php index 0fdf3ada2f0..de7c4bbee83 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Model/ObserverTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Model/ObserverTest.php @@ -155,12 +155,12 @@ class ObserverTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $buyRequest = $this->getMockBuilder('Magento\Framework\Object') + $buyRequest = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods(['setQty']) ->disableOriginalConstructor() ->getMock(); - $infoData = $this->getMockBuilder('Magento\Framework\Object') + $infoData = $this->getMockBuilder('Magento\Framework\DataObject') ->setMethods(['toArray']) ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Wishlist/Test/Unit/Model/WishlistTest.php b/app/code/Magento/Wishlist/Test/Unit/Model/WishlistTest.php index 21bd28aa462..1c0f04044cc 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Model/WishlistTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Model/WishlistTest.php @@ -184,8 +184,8 @@ class WishlistTest extends \PHPUnit_Framework_TestCase /** * @param int|\Magento\Wishlist\Model\Item|\PHPUnit_Framework_MockObject_MockObject $itemId - * @param \Magento\Framework\Object $buyRequest - * @param null|array|\Magento\Framework\Object $param + * @param \Magento\Framework\DataObject $buyRequest + * @param null|array|\Magento\Framework\DataObject $param * @throws \Magento\Framework\Exception\LocalizedException * * @dataProvider updateItemDataProvider @@ -194,7 +194,7 @@ class WishlistTest extends \PHPUnit_Framework_TestCase { $storeId = 1; $productId = 1; - $stores = [(new \Magento\Framework\Object())->setId($storeId)]; + $stores = [(new \Magento\Framework\DataObject())->setId($storeId)]; $newItem = $this->getMockBuilder('Magento\Wishlist\Model\Item')->disableOriginalConstructor()->getMock(); $newItem->expects($this->any())->method('setProductId')->will($this->returnSelf()); @@ -280,7 +280,7 @@ class WishlistTest extends \PHPUnit_Framework_TestCase public function updateItemDataProvider() { return [ - '0' => [1, new \Magento\Framework\Object(), null], + '0' => [1, new \Magento\Framework\DataObject(), null], ]; } } diff --git a/app/etc/di.xml b/app/etc/di.xml index 67456f36252..96f8b13a226 100644 --- a/app/etc/di.xml +++ b/app/etc/di.xml @@ -93,7 +93,7 @@ <preference for="Magento\Framework\Api\MetadataObjectInterface" type="Magento\Framework\Api\AttributeMetadata"/> <preference for="Magento\Framework\Api\SearchCriteriaInterface" type="Magento\Framework\Api\SearchCriteria"/> <preference for="Magento\Framework\App\Rss\UrlBuilderInterface" type="Magento\Framework\App\Rss\UrlBuilder"/> - <preference for="Magento\Framework\DB\LoggerInterface" type="Magento\Framework\DB\Logger\Null"/> + <preference for="Magento\Framework\DB\LoggerInterface" type="Magento\Framework\DB\Logger\Quiet"/> <preference for="Magento\Framework\App\Resource\ConnectionAdapterInterface" type="Magento\Framework\Model\Resource\Type\Db\Pdo\Mysql"/> <preference for="Magento\Framework\DB\QueryInterface" type="Magento\Framework\DB\Query"/> <preference for="Magento\Framework\App\ProductMetadataInterface" type="Magento\Framework\App\ProductMetadata"/> @@ -340,7 +340,7 @@ <item name="array" xsi:type="object">layoutArrayArgumentReaderInterpreterProxy</item> <item name="boolean" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\Boolean</item> <item name="number" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\Number</item> - <item name="string" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\String</item> + <item name="string" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\StringUtils</item> <item name="null" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\NullType</item> <item name="object" xsi:type="object">Magento\Framework\View\Layout\Argument\Interpreter\Passthrough</item> <item name="url" xsi:type="object">Magento\Framework\View\Layout\Argument\Interpreter\Passthrough</item> @@ -356,7 +356,7 @@ <item name="array" xsi:type="object">layoutArrayArgumentGeneratorInterpreterProxy</item> <item name="boolean" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\Boolean</item> <item name="number" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\Number</item> - <item name="string" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\String</item> + <item name="string" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\StringUtils</item> <item name="null" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\NullType</item> <item name="object" xsi:type="object">layoutObjectArgumentInterpreter</item> <item name="url" xsi:type="object">Magento\Framework\View\Layout\Argument\Interpreter\Url</item> @@ -394,14 +394,14 @@ <argument name="instanceName" xsi:type="string">layoutArrayArgumentGeneratorInterpreter</argument> </arguments> </virtualType> - <virtualType name="layoutObjectArgumentInterpreter" type="Magento\Framework\View\Layout\Argument\Interpreter\Object"> + <virtualType name="layoutObjectArgumentInterpreter" type="Magento\Framework\View\Layout\Argument\Interpreter\DataObject"> <arguments> <argument name="expectedClass" xsi:type="string">Magento\Framework\Data\CollectionDataSourceInterface</argument> </arguments> </virtualType> <type name="Magento\Framework\View\Layout\Argument\Interpreter\NamedParams"> <arguments> - <argument name="paramInterpreter" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\String</argument> + <argument name="paramInterpreter" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\StringUtils</argument> </arguments> </type> <virtualType name="containerRenderPool" type="Magento\Framework\View\Layout\ReaderPool"> @@ -978,26 +978,26 @@ </argument> </arguments> </type> - <type name="Magento\Framework\Object\Copy\Config"> + <type name="Magento\Framework\DataObject\Copy\Config"> <arguments> - <argument name="dataStorage" xsi:type="object">Magento\Framework\Object\Copy\Config\Data\Proxy</argument> + <argument name="dataStorage" xsi:type="object">Magento\Framework\DataObject\Copy\Config\Data\Proxy</argument> </arguments> </type> - <type name="Magento\Framework\Object\Copy\Config\Reader"> + <type name="Magento\Framework\DataObject\Copy\Config\Reader"> <arguments> <argument name="fileName" xsi:type="string">fieldset.xml</argument> - <argument name="schemaLocator" xsi:type="object">Magento\Framework\Object\Copy\Config\SchemaLocator</argument> + <argument name="schemaLocator" xsi:type="object">Magento\Framework\DataObject\Copy\Config\SchemaLocator</argument> </arguments> </type> - <type name="Magento\Framework\Object\Copy\Config\SchemaLocator"> + <type name="Magento\Framework\DataObject\Copy\Config\SchemaLocator"> <arguments> - <argument name="schema" xsi:type="string">lib/internal/Magento/Framework/Object/etc/fieldset.xsd</argument> - <argument name="perFileSchema" xsi:type="string">lib/internal/Magento/Framework/Object/etc/fieldset_file.xsd</argument> + <argument name="schema" xsi:type="string">lib/internal/Magento/Framework/DataObject/etc/fieldset.xsd</argument> + <argument name="perFileSchema" xsi:type="string">lib/internal/Magento/Framework/DataObject/etc/fieldset_file.xsd</argument> </arguments> </type> - <type name="Magento\Framework\Object\Copy\Config\Data"> + <type name="Magento\Framework\DataObject\Copy\Config\Data"> <arguments> - <argument name="reader" xsi:type="object">Magento\Framework\Object\Copy\Config\Reader\Proxy</argument> + <argument name="reader" xsi:type="object">Magento\Framework\DataObject\Copy\Config\Reader\Proxy</argument> <argument name="cacheId" xsi:type="string">fieldset_config</argument> </arguments> </type> diff --git a/composer.json b/composer.json index d1688a0bf2a..bd091b8cab9 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "AFL-3.0" ], "require": { - "php": "~5.5.0|~5.6.0", + "php": "~5.5.0|~5.6.0|~7.0.0", "zendframework/zend-stdlib": "2.4.0", "zendframework/zend-code": "2.4.0", "zendframework/zend-server": "2.4.0", @@ -39,6 +39,7 @@ "magento/magento-composer-installer": "*", "braintree/braintree_php": "2.39.0", "symfony/console": "~2.3 <2.7", + "phpseclib/phpseclib": "~0.3", "tedivm/jshrink": "~1.0.1" }, "require-dev": { @@ -168,7 +169,6 @@ "trentrichardson/jquery-timepicker-addon": "1.4.3", "colinmollenhour/cache-backend-redis": "1.8", "colinmollenhour/credis": "1.5", - "phpseclib/phpseclib": "0.2.1", "components/jquery": "1.11.0", "blueimp/jquery-file-upload": "5.6.14", "components/jqueryui": "1.10.4", @@ -180,7 +180,6 @@ "trentrichardson/jquery-timepicker-addon": "lib/web/jquery/jquery-ui-timepicker-addon.js", "colinmollenhour/cache-backend-redis": "lib/internal/Cm/Cache/Backend/Redis.php", "colinmollenhour/credis": "lib/internal/Credis", - "phpseclib/phpseclib": "lib/internal/phpseclib", "components/jquery": [ "lib/web/jquery.js", "lib/web/jquery/jquery.min.js", diff --git a/composer.lock b/composer.lock index 97afe2b5a0c..aeed3ff718f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "2213824594a29c1311ab731de9678212", + "hash": "2eacae22db55e2f8e9cfbdab90892780", "packages": [ { "name": "braintree/braintree_php", @@ -495,6 +495,104 @@ "homepage": "http://www.pelagodesign.com/sidecar/emogrifier/", "time": "2015-05-15 11:37:51" }, + { + "name": "phpseclib/phpseclib", + "version": "0.3.10", + "source": { + "type": "git", + "url": "https://github.com/phpseclib/phpseclib.git", + "reference": "d15bba1edcc7c89e09cc74c5d961317a8b947bf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/d15bba1edcc7c89e09cc74c5d961317a8b947bf4", + "reference": "d15bba1edcc7c89e09cc74c5d961317a8b947bf4", + "shasum": "" + }, + "require": { + "php": ">=5.0.0" + }, + "require-dev": { + "phing/phing": "~2.7", + "phpunit/phpunit": "~4.0", + "sami/sami": "~2.0", + "squizlabs/php_codesniffer": "~1.5" + }, + "suggest": { + "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", + "ext-mcrypt": "Install the Mcrypt extension in order to speed up a wide variety of cryptographic operations.", + "pear-pear/PHP_Compat": "Install PHP_Compat to get phpseclib working on PHP < 4.3.3." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.3-dev" + } + }, + "autoload": { + "psr-0": { + "Crypt": "phpseclib/", + "File": "phpseclib/", + "Math": "phpseclib/", + "Net": "phpseclib/", + "System": "phpseclib/" + }, + "files": [ + "phpseclib/Crypt/Random.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "phpseclib/" + ], + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jim Wigginton", + "email": "terrafrost@php.net", + "role": "Lead Developer" + }, + { + "name": "Patrick Monnerat", + "email": "pm@datasphere.ch", + "role": "Developer" + }, + { + "name": "Andreas Fischer", + "email": "bantu@phpbb.com", + "role": "Developer" + }, + { + "name": "Hans-Jürgen Petrich", + "email": "petrich@tronic-media.com", + "role": "Developer" + } + ], + "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.", + "homepage": "http://phpseclib.sourceforge.net", + "keywords": [ + "BigInteger", + "aes", + "asn.1", + "asn1", + "blowfish", + "crypto", + "cryptography", + "encryption", + "rsa", + "security", + "sftp", + "signature", + "signing", + "ssh", + "twofish", + "x.509", + "x509" + ], + "time": "2015-01-28 21:50:33" + }, { "name": "psr/log", "version": "1.0.0", @@ -581,17 +679,17 @@ }, { "name": "symfony/console", - "version": "v2.6.10", + "version": "v2.6.11", "target-dir": "Symfony/Component/Console", "source": { "type": "git", "url": "https://github.com/symfony/Console.git", - "reference": "042107bc202845086739414339e551fbe81293d7" + "reference": "0e5e18ae09d3f5c06367759be940e9ed3f568359" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/042107bc202845086739414339e551fbe81293d7", - "reference": "042107bc202845086739414339e551fbe81293d7", + "url": "https://api.github.com/repos/symfony/Console/zipball/0e5e18ae09d3f5c06367759be940e9ed3f568359", + "reference": "0e5e18ae09d3f5c06367759be940e9ed3f568359", "shasum": "" }, "require": { @@ -635,7 +733,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2015-07-13 09:09:47" + "time": "2015-07-26 09:08:40" }, { "name": "symfony/finder", @@ -2324,16 +2422,16 @@ }, { "name": "fabpot/php-cs-fixer", - "version": "v1.9.1", + "version": "v1.10", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "f2c2c5527113f346d77eb790e62395fe8de58c4f" + "reference": "8e21b4fb32c4618a425817d9f0daf3d57a9808d1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/f2c2c5527113f346d77eb790e62395fe8de58c4f", - "reference": "f2c2c5527113f346d77eb790e62395fe8de58c4f", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/8e21b4fb32c4618a425817d9f0daf3d57a9808d1", + "reference": "8e21b4fb32c4618a425817d9f0daf3d57a9808d1", "shasum": "" }, "require": { @@ -2374,7 +2472,7 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2015-07-08 21:03:30" + "time": "2015-07-27 20:56:10" }, { "name": "league/climate", @@ -2590,16 +2688,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "2.1.8", + "version": "2.1.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "6044546998c7627ab997501a3d0db972b3db9790" + "reference": "5bd48b86cd282da411bb80baac1398ce3fefac41" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6044546998c7627ab997501a3d0db972b3db9790", - "reference": "6044546998c7627ab997501a3d0db972b3db9790", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/5bd48b86cd282da411bb80baac1398ce3fefac41", + "reference": "5bd48b86cd282da411bb80baac1398ce3fefac41", "shasum": "" }, "require": { @@ -2648,7 +2746,7 @@ "testing", "xunit" ], - "time": "2015-07-13 11:25:58" + "time": "2015-07-26 12:54:47" }, { "name": "phpunit/php-file-iterator", @@ -2738,16 +2836,16 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.6", + "version": "1.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "83fe1bdc5d47658b727595c14da140da92b3d66d" + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/83fe1bdc5d47658b727595c14da140da92b3d66d", - "reference": "83fe1bdc5d47658b727595c14da140da92b3d66d", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", "shasum": "" }, "require": { @@ -2775,7 +2873,7 @@ "keywords": [ "timer" ], - "time": "2015-06-13 07:35:30" + "time": "2015-06-21 08:01:12" }, { "name": "phpunit/php-token-stream", @@ -2902,22 +3000,23 @@ }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.5", + "version": "2.3.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "1c330b1b6e1ea8fd15f2fbea46770576e366855c" + "reference": "18dfbcb81d05e2296c0bcddd4db96cade75e6f42" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/1c330b1b6e1ea8fd15f2fbea46770576e366855c", - "reference": "1c330b1b6e1ea8fd15f2fbea46770576e366855c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/18dfbcb81d05e2296c0bcddd4db96cade75e6f42", + "reference": "18dfbcb81d05e2296c0bcddd4db96cade75e6f42", "shasum": "" }, "require": { "doctrine/instantiator": "~1.0,>=1.0.2", "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2" + "phpunit/php-text-template": "~1.2", + "sebastian/exporter": "~1.2" }, "require-dev": { "phpunit/phpunit": "~4.4" @@ -2953,20 +3052,20 @@ "mock", "xunit" ], - "time": "2015-07-04 05:41:32" + "time": "2015-07-10 06:54:24" }, { "name": "sebastian/comparator", - "version": "1.1.1", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1dd8869519a225f7f2b9eb663e225298fade819e" + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dd8869519a225f7f2b9eb663e225298fade819e", - "reference": "1dd8869519a225f7f2b9eb663e225298fade819e", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", "shasum": "" }, "require": { @@ -2980,7 +3079,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -3017,7 +3116,7 @@ "compare", "equality" ], - "time": "2015-01-29 16:28:08" + "time": "2015-07-26 15:48:44" }, { "name": "sebastian/diff", @@ -3073,16 +3172,16 @@ }, { "name": "sebastian/environment", - "version": "1.2.2", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e" + "reference": "4fe0a44cddd8cc19583a024bdc7374eb2fef0b87" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5a8c7d31914337b69923db26c4221b81ff5a196e", - "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4fe0a44cddd8cc19583a024bdc7374eb2fef0b87", + "reference": "4fe0a44cddd8cc19583a024bdc7374eb2fef0b87", "shasum": "" }, "require": { @@ -3119,20 +3218,20 @@ "environment", "hhvm" ], - "time": "2015-01-01 10:01:08" + "time": "2015-07-26 06:42:57" }, { "name": "sebastian/exporter", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "84839970d05254c73cde183a721c7af13aede943" + "reference": "7ae5513327cb536431847bcc0c10edba2701064e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/84839970d05254c73cde183a721c7af13aede943", - "reference": "84839970d05254c73cde183a721c7af13aede943", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", + "reference": "7ae5513327cb536431847bcc0c10edba2701064e", "shasum": "" }, "require": { @@ -3185,20 +3284,20 @@ "export", "exporter" ], - "time": "2015-01-27 07:23:06" + "time": "2015-06-21 07:55:53" }, { "name": "sebastian/recursion-context", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "3989662bbb30a29d20d9faa04a846af79b276252" + "reference": "994d4a811bafe801fb06dccbee797863ba2792ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/3989662bbb30a29d20d9faa04a846af79b276252", - "reference": "3989662bbb30a29d20d9faa04a846af79b276252", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba", + "reference": "994d4a811bafe801fb06dccbee797863ba2792ba", "shasum": "" }, "require": { @@ -3238,7 +3337,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-01-24 09:48:32" + "time": "2015-06-21 08:04:50" }, { "name": "sebastian/version", @@ -3728,7 +3827,7 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "~5.5.0|~5.6.0" + "php": "~5.5.0|~5.6.0|~7.0.0" }, "platform-dev": { "lib-libxml": "*", diff --git a/dev/tests/api-functional/_files/Magento/TestModuleMSC/etc/di.xml b/dev/tests/api-functional/_files/Magento/TestModuleMSC/etc/di.xml index 0dc0390e215..161068bca3d 100644 --- a/dev/tests/api-functional/_files/Magento/TestModuleMSC/etc/di.xml +++ b/dev/tests/api-functional/_files/Magento/TestModuleMSC/etc/di.xml @@ -30,7 +30,7 @@ <argument name="resource" xsi:type="object">Magento\TestModuleMSC\Model\Resource\Item</argument> </arguments> </type> - <virtualType name="CustomAttributeMap" type="Magento\Framework\Object"> + <virtualType name="CustomAttributeMap" type="Magento\Framework\DataObject"> <arguments> <argument name="data" xsi:type="array"> <item name="customAttributeDataObjectInterface" xsi:type="string">Magento\TestModuleMSC\Api\Data\CustomAttributeDataObjectInterface</item> diff --git a/dev/tests/api-functional/framework/bootstrap.php b/dev/tests/api-functional/framework/bootstrap.php index 2df18e828bf..0544be7705c 100644 --- a/dev/tests/api-functional/framework/bootstrap.php +++ b/dev/tests/api-functional/framework/bootstrap.php @@ -12,6 +12,7 @@ require_once __DIR__ . '/autoload.php'; $testsBaseDir = dirname(__DIR__); $integrationTestsDir = realpath("{$testsBaseDir}/../integration"); +$fixtureBaseDir = $integrationTestsDir . '/testsuite'; $logWriter = new \Zend_Log_Writer_Stream('php://output'); $logWriter->setFormatter(new \Zend_Log_Formatter_Simple('%message%' . PHP_EOL)); diff --git a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionRepositoryTest.php index d402aea3d67..8c486761f39 100644 --- a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionRepositoryTest.php @@ -147,13 +147,29 @@ class ProductOptionRepositoryTest extends \Magento\TestFramework\TestCase\Webapi */ public function testUpdate() { + /** TODO: Remove after MAGETWO-40822 */ + $isPhpVersionSupported = version_compare( + '7.0.0', + preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION), + '>' + ); + if (!$isPhpVersionSupported) { + $this->markTestSkipped('MAGETWO-40822'); + } + $productSku = 'bundle-product'; $request = [ 'title' => 'someTitle', 'sku' => $productSku, ]; - $optionId = $this->getList($productSku)[0]['option_id']; + $options = $this->getList($productSku); + + $this->assertGreaterThan(0, count($options)); + $this->assertArrayHasKey('option_id', $options[0]); + + $optionId = $options[0]['option_id']; + $result = $this->update($optionId, $request); $this->assertEquals($result, $optionId); diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryManagementTest.php index e31e5ef454a..d9f4ce552fe 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryManagementTest.php @@ -40,6 +40,9 @@ class CategoryManagementTest extends WebapiAbstract $result = $this->_webApiCall($serviceInfo, $requestData); for ($i = 0; $i < $expectedLevel; $i++) { + if (!array_key_exists(0, $result['children_data'])) { + $this->fail('Category "' . $result['name'] . '" doesn\'t have children but expected to have'); + } $result = $result['children_data'][0]; } $this->assertEquals($expectedId, $result['id']); diff --git a/dev/tests/api-functional/testsuite/Magento/Customer/Api/GroupRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Customer/Api/GroupRepositoryTest.php index d29db94ffc7..16ea7de67a7 100644 --- a/dev/tests/api-functional/testsuite/Magento/Customer/Api/GroupRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Customer/Api/GroupRepositoryTest.php @@ -53,6 +53,7 @@ class GroupRepositoryTest extends WebapiAbstract */ public function tearDown() { + parent::tearDown(); } /** @@ -60,6 +61,7 @@ class GroupRepositoryTest extends WebapiAbstract */ public static function tearDownAfterClass() { + parent::tearDownAfterClass(); } /** diff --git a/dev/tests/api-functional/testsuite/Magento/Downloadable/Api/ProductRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Downloadable/Api/ProductRepositoryTest.php index a079eb6d4b6..7111e1f6bef 100644 --- a/dev/tests/api-functional/testsuite/Magento/Downloadable/Api/ProductRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Downloadable/Api/ProductRepositoryTest.php @@ -293,8 +293,9 @@ class ProductRepositoryTest extends WebapiAbstract $link1Id = $resultLinks[0]['id']; $link2Id = $resultLinks[1]['id']; - $linkFile = 'link1_content_updated.jpg'; - $sampleFile = 'link1_sample_updated.jpg'; + $linkFile = 'link1_content_updated'; + $sampleFile = 'link1_sample_updated'; + $extension = '.jpg'; $updatedLink1Data = [ 'id' => $link1Id, 'title' => 'link1_updated', @@ -304,12 +305,12 @@ class ProductRepositoryTest extends WebapiAbstract 'number_of_downloads' => 999, 'link_type' => 'file', 'link_file_content' => [ - 'name' => $linkFile, + 'name' => $linkFile . $extension, 'file_data' => base64_encode(file_get_contents($this->testImagePath)), ], 'sample_type' => 'file', 'sample_file_content' => [ - 'name' => $sampleFile, + 'name' => $sampleFile . $extension, 'file_data' => base64_encode(file_get_contents($this->testImagePath)), ], ]; @@ -351,8 +352,10 @@ class ProductRepositoryTest extends WebapiAbstract $this->assertEquals($link1Id, $resultLinks[0]['id']); $this->assertTrue(isset($resultLinks[0]['link_file'])); $this->assertGreaterThan(0, strpos($resultLinks[0]['link_file'], $linkFile)); + $this->assertStringEndsWith($extension, $resultLinks[0]['link_file']); $this->assertTrue(isset($resultLinks[0]['sample_file'])); $this->assertGreaterThan(0, strpos($resultLinks[0]['sample_file'], $sampleFile)); + $this->assertStringEndsWith($extension, $resultLinks[0]['sample_file']); unset($resultLinks[0]['id']); unset($resultLinks[0]['link_file']); unset($resultLinks[0]['sample_file']); @@ -500,13 +503,15 @@ class ProductRepositoryTest extends WebapiAbstract $this->assertEquals($sample1Id, $resultSamples[0]['id']); unset($resultSamples[0]['id']); $this->assertTrue(isset($resultSamples[0]['sample_file'])); - $this->assertContains('sample1.jpg', $resultSamples[0]['sample_file']); + $this->assertContains('sample1', $resultSamples[0]['sample_file']); + $this->assertStringEndsWith('.jpg', $resultSamples[0]['sample_file']); unset($resultSamples[0]['sample_file']); $this->assertTrue(isset($resultSamples[1]['id'])); $this->assertEquals($sample2Id, $resultSamples[1]['id']); unset($resultSamples[1]['id']); $this->assertTrue(isset($resultSamples[1]['sample_file'])); - $this->assertContains('sample2.jpg', $resultSamples[1]['sample_file']); + $this->assertContains('sample2', $resultSamples[1]['sample_file']); + $this->assertStringEndsWith('.jpg', $resultSamples[1]['sample_file']); unset($resultSamples[1]['sample_file']); $expectedSampleData = [ diff --git a/dev/tests/functional/lib/Magento/Mtf/ObjectManagerFactory.php b/dev/tests/functional/lib/Magento/Mtf/ObjectManagerFactory.php index 33e58377bb0..a19a0125631 100644 --- a/dev/tests/functional/lib/Magento/Mtf/ObjectManagerFactory.php +++ b/dev/tests/functional/lib/Magento/Mtf/ObjectManagerFactory.php @@ -88,11 +88,11 @@ class ObjectManagerFactory $result = new \Magento\Mtf\Data\Argument\Interpreter\Composite( [ 'boolean' => new \Magento\Mtf\Data\Argument\Interpreter\Boolean($booleanUtils), - 'string' => new \Magento\Mtf\Data\Argument\Interpreter\String($booleanUtils), + 'string' => new \Magento\Mtf\Data\Argument\Interpreter\StringType($booleanUtils), 'number' => new \Magento\Mtf\Data\Argument\Interpreter\Number(), 'null' => new \Magento\Mtf\Data\Argument\Interpreter\NullType(), 'const' => $constInterpreter, - 'object' => new \Magento\Mtf\Data\Argument\Interpreter\Object($booleanUtils), + 'object' => new \Magento\Mtf\Data\Argument\Interpreter\ObjectType($booleanUtils), 'init_parameter' => new \Magento\Mtf\Data\Argument\Interpreter\Argument($constInterpreter), ], \Magento\Mtf\ObjectManager\Config\Reader\Dom::TYPE_ATTRIBUTE diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Generate/Repository/TableCollection.php b/dev/tests/functional/lib/Magento/Mtf/Util/Generate/Repository/TableCollection.php index 97c04925d2f..b1b8afbbc74 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Util/Generate/Repository/TableCollection.php +++ b/dev/tests/functional/lib/Magento/Mtf/Util/Generate/Repository/TableCollection.php @@ -38,7 +38,7 @@ class TableCollection extends AbstractCollection \Magento\Framework\Model\Resource\Db\AbstractDb $resource = null, array $fixture = [] ) { - $this->setModel('Magento\Framework\Object'); + $this->setModel('Magento\Framework\DataObject'); $this->setResourceModel('Magento\Mtf\Util\Generate\Repository\Resource'); $resource = $this->getResource(); diff --git a/dev/tests/integration/framework/bootstrap.php b/dev/tests/integration/framework/bootstrap.php index e39836e58dd..c30c59c2214 100644 --- a/dev/tests/integration/framework/bootstrap.php +++ b/dev/tests/integration/framework/bootstrap.php @@ -15,6 +15,7 @@ if (file_exists($updateAppBootstrap)) { $testsBaseDir = dirname(__DIR__); $magentoBaseDir = realpath("{$testsBaseDir}/../../../"); +$fixtureBaseDir = $testsBaseDir. '/testsuite'; if (!defined('TESTS_TEMP_DIR')) { define('TESTS_TEMP_DIR', $testsBaseDir . '/tmp'); diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ObjectManagerTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ObjectManagerTest.php index 2925049e6dc..0e3104c538c 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ObjectManagerTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ObjectManagerTest.php @@ -49,8 +49,8 @@ class ObjectManagerTest extends \PHPUnit_Framework_TestCase $factory->expects($this->exactly(2))->method('create')->will( $this->returnCallback( function ($className) { - if ($className === 'Magento\Framework\Object') { - return $this->getMock('Magento\Framework\Object', [], [], '', false); + if ($className === 'Magento\Framework\DataObject') { + return $this->getMock('Magento\Framework\DataObject', [], [], '', false); } } ) @@ -86,12 +86,12 @@ class ObjectManagerTest extends \PHPUnit_Framework_TestCase ); $model->addSharedInstance($resource, 'Magento\Framework\App\Resource'); - $instance1 = $model->get('Magento\Framework\Object'); + $instance1 = $model->get('Magento\Framework\DataObject'); - $this->assertSame($instance1, $model->get('Magento\Framework\Object')); + $this->assertSame($instance1, $model->get('Magento\Framework\DataObject')); $this->assertSame($model, $model->clearCache()); $this->assertSame($model, $model->get('Magento\Framework\ObjectManagerInterface')); $this->assertSame($resource, $model->get('Magento\Framework\App\Resource')); - $this->assertNotSame($instance1, $model->get('Magento\Framework\Object')); + $this->assertNotSame($instance1, $model->get('Magento\Framework\DataObject')); } } diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/DeleteTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/DeleteTest.php index 04cb69216e2..19f3eceaaf6 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/DeleteTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/DeleteTest.php @@ -19,7 +19,7 @@ class DeleteTest extends \PHPUnit_Framework_TestCase /** @var $block \Magento\Backend\Block\System\Store\Delete */ $block = $layout->createBlock('Magento\Backend\Block\System\Store\Delete', 'block'); - $dataObject = new \Magento\Framework\Object(); + $dataObject = new \Magento\Framework\DataObject(); $form = $block->getChildBlock('form'); $form->setDataObject($dataObject); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/Locale/ResolverTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/Locale/ResolverTest.php index c0cc101fd36..97699247117 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/Locale/ResolverTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/Locale/ResolverTest.php @@ -38,7 +38,7 @@ class ResolverTest extends \PHPUnit_Framework_TestCase */ public function testSetLocaleWithBaseInterfaceLocale() { - $user = new \Magento\Framework\Object(); + $user = new \Magento\Framework\DataObject(); $session = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\Backend\Model\Auth\Session' ); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/ObserverTest.php index da315fc038a..1a4f8f11915 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/ObserverTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/ObserverTest.php @@ -87,7 +87,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase /** * Builds a dummy observer for testing adminPreDispatch method * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function _buildObserver() { @@ -101,9 +101,9 @@ class ObserverTest extends \PHPUnit_Framework_TestCase ] ); - $controller = new \Magento\Framework\Object(['request' => $request]); - $event = new \Magento\Framework\Object(['controller_action' => $controller]); - $observer = new \Magento\Framework\Object(['event' => $event]); + $controller = new \Magento\Framework\DataObject(['request' => $request]); + $event = new \Magento\Framework\DataObject(['controller_action' => $controller]); + $observer = new \Magento\Framework\DataObject(['event' => $event]); return $observer; } } diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/Session/QuoteTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/Session/QuoteTest.php index bede51e4044..145db847a71 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/Session/QuoteTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/Session/QuoteTest.php @@ -24,7 +24,7 @@ class QuoteTest extends \PHPUnit_Framework_TestCase $backendQuoteSession->setCustomerId($fixtureCustomerId); /** @var \Magento\Backend\Model\Session\Quote $quoteSession */ $quoteSession = $objectManager->create('Magento\Backend\Model\Session\Quote'); - $quoteSession->setEntity(new \Magento\Framework\Object()); + $quoteSession->setEntity(new \Magento\Framework\DataObject()); /** SUT execution */ $quote = $quoteSession->getQuote(); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/AddTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/AddTest.php index 3e0c63ac7a5..88aa7b5d999 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/AddTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/AddTest.php @@ -21,7 +21,7 @@ class AddTest extends \PHPUnit_Framework_TestCase $block->setArea('adminhtml')->unsetChild('setForm'); $childBlock = $layout->addBlock('Magento\Framework\View\Element\Template', 'setForm', 'block'); - $form = new \Magento\Framework\Object(); + $form = new \Magento\Framework\DataObject(); $childBlock->setForm($form); $expectedId = '12121212'; diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php index 07b5cac6bb2..94bfe083285 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php @@ -210,8 +210,8 @@ class AttributeTest extends \Magento\TestFramework\TestCase\AbstractBackendContr */ public function testSaveActionCleanAttributeLabelCache() { - /** @var \Magento\Translation\Model\Resource\String $string */ - $string = $this->_objectManager->create('Magento\Translation\Model\Resource\String'); + /** @var \Magento\Translation\Model\Resource\StringUtils $string */ + $string = $this->_objectManager->create('Magento\Translation\Model\Resource\StringUtils'); $this->assertEquals('predefined string translation', $this->_translate('string to translate')); $string->saveTranslate('string to translate', 'new string translation'); $postData = $this->_getAttributeData() + ['attribute_id' => 1]; diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/CategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/CategoryTest.php index 68824c1e812..7255a16fb29 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/CategoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/CategoryTest.php @@ -64,7 +64,7 @@ class CategoryTest extends \PHPUnit_Framework_TestCase ); $this->assertEquals($url, $this->_helper->getCategoryUrl($category)); - $category = new \Magento\Framework\Object(['url' => $url]); + $category = new \Magento\Framework\DataObject(['url' => $url]); $this->assertEquals($url, $this->_helper->getCategoryUrl($category)); } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/DataTest.php index 121f6b02539..87e121cfaab 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/DataTest.php @@ -237,7 +237,7 @@ class DataTest extends \PHPUnit_Framework_TestCase } /** - * @param \Magento\Framework\Object $input + * @param \Magento\Framework\DataObject $input * @param float $expectOutputPrice * @param string[] $configs * @param string $productClassName @@ -290,19 +290,19 @@ class DataTest extends \PHPUnit_Framework_TestCase { return [ 'price is 0' => [ - (new \Magento\Framework\Object())->setPrice(0), + (new \Magento\Framework\DataObject())->setPrice(0), 0, ], 'no price conversion, round' => [ - (new \Magento\Framework\Object())->setPrice(3.256)->setRoundPrice(true), + (new \Magento\Framework\DataObject())->setPrice(3.256)->setRoundPrice(true), '3.26', ], 'no price conversion, no round' => [ - (new \Magento\Framework\Object())->setPrice(3.256), + (new \Magento\Framework\DataObject())->setPrice(3.256), '3.256', ], 'price conversion, display including tax, round' => [ - (new \Magento\Framework\Object())->setPrice(3.256)->setRoundPrice(true), + (new \Magento\Framework\DataObject())->setPrice(3.256)->setRoundPrice(true), '3.5', [ [ @@ -316,7 +316,7 @@ class DataTest extends \PHPUnit_Framework_TestCase ], ], 'price conversion, display including tax, no round' => [ - (new \Magento\Framework\Object())->setPrice(3.256)->setNotEqual(true), + (new \Magento\Framework\DataObject())->setPrice(3.256)->setNotEqual(true), '3.5', // should be not equal to rounded value (eg, 3.5045009999999999) [ [ @@ -330,7 +330,7 @@ class DataTest extends \PHPUnit_Framework_TestCase ], ], 'price conversion, display including tax, high rate product tax class, cross boarder trade, round' => [ - (new \Magento\Framework\Object())->setPrice(3.256)->setRoundPrice(true), + (new \Magento\Framework\DataObject())->setPrice(3.256)->setRoundPrice(true), '3.98', // rounding issue: old code expects 3.97 [ [ @@ -349,7 +349,7 @@ class DataTest extends \PHPUnit_Framework_TestCase 'HigherProductClass', ], 'price include tax, display including tax, round' => [ - (new \Magento\Framework\Object())->setPrice(3.256)->setRoundPrice(true), + (new \Magento\Framework\DataObject())->setPrice(3.256)->setRoundPrice(true), '3.26', [ [ @@ -363,7 +363,7 @@ class DataTest extends \PHPUnit_Framework_TestCase ], ], 'price include tax, display excluding tax, round' => [ - (new \Magento\Framework\Object())->setPrice(3.256)->setRoundPrice(true), + (new \Magento\Framework\DataObject())->setPrice(3.256)->setRoundPrice(true), '3.03', [ [ @@ -377,7 +377,7 @@ class DataTest extends \PHPUnit_Framework_TestCase ], ], 'price include tax, display excluding tax, request including tax, round' => [ - (new \Magento\Framework\Object())->setPrice(3.256) + (new \Magento\Framework\DataObject())->setPrice(3.256) ->setRoundPrice(true) ->setIncludingTax(true), '3.26', @@ -393,7 +393,7 @@ class DataTest extends \PHPUnit_Framework_TestCase ], ], 'price include tax, display excluding tax, high rate product tax class, round' => [ - (new \Magento\Framework\Object())->setPrice(3.256)->setRoundPrice(true), + (new \Magento\Framework\DataObject())->setPrice(3.256)->setRoundPrice(true), '2.67', [ [ @@ -408,7 +408,7 @@ class DataTest extends \PHPUnit_Framework_TestCase 'HigherProductClass', ], 'price include tax, display excluding tax, high rate product tax class, cross boarder trade, round' => [ - (new \Magento\Framework\Object())->setPrice(3.256)->setRoundPrice(true), + (new \Magento\Framework\DataObject())->setPrice(3.256)->setRoundPrice(true), '2.67', [ [ diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompositeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompositeTest.php index 7ea04ced579..996426121e1 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompositeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompositeTest.php @@ -45,7 +45,7 @@ class CompositeTest extends \PHPUnit_Framework_TestCase */ public function testRenderConfigureResult() { - $configureResult = new \Magento\Framework\Object(); + $configureResult = new \Magento\Framework\DataObject(); $configureResult->setOk(true) ->setProductId(1) ->setCurrentCustomerId(1); @@ -60,7 +60,7 @@ class CompositeTest extends \PHPUnit_Framework_TestCase public function testRenderConfigureResultNotOK() { - $configureResult = new \Magento\Framework\Object(); + $configureResult = new \Magento\Framework\DataObject(); $configureResult->setError(true) ->setMessage('Test Message'); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/ProductTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/ProductTest.php index 40032e090a7..c14c3dc1ea2 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/ProductTest.php @@ -215,10 +215,10 @@ class ProductTest extends \PHPUnit_Framework_TestCase $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Catalog\Model\Product' ); - $buyRequest = new \Magento\Framework\Object(['qty' => 100, 'options' => ['option' => 'value']]); + $buyRequest = new \Magento\Framework\DataObject(['qty' => 100, 'options' => ['option' => 'value']]); $this->_helper->prepareProductOptions($product, $buyRequest); $result = $product->getPreconfiguredValues(); - $this->assertInstanceOf('Magento\Framework\Object', $result); + $this->assertInstanceOf('Magento\Framework\DataObject', $result); $this->assertEquals(100, $result->getQty()); $this->assertEquals(['option' => 'value'], $result->getOptions()); } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php index 234b8e0fcf4..4c2503d2067 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php @@ -129,7 +129,7 @@ class CategoryTest extends \PHPUnit_Framework_TestCase $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Catalog\Model\Layer\Category' ); - $model->setCurrentCategory(new \Magento\Framework\Object()); + $model->setCurrentCategory(new \Magento\Framework\DataObject()); $this->fail('Assign category of invalid class.'); } catch (\Magento\Framework\Exception\LocalizedException $e) { } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/AlgorithmAdvancedTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/AlgorithmAdvancedTest.php index 2541b465d95..1ca22e747cb 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/AlgorithmAdvancedTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/AlgorithmAdvancedTest.php @@ -5,7 +5,7 @@ */ namespace Magento\Catalog\Model\Layer\Filter\Price; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\TestFramework\Helper\Bootstrap; /** @@ -62,7 +62,7 @@ class AlgorithmAdvancedTest extends \PHPUnit_Framework_TestCase 'Magento\Catalog\Model\Layer\Filter\Price', ['layer' => $layer, 'resource' => $priceResource, 'priceAlgorithm' => $model] ); - $filter->setLayer($layer)->setAttributeModel(new Object(['attribute_code' => 'price'])); + $filter->setLayer($layer)->setAttributeModel(new DataObject(['attribute_code' => 'price'])); if ($request !== null) { $filter->apply( $request, diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/TierpriceTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/TierpriceTest.php index 47187fbcde0..f91039aa7c6 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/TierpriceTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/TierpriceTest.php @@ -34,7 +34,7 @@ class TierpriceTest extends \PHPUnit_Framework_TestCase public function testValidate() { - $product = new \Magento\Framework\Object(); + $product = new \Magento\Framework\DataObject(); $product->setTierPrice( [ ['website_id' => 0, 'cust_group' => 1, 'price_qty' => 2, 'price' => 8], @@ -49,7 +49,7 @@ class TierpriceTest extends \PHPUnit_Framework_TestCase */ public function testValidateDuplicate() { - $product = new \Magento\Framework\Object(); + $product = new \Magento\Framework\DataObject(); $product->setTierPrice( [ ['website_id' => 0, 'cust_group' => 1, 'price_qty' => 2, 'price' => 8], @@ -65,7 +65,7 @@ class TierpriceTest extends \PHPUnit_Framework_TestCase */ public function testValidateDuplicateWebsite() { - $product = new \Magento\Framework\Object(); + $product = new \Magento\Framework\DataObject(); $product->setTierPrice( [ ['website_id' => 0, 'cust_group' => 1, 'price_qty' => 2, 'price' => 8], diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php index 3a89eed1a97..611e8c839d4 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php @@ -58,7 +58,7 @@ class ValidatorFileTest extends \PHPUnit_Framework_TestCase $this->httpFactoryMock->expects($this->once())->method('create')->will($this->returnValue($httpAdapterMock)); $this->model->validate( - $this->objectManager->create('Magento\Framework\Object'), + $this->objectManager->create('Magento\Framework\DataObject'), $this->getProductOption(['is_require' => false]) ); } @@ -82,7 +82,7 @@ class ValidatorFileTest extends \PHPUnit_Framework_TestCase $this->httpFactoryMock->expects($this->once())->method('create')->will($this->returnValue($httpAdapterMock)); $this->model->validate( - $this->objectManager->create('Magento\Framework\Object'), + $this->objectManager->create('Magento\Framework\DataObject'), $this->getProductOption(['is_require' => false]) ); } @@ -102,7 +102,7 @@ class ValidatorFileTest extends \PHPUnit_Framework_TestCase $this->httpFactoryMock->expects($this->once())->method('create')->will($this->returnValue($httpAdapterMock)); $this->model->validate( - $this->objectManager->create('Magento\Framework\Object'), + $this->objectManager->create('Magento\Framework\DataObject'), $this->getProductOption(['is_require' => false]) ); } @@ -120,7 +120,7 @@ class ValidatorFileTest extends \PHPUnit_Framework_TestCase $this->httpFactoryMock->expects($this->once())->method('create')->will($this->returnValue($httpAdapterMock)); $this->model->validate( - $this->objectManager->create('Magento\Framework\Object'), + $this->objectManager->create('Magento\Framework\DataObject'), $this->getProductOption() ); } @@ -152,7 +152,7 @@ class ValidatorFileTest extends \PHPUnit_Framework_TestCase $this->httpFactoryMock->expects($this->once())->method('create')->will($this->returnValue($httpAdapterMock)); $this->model->validate( - $this->objectManager->create('Magento\Framework\Object'), + $this->objectManager->create('Magento\Framework\DataObject'), $this->getProductOption() ); } @@ -168,7 +168,7 @@ class ValidatorFileTest extends \PHPUnit_Framework_TestCase $this->httpFactoryMock->expects($this->once())->method('create')->will($this->returnValue($httpAdapterMock)); $result = $this->model->validate( - $this->objectManager->create('Magento\Framework\Object'), + $this->objectManager->create('Magento\Framework\DataObject'), $this->getProductOption() ); unset($result['fullpath'], $result['secret_key']); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTypeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTypeTest.php index ac18747bda8..5e6d627eeb3 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTypeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTypeTest.php @@ -51,7 +51,7 @@ class AbstractTypeTest extends \PHPUnit_Framework_TestCase public function testGetRelationInfo() { $info = $this->_model->getRelationInfo(); - $this->assertInstanceOf('Magento\Framework\Object', $info); + $this->assertInstanceOf('Magento\Framework\DataObject', $info); $this->assertNotSame($info, $this->_model->getRelationInfo()); } @@ -86,9 +86,9 @@ class AbstractTypeTest extends \PHPUnit_Framework_TestCase public function testAttributesCompare() { - $attribute[1] = new \Magento\Framework\Object(['group_sort_path' => 1, 'sort_path' => 10]); - $attribute[2] = new \Magento\Framework\Object(['group_sort_path' => 1, 'sort_path' => 5]); - $attribute[3] = new \Magento\Framework\Object(['group_sort_path' => 2, 'sort_path' => 10]); + $attribute[1] = new \Magento\Framework\DataObject(['group_sort_path' => 1, 'sort_path' => 10]); + $attribute[2] = new \Magento\Framework\DataObject(['group_sort_path' => 1, 'sort_path' => 5]); + $attribute[3] = new \Magento\Framework\DataObject(['group_sort_path' => 2, 'sort_path' => 10]); $this->assertEquals(1, $this->_model->attributesCompare($attribute[1], $attribute[2])); $this->assertEquals(-1, $this->_model->attributesCompare($attribute[2], $attribute[1])); $this->assertEquals(-1, $this->_model->attributesCompare($attribute[1], $attribute[3])); @@ -188,11 +188,11 @@ class AbstractTypeTest extends \PHPUnit_Framework_TestCase $this->assertEmpty($product->getCustomOption('info_buyRequest')); $requestData = ['qty' => 5]; - $result = $this->_model->prepareForCart(new \Magento\Framework\Object($requestData), $product); + $result = $this->_model->prepareForCart(new \Magento\Framework\DataObject($requestData), $product); $this->assertArrayHasKey(0, $result); $this->assertSame($product, $result[0]); $buyRequest = $product->getCustomOption('info_buyRequest'); - $this->assertInstanceOf('Magento\Framework\Object', $buyRequest); + $this->assertInstanceOf('Magento\Framework\DataObject', $buyRequest); $this->assertEquals($product->getId(), $buyRequest->getProductId()); $this->assertSame($product, $buyRequest->getProduct()); $this->assertEquals(serialize($requestData), $buyRequest->getValue()); @@ -210,7 +210,7 @@ class AbstractTypeTest extends \PHPUnit_Framework_TestCase // fixture $this->assertEquals( 'Please specify product\'s required option(s).', - $this->_model->prepareForCart(new \Magento\Framework\Object(), $product) + $this->_model->prepareForCart(new \Magento\Framework\DataObject(), $product) ); } @@ -259,7 +259,7 @@ class AbstractTypeTest extends \PHPUnit_Framework_TestCase $product->load(1); // fixture - $product->addCustomOption('info_buyRequest', serialize(new \Magento\Framework\Object(['qty' => 2]))); + $product->addCustomOption('info_buyRequest', serialize(new \Magento\Framework\DataObject(['qty' => 2]))); foreach ($product->getOptions() as $id => $option) { if ('field' == $option->getType()) { $product->addCustomOption('option_ids', $id); @@ -345,7 +345,7 @@ class AbstractTypeTest extends \PHPUnit_Framework_TestCase public function testGetWeight() { - $product = new \Magento\Framework\Object(); + $product = new \Magento\Framework\DataObject(); $this->assertEmpty($this->_model->getWeight($product)); $product->setWeight('value'); $this->assertEquals('value', $this->_model->getWeight($product)); @@ -355,16 +355,16 @@ class AbstractTypeTest extends \PHPUnit_Framework_TestCase { $this->markTestIncomplete('Bug MAGE-2814'); - $product = new \Magento\Framework\Object(); + $product = new \Magento\Framework\DataObject(); $this->assertFalse($this->_model->hasOptions($product)); - $product = new \Magento\Framework\Object(['has_options' => true]); + $product = new \Magento\Framework\DataObject(['has_options' => true]); $this->assertTrue($this->_model->hasOptions($product)); } public function testHasRequiredOptions() { - $product = new \Magento\Framework\Object(); + $product = new \Magento\Framework\DataObject(); $this->assertFalse($this->_model->hasRequiredOptions($product)); $product->setRequiredOptions(1); $this->assertTrue($this->_model->hasRequiredOptions($product)); @@ -372,7 +372,7 @@ class AbstractTypeTest extends \PHPUnit_Framework_TestCase public function testGetSetStoreFilter() { - $product = new \Magento\Framework\Object(); + $product = new \Magento\Framework\DataObject(); $this->assertNull($this->_model->getStoreFilter($product)); $store = new \StdClass(); $this->_model->setStoreFilter($store, $product); @@ -401,12 +401,12 @@ class AbstractTypeTest extends \PHPUnit_Framework_TestCase public function testAssignProductToOption() { - $product = new \Magento\Framework\Object(); - $option = new \Magento\Framework\Object(); + $product = new \Magento\Framework\DataObject(); + $option = new \Magento\Framework\DataObject(); $this->_model->assignProductToOption($product, $option, $product); $this->assertSame($product, $option->getProduct()); - $option = new \Magento\Framework\Object(); + $option = new \Magento\Framework\DataObject(); $this->_model->assignProductToOption(null, $option, $product); $this->assertSame($product, $option->getProduct()); } @@ -471,7 +471,7 @@ class AbstractTypeTest extends \PHPUnit_Framework_TestCase $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Catalog\Model\Product' ); - $buyRequest = new \Magento\Framework\Object(['qty' => 5]); + $buyRequest = new \Magento\Framework\DataObject(['qty' => 5]); $this->_model->checkProductConfiguration($product, $buyRequest); } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceTest.php index e773c50edbb..aac0f56cff8 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceTest.php @@ -24,7 +24,7 @@ class PriceTest extends \PHPUnit_Framework_TestCase public function testGetPrice() { - $this->assertEquals('test', $this->_model->getPrice(new \Magento\Framework\Object(['price' => 'test']))); + $this->assertEquals('test', $this->_model->getPrice(new \Magento\Framework\DataObject(['price' => 'test']))); } public function testGetFinalPrice() diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/TypeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/TypeTest.php index 67952f5c897..017b7ba4221 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/TypeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/TypeTest.php @@ -26,7 +26,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase */ public function testFactory($typeId, $expectedClass) { - $product = new \Magento\Framework\Object(); + $product = new \Magento\Framework\DataObject(); if ($typeId) { $product->setTypeId($typeId); } @@ -57,7 +57,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase */ public function testFactoryReturnsSingleton($typeId) { - $product = new \Magento\Framework\Object(); + $product = new \Magento\Framework\DataObject(); if ($typeId) { $product->setTypeId($typeId); } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductExternalTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductExternalTest.php index 197d9efa559..4e6d3a35959 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductExternalTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductExternalTest.php @@ -49,7 +49,7 @@ class ProductExternalTest extends \PHPUnit_Framework_TestCase public function testGetCategoryId() { $this->assertFalse($this->_model->getCategoryId()); - $category = new \Magento\Framework\Object(['id' => 5]); + $category = new \Magento\Framework\DataObject(['id' => 5]); /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->get('Magento\Framework\Registry')->register('current_category', $category); @@ -69,7 +69,7 @@ class ProductExternalTest extends \PHPUnit_Framework_TestCase /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->get('Magento\Framework\Registry') - ->register('current_category', new \Magento\Framework\Object(['id' => 3])); + ->register('current_category', new \Magento\Framework\DataObject(['id' => 3])); // fixture try { $category = $this->_model->getCategory(); @@ -284,7 +284,7 @@ class ProductExternalTest extends \PHPUnit_Framework_TestCase $this->_model->setId(99); $this->_model->addCustomOption('one', 'value1'); $option = $this->_model->getCustomOption('one'); - $this->assertInstanceOf('Magento\Framework\Object', $option); + $this->assertInstanceOf('Magento\Framework\DataObject', $option); $this->assertEquals($this->_model->getId(), $option->getProductId()); $this->assertSame($option->getProduct(), $this->_model); $this->assertEquals('one', $option->getCode()); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductGettersTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductGettersTest.php index e79d4f95c35..048f4d7af2a 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductGettersTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductGettersTest.php @@ -167,7 +167,7 @@ class ProductGettersTest extends \PHPUnit_Framework_TestCase $images = $this->_model->getMediaGalleryImages(); $this->assertInstanceOf('Magento\Framework\Data\Collection', $images); foreach ($images as $image) { - $this->assertInstanceOf('Magento\Framework\Object', $image); + $this->assertInstanceOf('Magento\Framework\DataObject', $image); $image = $image->getData(); $this->assertArrayHasKey('file', $image); $this->assertArrayHasKey('url', $image); @@ -241,7 +241,7 @@ class ProductGettersTest extends \PHPUnit_Framework_TestCase public function testGetPreconfiguredValues() { - $this->assertInstanceOf('Magento\Framework\Object', $this->_model->getPreconfiguredValues()); + $this->assertInstanceOf('Magento\Framework\DataObject', $this->_model->getPreconfiguredValues()); $this->_model->setPreconfiguredValues('test'); $this->assertEquals('test', $this->_model->getPreconfiguredValues()); } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php index cbd558ed2f3..9d044360bdb 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php @@ -381,9 +381,9 @@ class ProductTest extends \PHPUnit_Framework_TestCase public function testProcessBuyRequest() { - $request = new \Magento\Framework\Object(); + $request = new \Magento\Framework\DataObject(); $result = $this->_model->processBuyRequest($request); - $this->assertInstanceOf('Magento\Framework\Object', $result); + $this->assertInstanceOf('Magento\Framework\DataObject', $result); $this->assertArrayHasKey('errors', $result->getData()); } diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/Block/TermTest.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/Block/TermTest.php index 9484c16cb94..8313de9b070 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogSearch/Block/TermTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/Block/TermTest.php @@ -24,7 +24,7 @@ class TermTest extends \PHPUnit_Framework_TestCase public function testGetSearchUrl() { $query = uniqid(); - $obj = new \Magento\Framework\Object(['name' => $query]); + $obj = new \Magento\Framework\DataObject(['name' => $query]); $this->assertStringEndsWith("/catalogsearch/result/?q={$query}", $this->_block->getSearchUrl($obj)); } } diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/product_bundle.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/product_bundle.php index a55060fa40c..8fe57170dd4 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/_files/product_bundle.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/product_bundle.php @@ -92,7 +92,7 @@ foreach ($optionCollection as $option) { $bundleOptionsQty[$option->getId()] = 1; } -$requestInfo = new \Magento\Framework\Object( +$requestInfo = new \Magento\Framework\DataObject( ['qty' => 1, 'bundle_option' => $bundleOptions, 'bundle_option_qty' => $bundleOptionsQty] ); $product->setSkipCheckRequiredOption(true); diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/product_with_custom_option.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/product_with_custom_option.php index 2fe03b3e76e..27acededb72 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/_files/product_with_custom_option.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/product_with_custom_option.php @@ -37,6 +37,6 @@ $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(' $product->load(1); $optionId = key($product->getOptions()); -$requestInfo = new \Magento\Framework\Object(['qty' => 1, 'options' => [$optionId => 'test']]); +$requestInfo = new \Magento\Framework\DataObject(['qty' => 1, 'options' => [$optionId => 'test']]); require __DIR__ . '/../../Checkout/_files/cart.php'; diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_bundle_product.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_bundle_product.php index 5c8d52a5bc2..13598f6e675 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_bundle_product.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_bundle_product.php @@ -27,7 +27,7 @@ foreach ($optionCollection as $option) { $bundleOptionsQty[$option->getId()] = 1; } -$requestInfo = new \Magento\Framework\Object( +$requestInfo = new \Magento\Framework\DataObject( ['qty' => 1, 'bundle_option' => $bundleOptions, 'bundle_option_qty' => $bundleOptionsQty] ); diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_downloadable_product.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_downloadable_product.php index 272b2f3042c..c32809da7a4 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_downloadable_product.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_downloadable_product.php @@ -24,7 +24,7 @@ $linkCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->c /** @var $link \Magento\Downloadable\Model\Link */ $link = $linkCollection->getFirstItem(); -$requestInfo = new \Magento\Framework\Object(['qty' => 1, 'links' => [$link->getId()]]); +$requestInfo = new \Magento\Framework\DataObject(['qty' => 1, 'links' => [$link->getId()]]); /** @var $cart \Magento\Checkout\Model\Cart */ $cart = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Checkout\Model\Cart'); diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_simple_product.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_simple_product.php index f176d65cb6a..1d1d820718e 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_simple_product.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_simple_product.php @@ -10,7 +10,7 @@ require __DIR__ . '/../../../Magento/Catalog/_files/products.php'; $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); $product->load(1); -$requestInfo = new \Magento\Framework\Object(['qty' => 1]); +$requestInfo = new \Magento\Framework\DataObject(['qty' => 1]); /** @var $cart \Magento\Checkout\Model\Cart */ $cart = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Checkout\Model\Cart'); diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_simple_product_and_custom_option.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_simple_product_and_custom_option.php index c3fbd49a29a..fcc82f01967 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_simple_product_and_custom_option.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_simple_product_and_custom_option.php @@ -28,7 +28,7 @@ foreach ($product->getOptions() as $option) { $options[$option->getId()] = $value; } -$requestInfo = new \Magento\Framework\Object(['qty' => 1, 'options' => $options]); +$requestInfo = new \Magento\Framework\DataObject(['qty' => 1, 'options' => $options]); /** @var $cart \Magento\Checkout\Model\Cart */ $cart = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Checkout\Model\Cart'); diff --git a/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/ConfigTest.php index 3f0f5b19601..97e9e8abded 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/ConfigTest.php @@ -33,7 +33,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function testGetConfig() { $config = $this->_model->getConfig(); - $this->assertInstanceOf('Magento\Framework\Object', $config); + $this->assertInstanceOf('Magento\Framework\DataObject', $config); } /** diff --git a/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php b/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php index c505c8b2ad9..fc753a98ceb 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php @@ -54,7 +54,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase $collection = $model->getFilesCollection(self::$_baseDir, 'media'); $this->assertInstanceOf('Magento\Cms\Model\Wysiwyg\Images\Storage\Collection', $collection); foreach ($collection as $item) { - $this->assertInstanceOf('Magento\Framework\Object', $item); + $this->assertInstanceOf('Magento\Framework\DataObject', $item); $this->assertStringEndsWith('/1.swf', $item->getUrl()); $this->assertStringMatchesFormat( 'http://%s/static/adminhtml/%s/%s/Magento_Cms/images/placeholder_thumbnail.jpg', diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/AttributeTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/AttributeTest.php index ea03719095d..2df8b1a55ff 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/AttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/AttributeTest.php @@ -22,13 +22,13 @@ class AttributeTest extends \PHPUnit_Framework_TestCase public function testGetLabel() { $this->assertEmpty($this->_model->getLabel()); - $this->_model->setProductAttribute(new \Magento\Framework\Object(['store_label' => 'Store Label'])); + $this->_model->setProductAttribute(new \Magento\Framework\DataObject(['store_label' => 'Store Label'])); $this->assertEquals('Store Label', $this->_model->getLabel()); $this->_model->setUseDefault( 1 )->setProductAttribute( - new \Magento\Framework\Object(['store_label' => 'Other Label']) + new \Magento\Framework\DataObject(['store_label' => 'Other Label']) ); $this->assertEquals('Other Label', $this->_model->getLabel()); } diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/ConfigurableTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/ConfigurableTest.php index aa7426e08a5..3daf0c0373e 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/ConfigurableTest.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/ConfigurableTest.php @@ -44,7 +44,7 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase public function testGetRelationInfo() { $info = $this->_model->getRelationInfo(); - $this->assertInstanceOf('Magento\Framework\Object', $info); + $this->assertInstanceOf('Magento\Framework\DataObject', $info); $this->assertEquals('catalog_product_super_link', $info->getTable()); $this->assertEquals('parent_id', $info->getParentFieldName()); $this->assertEquals('product_id', $info->getChildFieldName()); @@ -271,7 +271,7 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase $attribute = reset($attributes); $optionValueId = $attribute['values'][0]['value_index']; - $buyRequest = new \Magento\Framework\Object( + $buyRequest = new \Magento\Framework\DataObject( ['qty' => 5, 'super_attribute' => [$attribute['attribute_id'] => $optionValueId]] ); $result = $this->_model->prepareForCart($buyRequest, $this->_product); @@ -280,7 +280,7 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase foreach ($result as $product) { $this->assertInstanceOf('Magento\Catalog\Model\Product', $product); } - $this->assertInstanceOf('Magento\Framework\Object', $result[1]->getCustomOption('parent_product_id')); + $this->assertInstanceOf('Magento\Framework\DataObject', $result[1]->getCustomOption('parent_product_id')); } public function testGetSpecifyOptionMessage() @@ -339,9 +339,9 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase $this->_product->setCustomOptions( [ - 'simple_product' => new \Magento\Framework\Object( + 'simple_product' => new \Magento\Framework\DataObject( [ - 'product' => new \Magento\Framework\Object(['weight' => 2]), + 'product' => new \Magento\Framework\DataObject(['weight' => 2]), ] ), ] @@ -351,7 +351,7 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase public function testAssignProductToOption() { - $option = new \Magento\Framework\Object(); + $option = new \Magento\Framework\DataObject(); $this->_model->assignProductToOption('test', $option, $this->_product); $this->assertEquals('test', $option->getProduct()); // other branch of logic depends on \Magento\Sales module @@ -378,7 +378,7 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase public function testProcessBuyRequest() { - $buyRequest = new \Magento\Framework\Object(['super_attribute' => ['10', 'string']]); + $buyRequest = new \Magento\Framework\DataObject(['super_attribute' => ['10', 'string']]); $result = $this->_model->processBuyRequest($this->_product, $buyRequest); $this->assertEquals(['super_attribute' => [10]], $result); } @@ -538,7 +538,7 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase $attribute = reset($attributes); $optionValueId = $attribute['values'][0]['value_index']; - $buyRequest = new \Magento\Framework\Object( + $buyRequest = new \Magento\Framework\DataObject( ['qty' => 5, 'super_attribute' => [$attribute['attribute_id'] => $optionValueId]] ); $this->_model->prepareForCart($buyRequest, $this->_product); diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/quote_with_configurable_product.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/quote_with_configurable_product.php index 4333f26a3f5..325fd2f4679 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/quote_with_configurable_product.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/quote_with_configurable_product.php @@ -17,7 +17,7 @@ $options = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( ); $option = $options->setAttributeFilter($attribute->getId())->getFirstItem(); -$requestInfo = new \Magento\Framework\Object( +$requestInfo = new \Magento\Framework\DataObject( ['qty' => 1, 'super_attribute' => [$attribute->getId() => $option->getId()]] ); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/CartTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/CartTest.php index f4887bb251a..d719463f60a 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/CartTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/CartTest.php @@ -89,7 +89,7 @@ class CartTest extends \PHPUnit_Framework_TestCase public function testGetRowUrl() { - $row = new \Magento\Framework\Object(); + $row = new \Magento\Framework\DataObject(); $row->setProductId(1); $this->assertContains('/backend/catalog/product/edit/id/1', $this->_block->getRowUrl($row)); } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/OrdersTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/OrdersTest.php index 64365cf659a..ac7b31acde6 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/OrdersTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/OrdersTest.php @@ -64,7 +64,7 @@ class OrdersTest extends \PHPUnit_Framework_TestCase */ public function testGetRowUrl() { - $row = new \Magento\Framework\Object(['id' => 1]); + $row = new \Magento\Framework\DataObject(['id' => 1]); $this->assertContains('sales/order/view/order_id/1', $this->block->getRowUrl($row)); } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/CartTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/CartTest.php index f1cba5eb23c..d9885fc2fbb 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/CartTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/CartTest.php @@ -63,7 +63,7 @@ class CartTest extends \PHPUnit_Framework_TestCase */ public function testGetRowUrl() { - $row = new \Magento\Framework\Object(['product_id' => 1]); + $row = new \Magento\Framework\DataObject(['product_id' => 1]); $this->assertContains('catalog/product/edit/id/1', $this->block->getRowUrl($row)); } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/OrdersTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/OrdersTest.php index c922438d605..7579479f105 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/OrdersTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/OrdersTest.php @@ -64,7 +64,7 @@ class OrdersTest extends \PHPUnit_Framework_TestCase */ public function testGetRowUrl() { - $row = new \Magento\Framework\Object(['id' => 1]); + $row = new \Magento\Framework\DataObject(['id' => 1]); $this->assertContains('sales/order/view/order_id/1', $this->block->getRowUrl($row)); } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php index 87b52cbf40c..20dca721797 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php @@ -36,7 +36,7 @@ class GroupTest extends \Magento\TestFramework\TestCase\AbstractBackendControlle public function tearDown() { parent::tearDown(); - $this->session->unsCustomerGroupData(); + //$this->session->unsCustomerGroupData(); } public function testNewActionNoCustomerGroupDataInSession() diff --git a/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinksTest.php b/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinksTest.php index 25e4d5ac6f4..0d28a09e585 100644 --- a/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinksTest.php +++ b/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinksTest.php @@ -55,7 +55,7 @@ class LinksTest extends \PHPUnit_Framework_TestCase 'Magento\Framework\Registry' )->register( 'product', - new \Magento\Framework\Object(['type_id' => 'simple']) + new \Magento\Framework\DataObject(['type_id' => 'simple']) ); $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\Framework\View\LayoutInterface' @@ -85,7 +85,7 @@ class LinksTest extends \PHPUnit_Framework_TestCase 'Magento\Framework\Registry' )->register( 'product', - new \Magento\Framework\Object(['type_id' => $productType, 'id' => '1', 'links_title' => $linksTitle]) + new \Magento\Framework\DataObject(['type_id' => $productType, 'id' => '1', 'links_title' => $linksTitle]) ); $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\Framework\View\LayoutInterface' diff --git a/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/SamplesTest.php b/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/SamplesTest.php index 56410b42f1e..576d5ff4b2a 100644 --- a/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/SamplesTest.php +++ b/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/SamplesTest.php @@ -30,7 +30,7 @@ class SamplesTest extends \PHPUnit_Framework_TestCase 'Magento\Framework\Registry' )->register( 'current_product', - new \Magento\Framework\Object(['type_id' => 'simple']) + new \Magento\Framework\DataObject(['type_id' => 'simple']) ); $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\Framework\View\LayoutInterface' @@ -59,7 +59,7 @@ class SamplesTest extends \PHPUnit_Framework_TestCase 'Magento\Framework\Registry' )->register( 'current_product', - new \Magento\Framework\Object( + new \Magento\Framework\DataObject( [ 'type_id' => $productType, 'id' => '1', diff --git a/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/composer.json b/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/composer.json index 47fdec49242..788bca9a094 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/composer.json +++ b/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/composer.json @@ -36,6 +36,7 @@ "oyejorge/less.php": "1.7.0.3", "tubalmartin/cssmin": "2.4.8-p4", "magento/magento-composer-installer": "*", + "phpseclib/phpseclib": "~0.3", "symfony/console": "~2.3" }, "require-dev": { @@ -160,7 +161,6 @@ "colinmollenhour/cache-backend-redis": "dev-master#193d377b7fb2e88595578b282fa01a62d1185abc", "colinmollenhour/credis": "dev-master#f07bbfd4117294f462f0fb19c49221d350bf396f", "linkorb/jsmin-php": "1.1.2", - "phpseclib/phpseclib": "0.2.1", "components/jquery": "1.11.0", "blueimp/jquery-file-upload": "5.6.14", "components/jqueryui": "1.10.4", @@ -173,7 +173,6 @@ "colinmollenhour/cache-backend-redis": "lib/internal/Cm/Cache/Backend/Redis.php", "colinmollenhour/credis": "lib/internal/Credis", "linkorb/jsmin-php": "lib/internal/JSMin", - "phpseclib/phpseclib": "lib/internal/phpseclib", "components/jquery": [ "lib/web/jquery.js", "lib/web/jquery/jquery.min.js", diff --git a/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock b/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock index a68a55fa746..7101b15715f 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock +++ b/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock @@ -476,7 +476,6 @@ "components/jquery": "1.11.0", "components/jqueryui": "1.10.4", "linkorb/jsmin-php": "1.1.2", - "phpseclib/phpseclib": "0.2.1", "tinymce/tinymce": "3.4.7", "trentrichardson/jquery-timepicker-addon": "1.4.3", "twbs/bootstrap": "3.1.0" @@ -488,7 +487,6 @@ "colinmollenhour/cache-backend-redis": "lib/internal/Cm/Cache/Backend/Redis.php", "colinmollenhour/credis": "lib/internal/Credis", "linkorb/jsmin-php": "lib/internal/JSMin", - "phpseclib/phpseclib": "lib/internal/phpseclib", "components/jquery": [ "lib/web/jquery.js", "lib/web/jquery/jquery.min.js", @@ -512,10 +510,6 @@ "lib/internal/LinLibertineFont", "lib/internal/LinLibertineFont" ], - [ - "lib/internal/phpseclib", - "lib/internal/phpseclib" - ], [ "lib/internal/Credis", "lib/internal/Credis" diff --git a/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock b/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock index 3a079231ca9..b407b7e772b 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock +++ b/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock @@ -467,7 +467,6 @@ "components/jquery": "1.11.0", "components/jqueryui": "1.10.4", "linkorb/jsmin-php": "1.1.2", - "phpseclib/phpseclib": "0.2.1", "tinymce/tinymce": "3.4.7", "trentrichardson/jquery-timepicker-addon": "1.4.3", "twbs/bootstrap": "3.1.0" @@ -479,7 +478,6 @@ "colinmollenhour/cache-backend-redis": "lib/internal/Cm/Cache/Backend/Redis.php", "colinmollenhour/credis": "lib/internal/Credis", "linkorb/jsmin-php": "lib/internal/JSMin", - "phpseclib/phpseclib": "lib/internal/phpseclib", "components/jquery": [ "lib/web/jquery.js", "lib/web/jquery/jquery.min.js", @@ -505,10 +503,6 @@ "lib/internal/LinLibertineFont", "lib/internal/LinLibertineFont" ], - [ - "lib/internal/phpseclib", - "lib/internal/phpseclib" - ], [ "lib/internal/Credis", "lib/internal/Credis" diff --git a/dev/tests/integration/testsuite/Magento/Framework/Data/Argument/Interpreter/StringTest.php b/dev/tests/integration/testsuite/Magento/Framework/Data/Argument/Interpreter/StringTest.php deleted file mode 100644 index dc05ddf35d3..00000000000 --- a/dev/tests/integration/testsuite/Magento/Framework/Data/Argument/Interpreter/StringTest.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Data\Argument\Interpreter; - -class StringTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Framework\Data\Argument\Interpreter\String - */ - protected $_model; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_booleanUtils; - - protected function setUp() - { - $this->_booleanUtils = $this->getMock('\Magento\Framework\Stdlib\BooleanUtils'); - $this->_booleanUtils->expects( - $this->any() - )->method( - 'toBoolean' - )->will( - $this->returnValueMap([['true', true], ['false', false]]) - ); - $this->_model = new String($this->_booleanUtils); - $translateRenderer = $this->getMockForAbstractClass('Magento\Framework\Phrase\RendererInterface'); - $translateRenderer->expects($this->any())->method('render')->will( - $this->returnCallback( - function ($input) { - return end($input) . ' (translated)'; - } - ) - ); - \Magento\Framework\Phrase::setRenderer($translateRenderer); - } - - /** - * @param array $input - * @param bool $expected - * - * @dataProvider evaluateDataProvider - */ - public function testEvaluate($input, $expected) - { - $actual = $this->_model->evaluate($input); - $this->assertSame($expected, (string)$actual); - } - - public function evaluateDataProvider() - { - return [ - 'no value' => [[], ''], - 'with value' => [['value' => 'some value'], 'some value'], - 'translation required' => [ - ['value' => 'some value', 'translate' => 'true'], - 'some value (translated)', - ], - 'translation not required' => [['value' => 'some value', 'translate' => 'false'], 'some value'] - ]; - } - - /** - * @param array $input - * - * @dataProvider evaluateExceptionDataProvider - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage String value is expected - */ - public function testEvaluateException($input) - { - $this->_model->evaluate($input); - } - - public function evaluateExceptionDataProvider() - { - return ['not a string' => [['value' => 123]]]; - } -} diff --git a/dev/tests/integration/testsuite/Magento/Framework/Object/Copy/Config/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Framework/Object/Copy/Config/ReaderTest.php deleted file mode 100644 index 3e043b22fa3..00000000000 --- a/dev/tests/integration/testsuite/Magento/Framework/Object/Copy/Config/ReaderTest.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php -/** - * \Magento\Framework\Object\Copy\Config\Reader - * - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Object\Copy\Config; - -use Magento\TestFramework\Helper\Bootstrap; - -class ReaderTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Framework\Object\Copy\Config\Reader - */ - private $model; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $fileResolver; - - public function setUp() - { - $this->fileResolver = $this->getMockForAbstractClass('Magento\Framework\Config\FileResolverInterface'); - $objectManager = Bootstrap::getObjectManager(); - $this->model = $objectManager->create( - 'Magento\Framework\Object\Copy\Config\Reader', - ['fileResolver' => $this->fileResolver] - ); - } - - public function testRead() - { - $this->fileResolver->expects($this->once()) - ->method('get') - ->with('fieldset.xml', 'global') - ->willReturn([file_get_contents(__DIR__ . '/_files/fieldset.xml')]); - $expected = include __DIR__ . '/_files/expectedArray.php'; - $this->assertEquals($expected, $this->model->read('global')); - } - - public function testMergeCompleteAndPartial() - { - $fileList = [ - file_get_contents(__DIR__ . '/_files/partialFieldsetFirst.xml'), - file_get_contents(__DIR__ . '/_files/partialFieldsetSecond.xml'), - ]; - $this->fileResolver->expects($this->once()) - ->method('get') - ->with('fieldset.xml', 'global') - ->willReturn($fileList); - $expected = [ - 'global' => [ - 'quote_convert_item' => [ - 'event_id' => ['to_order_item' => "*"], - 'event_name' => ['to_order_item' => "*"], - 'event_description' => ['to_order_item' => "complexDescription"], - ], - ], - ]; - $this->assertEquals($expected, $this->model->read('global')); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Framework/Object/Copy/Config/_files/expectedArray.php b/dev/tests/integration/testsuite/Magento/Framework/Object/Copy/Config/_files/expectedArray.php deleted file mode 100644 index 38e39b0576c..00000000000 --- a/dev/tests/integration/testsuite/Magento/Framework/Object/Copy/Config/_files/expectedArray.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -return [ - 'global' => [ - 'sales_convert_quote_address' => [ - 'company' => ['to_order_address' => '*', 'to_customer_address' => '*'], - 'street_full' => ['to_order_address' => 'street'], - 'street' => ['to_customer_address' => '*'], - ], - ] -]; diff --git a/dev/tests/integration/testsuite/Magento/Framework/Object/Copy/Config/_files/fieldset.xml b/dev/tests/integration/testsuite/Magento/Framework/Object/Copy/Config/_files/fieldset.xml deleted file mode 100644 index 1b534231b98..00000000000 --- a/dev/tests/integration/testsuite/Magento/Framework/Object/Copy/Config/_files/fieldset.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../../../../../lib/internal/Magento/Framework/Object/etc/fieldset.xsd"> - <scope id="global"> - <fieldset id="sales_convert_quote_address"> - <field name="company"> - <aspect name="to_order_address" /> - <aspect name="to_customer_address" /> - </field> - <field name="street_full"> - <aspect name="to_order_address" targetField="street" /> - </field> - <field name="street"> - <aspect name="to_customer_address" /> - </field> - </fieldset> - </scope> -</config> diff --git a/dev/tests/integration/testsuite/Magento/Framework/Object/Copy/Config/_files/partialFieldsetFirst.xml b/dev/tests/integration/testsuite/Magento/Framework/Object/Copy/Config/_files/partialFieldsetFirst.xml deleted file mode 100644 index 6074e4f38f4..00000000000 --- a/dev/tests/integration/testsuite/Magento/Framework/Object/Copy/Config/_files/partialFieldsetFirst.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../../../../../lib/internal/Magento/Framework/Object/etc/fieldset.xsd"> - <scope id="global"> - <fieldset id="quote_convert_item"> - <field name="event_id"> - </field> - <field name="event_name"> - </field> - <field name="event_description"> - <aspect name="to_order_item" targetField="complexDescription" /> - </field> - </fieldset> - </scope> -</config> diff --git a/dev/tests/integration/testsuite/Magento/Framework/Object/Copy/Config/_files/partialFieldsetSecond.xml b/dev/tests/integration/testsuite/Magento/Framework/Object/Copy/Config/_files/partialFieldsetSecond.xml deleted file mode 100644 index 5e6a7144b62..00000000000 --- a/dev/tests/integration/testsuite/Magento/Framework/Object/Copy/Config/_files/partialFieldsetSecond.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../../../../../lib/internal/Magento/Framework/Object/etc/fieldset_file.xsd"> - <scope id="global"> - <fieldset id="quote_convert_item"> - <field name="event_id"> - <aspect name="to_order_item" /> - </field> - <field name="event_name"> - <aspect name="to_order_item" /> - </field> - <field name="event_description"> - </field> - </fieldset> - </scope> -</config> diff --git a/dev/tests/integration/testsuite/Magento/Framework/Object/CopyTest.php b/dev/tests/integration/testsuite/Magento/Framework/Object/CopyTest.php deleted file mode 100644 index 274be468175..00000000000 --- a/dev/tests/integration/testsuite/Magento/Framework/Object/CopyTest.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Object; - -class CopyTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Framework\Object\Copy - */ - protected $_service; - - protected function setUp() - { - $this->_service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Framework\Object\Copy'); - } - - public function testCopyFieldset() - { - $fieldset = 'sales_copy_order'; - $aspect = 'to_edit'; - $data = ['customer_email' => 'admin@example.com', 'customer_group_id' => '1']; - $source = new \Magento\Framework\Object($data); - $target = new \Magento\Framework\Object(); - $expectedTarget = new \Magento\Framework\Object($data); - - $this->assertNull($this->_service->copyFieldsetToTarget($fieldset, $aspect, 'invalid_source', [])); - $this->assertNull($this->_service->copyFieldsetToTarget($fieldset, $aspect, [], 'invalid_target')); - $this->assertEquals( - $target, - $this->_service->copyFieldsetToTarget('invalid_fieldset', $aspect, $source, $target) - ); - $this->assertSame($target, $this->_service->copyFieldsetToTarget($fieldset, $aspect, $source, $target)); - $this->assertEquals($expectedTarget, $target); - } - - public function testCopyFieldsetArrayTarget() - { - $fieldset = 'sales_copy_order'; - $aspect = 'to_edit'; - $data = ['customer_email' => 'admin@example.com', 'customer_group_id' => '1']; - $source = new \Magento\Framework\Object($data); - $target = []; - $expectedTarget = $data; - - $this->assertEquals( - $target, - $this->_service->copyFieldsetToTarget('invalid_fieldset', $aspect, $source, $target) - ); - $this->assertEquals( - $expectedTarget, - $this->_service->copyFieldsetToTarget($fieldset, $aspect, $source, $target) - ); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Framework/Search/Adapter/Mysql/Builder/Query/MatchTest.php b/dev/tests/integration/testsuite/Magento/Framework/Search/Adapter/Mysql/Builder/Query/MatchTest.php index bc60599080b..33b8129ce57 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Search/Adapter/Mysql/Builder/Query/MatchTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Search/Adapter/Mysql/Builder/Query/MatchTest.php @@ -6,7 +6,7 @@ namespace Magento\Framework\Search\Adapter\Mysql\Builder\Query; use Magento\Framework\App\Resource\Config; -use Magento\Framework\Search\Request\Query\Bool; +use Magento\Framework\Search\Request\Query\BoolExpression; use Magento\Framework\Search\Adapter\Mysql\ScoreBuilder; use Magento\TestFramework\Helper\Bootstrap; @@ -68,9 +68,9 @@ class MatchTest extends \PHPUnit_Framework_TestCase public function buildQueryProvider() { return [ - [Bool::QUERY_CONDITION_MUST, '+'], - [Bool::QUERY_CONDITION_SHOULD, ''], - [Bool::QUERY_CONDITION_NOT, '-'] + [BoolExpression::QUERY_CONDITION_MUST, '+'], + [BoolExpression::QUERY_CONDITION_SHOULD, ''], + [BoolExpression::QUERY_CONDITION_NOT, '-'] ]; } } diff --git a/dev/tests/integration/testsuite/Magento/Framework/Session/SaveHandler/DbTableTest.php b/dev/tests/integration/testsuite/Magento/Framework/Session/SaveHandler/DbTableTest.php index 12dbfcb466d..ce29219ea0b 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Session/SaveHandler/DbTableTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Session/SaveHandler/DbTableTest.php @@ -88,7 +88,7 @@ class DbTableTest extends \PHPUnit_Framework_TestCase // session stores serialized objects with protected properties // we need to test this case to ensure that DB adapter successfully processes "\0" symbols in serialized data foreach ($this->_sourceData as $key => $data) { - $this->_sessionData[$key] = new \Magento\Framework\Object($data); + $this->_sessionData[$key] = new \Magento\Framework\DataObject($data); } } diff --git a/dev/tests/integration/testsuite/Magento/Framework/TranslateCachingTest.php b/dev/tests/integration/testsuite/Magento/Framework/TranslateCachingTest.php index f9b9e1c6740..b8d5d9ee78e 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/TranslateCachingTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/TranslateCachingTest.php @@ -47,8 +47,8 @@ class TranslateCachingTest extends \PHPUnit_Framework_TestCase $model->loadData(\Magento\Framework\App\Area::AREA_FRONTEND); // this is supposed to cache the fixture $this->assertEquals('Fixture Db Translation', new Phrase('Fixture String')); - /** @var \Magento\Translation\Model\Resource\String $translateString */ - $translateString = $this->objectManager->create('Magento\Translation\Model\Resource\String'); + /** @var \Magento\Translation\Model\Resource\StringUtils $translateString */ + $translateString = $this->objectManager->create('Magento\Translation\Model\Resource\StringUtils'); $translateString->saveTranslate('Fixture String', 'New Db Translation'); $this->assertEquals( diff --git a/dev/tests/integration/testsuite/Magento/Framework/ValidatorFactoryTest.php b/dev/tests/integration/testsuite/Magento/Framework/ValidatorFactoryTest.php index 7cbc08f13a1..d3458fa5e41 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/ValidatorFactoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/ValidatorFactoryTest.php @@ -20,7 +20,7 @@ class ValidatorFactoryTest extends \PHPUnit_Framework_TestCase public function testCreateWithInstanceName() { - $setName = 'Magento\Framework\Object'; + $setName = 'Magento\Framework\DataObject'; $this->assertInstanceOf($setName, $this->model->create([], $setName)); } diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Element/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Element/TemplateTest.php index 913a63fda63..6171974e20c 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/Element/TemplateTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/Element/TemplateTest.php @@ -84,7 +84,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase public function testGetObjectData() { - $object = new \Magento\Framework\Object(['key' => 'value']); + $object = new \Magento\Framework\DataObject(['key' => 'value']); $this->assertEquals('value', $this->_block->getObjectData($object, 'key')); } diff --git a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php index 6b7bfa42fa3..079a9a112d7 100644 --- a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php +++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php @@ -21,7 +21,7 @@ class GroupedTest extends \PHPUnit_Framework_TestCase public function testFactory() { - $product = new \Magento\Framework\Object(); + $product = new \Magento\Framework\DataObject(); $product->setTypeId(\Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE); $type = $this->_productType->factory($product); $this->assertInstanceOf('\Magento\GroupedProduct\Model\Product\Type\Grouped', $type); diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php index baa33f99ed1..6ef46093056 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php @@ -33,7 +33,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase $model = $this->getMockForAbstractClass( 'Magento\ImportExport\Model\Import\AbstractEntity', [ - $objectManager->get('Magento\Framework\Stdlib\String'), + $objectManager->get('Magento\Framework\Stdlib\StringUtils'), $objectManager->get('Magento\Framework\App\Config\ScopeConfigInterface'), $objectManager->get('Magento\ImportExport\Model\ImportFactory'), $objectManager->get('Magento\ImportExport\Model\Resource\Helper'), diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Block/Payment/Form/Billing/AgreementTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Block/Payment/Form/Billing/AgreementTest.php index 2bb7d5fa9cf..97b2e5e7e61 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/Block/Payment/Form/Billing/AgreementTest.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/Block/Payment/Form/Billing/AgreementTest.php @@ -26,7 +26,7 @@ class AgreementTest extends \PHPUnit_Framework_TestCase )->method( 'getBlock' )->will( - $this->returnValue(new \Magento\Framework\Object(['quote' => $quote])) + $this->returnValue(new \Magento\Framework\DataObject(['quote' => $quote])) ); $layout->expects($this->once())->method('getParentName')->will($this->returnValue('billing_agreement_form')); diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/Express/CheckoutTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/Express/CheckoutTest.php index 90adf2684f9..29c321e1652 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/Model/Express/CheckoutTest.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/Express/CheckoutTest.php @@ -270,7 +270,7 @@ class CheckoutTest extends \PHPUnit_Framework_TestCase * Prepare fixture for exported address * * @param array $addressData - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ protected function _getExportedAddressFixture(array $addressData) { @@ -281,7 +281,7 @@ class CheckoutTest extends \PHPUnit_Framework_TestCase $result[$key] = 'exported' . $addressData[$key]; } } - $fixture = new \Magento\Framework\Object($result); + $fixture = new \Magento\Framework\DataObject($result); $fixture->setExportedKeys($addressDataKeys); $fixture->setData('note', 'note'); return $fixture; diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/PayflowproTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/PayflowproTest.php index 0f0777acdee..3e9161a094c 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/Model/PayflowproTest.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/PayflowproTest.php @@ -85,7 +85,7 @@ class PayflowproTest extends \PHPUnit_Framework_TestCase $order->loadByIncrementId('100000001'); $this->_httpClientMock->expects($this->any())->method('request') - ->will($this->returnValue(new \Magento\Framework\Object(['body' => 'RESULTval=12&val2=34']))); + ->will($this->returnValue(new \Magento\Framework\DataObject(['body' => 'RESULTval=12&val2=34']))); $expectedResult = ['resultval' => '12', 'val2' => '34', 'result_code' => null]; $this->assertEquals($expectedResult, $this->_model->acceptPayment($order->getPayment())); diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php index 67b1a8258c1..35526b43f3c 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php @@ -83,7 +83,7 @@ class VoidTest extends \PHPUnit_Framework_TestCase ] ); - $response = new \Magento\Framework\Object( + $response = new \Magento\Framework\DataObject( [ 'result' => '0', 'pnref' => 'V19A3D27B61E', @@ -103,7 +103,7 @@ class VoidTest extends \PHPUnit_Framework_TestCase ->willReturnSelf(); $payment->setMethodInstance($instance); - $payment->void(new \Magento\Framework\Object()); + $payment->void(new \Magento\Framework\DataObject()); $order->save(); $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Sales\Model\Order'); diff --git a/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteTest.php b/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteTest.php index c3cb9184d21..ae26cf319cf 100644 --- a/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteTest.php +++ b/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteTest.php @@ -303,7 +303,7 @@ class QuoteTest extends \PHPUnit_Framework_TestCase 'qty' => 1, 'id' => 0 ]; - $updateParams = new \Magento\Framework\Object($params); + $updateParams = new \Magento\Framework\DataObject($params); $quote->updateItem($updateParams['id'], $updateParams); $quote->setTotalsCollectedFlag(false)->collectTotals(); $this->assertEquals(1, $quote->getItemsQty()); diff --git a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Coupons/GridTest.php b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Coupons/GridTest.php index 85d5c3c1efb..4d53af18657 100644 --- a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Coupons/GridTest.php +++ b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Coupons/GridTest.php @@ -24,7 +24,7 @@ class GridTest extends \PHPUnit_Framework_TestCase 'Magento\Reports\Block\Adminhtml\Sales\Coupons\Grid' ); - $filterData = new \Magento\Framework\Object(); + $filterData = new \Magento\Framework\DataObject(); if ($reportType) { $filterData->setReportType($reportType); } diff --git a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Invoiced/GridTest.php b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Invoiced/GridTest.php index 8012f00708f..f6824f28d19 100644 --- a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Invoiced/GridTest.php +++ b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Invoiced/GridTest.php @@ -24,7 +24,7 @@ class GridTest extends \PHPUnit_Framework_TestCase 'Magento\Reports\Block\Adminhtml\Sales\Invoiced\Grid' ); - $filterData = new \Magento\Framework\Object(); + $filterData = new \Magento\Framework\DataObject(); if ($reportType) { $filterData->setReportType($reportType); } diff --git a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Refunded/GridTest.php b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Refunded/GridTest.php index c90e2b74fff..103e18f945f 100644 --- a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Refunded/GridTest.php +++ b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Refunded/GridTest.php @@ -24,7 +24,7 @@ class GridTest extends \PHPUnit_Framework_TestCase 'Magento\Reports\Block\Adminhtml\Sales\Refunded\Grid' ); - $filterData = new \Magento\Framework\Object(); + $filterData = new \Magento\Framework\DataObject(); if ($reportType) { $filterData->setReportType($reportType); } diff --git a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Sales/GridTest.php b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Sales/GridTest.php index d9a4d886c26..b332470f64d 100644 --- a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Sales/GridTest.php +++ b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Sales/GridTest.php @@ -24,7 +24,7 @@ class GridTest extends \PHPUnit_Framework_TestCase 'Magento\Reports\Block\Adminhtml\Sales\Sales\Grid' ); - $filterData = new \Magento\Framework\Object(); + $filterData = new \Magento\Framework\DataObject(); if ($reportType) { $filterData->setReportType($reportType); } @@ -71,7 +71,7 @@ class GridTest extends \PHPUnit_Framework_TestCase public function testGetCountTotals($from, $to, $expectedResult) { $block = $this->_createBlock(); - $filterData = new \Magento\Framework\Object(); + $filterData = new \Magento\Framework\DataObject(); $filterData->setReportType('updated_at_order'); $filterData->setPeriodType('day'); diff --git a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Shipping/GridTest.php b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Shipping/GridTest.php index f48b883b500..4444afd220c 100644 --- a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Shipping/GridTest.php +++ b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Shipping/GridTest.php @@ -24,7 +24,7 @@ class GridTest extends \PHPUnit_Framework_TestCase 'Magento\Reports\Block\Adminhtml\Sales\Shipping\Grid' ); - $filterData = new \Magento\Framework\Object(); + $filterData = new \Magento\Framework\DataObject(); if ($reportType) { $filterData->setReportType($reportType); } diff --git a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Tax/GridTest.php b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Tax/GridTest.php index 4039d0bf3ba..63e3c068259 100644 --- a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Tax/GridTest.php +++ b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Tax/GridTest.php @@ -24,7 +24,7 @@ class GridTest extends \PHPUnit_Framework_TestCase 'Magento\Reports\Block\Adminhtml\Sales\Tax\Grid' ); - $filterData = new \Magento\Framework\Object(); + $filterData = new \Magento\Framework\DataObject(); if ($reportType) { $filterData->setReportType($reportType); } diff --git a/dev/tests/integration/testsuite/Magento/Reports/_files/viewed_products.php b/dev/tests/integration/testsuite/Magento/Reports/_files/viewed_products.php index cd856d8ee58..00300474a8a 100644 --- a/dev/tests/integration/testsuite/Magento/Reports/_files/viewed_products.php +++ b/dev/tests/integration/testsuite/Magento/Reports/_files/viewed_products.php @@ -23,9 +23,9 @@ foreach ([1, 2, 1, 21, 1, 21] as $productId) { $reportObserver->catalogProductView( new \Magento\Framework\Event\Observer( [ - 'event' => new \Magento\Framework\Object( + 'event' => new \Magento\Framework\DataObject( [ - 'product' => new \Magento\Framework\Object(['id' => $productId]), + 'product' => new \Magento\Framework\DataObject(['id' => $productId]), ] ), ] diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractTest.php index 881adb14330..a30c753c879 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractTest.php @@ -19,7 +19,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase /** @var $block \Magento\Sales\Block\Adminhtml\Items\AbstractItems */ $block = $layout->createBlock('Magento\Sales\Block\Adminhtml\Items\AbstractItems', 'block'); - $item = new \Magento\Framework\Object(); + $item = new \Magento\Framework\DataObject(); $this->assertEmpty($block->getItemExtraInfoHtml($item)); diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/FormTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/FormTest.php index d9e83a4a5dd..84cfe40f005 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/FormTest.php @@ -25,7 +25,7 @@ class FormTest extends \PHPUnit_Framework_TestCase $backendQuoteSession->setCustomerId($fixtureCustomerId); /** @var \Magento\Sales\Block\Adminhtml\Order\Create\Giftmessage\Form $block */ $block = $objectManager->create('Magento\Sales\Block\Adminhtml\Order\Create\Giftmessage\Form'); - $block->setEntity(new \Magento\Framework\Object()); + $block->setEntity(new \Magento\Framework\DataObject()); /** SUT execution and assertions */ $this->assertEquals('John Smith', $block->getDefaultSender(), 'Sender name is invalid.'); diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Report/Filter/Form/CouponTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Report/Filter/Form/CouponTest.php index 3ced4dd625d..ee82755e8f0 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Report/Filter/Form/CouponTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Report/Filter/Form/CouponTest.php @@ -32,7 +32,7 @@ class CouponTest extends \PHPUnit_Framework_TestCase { /** @var $block \Magento\Sales\Block\Adminhtml\Report\Filter\Form\Coupon */ $block = $this->_layout->createBlock('Magento\Sales\Block\Adminhtml\Report\Filter\Form\Coupon'); - $block->setFilterData(new \Magento\Framework\Object()); + $block->setFilterData(new \Magento\Framework\DataObject()); $html = $block->toHtml(); $expectedStrings = [ diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_bundle.php b/dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_bundle.php index f80113ad111..1ac811d161a 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_bundle.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_bundle.php @@ -121,7 +121,7 @@ foreach ($optionCollection as $option) { } } -$buyRequest = new \Magento\Framework\Object( +$buyRequest = new \Magento\Framework\DataObject( ['qty' => 1, 'bundle_option' => $bundleOptions, 'bundle_option_qty' => $bundleOptionsQty] ); $product->setSkipCheckRequiredOption(true); diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/MainTest.php b/dev/tests/integration/testsuite/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/MainTest.php index 7f74a96c976..bc0782f3f34 100644 --- a/dev/tests/integration/testsuite/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/MainTest.php +++ b/dev/tests/integration/testsuite/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/MainTest.php @@ -52,7 +52,7 @@ class MainTest extends \PHPUnit_Framework_TestCase $groupRepository = $objectManager->create('Magento\Customer\Api\GroupRepositoryInterface'); /** @var \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteria */ $searchCriteria = $objectManager->create('Magento\Framework\Api\SearchCriteriaBuilder'); - $objectConverter = $objectManager->get('Magento\Framework\Convert\Object'); + $objectConverter = $objectManager->get('Magento\Framework\Convert\DataObject'); $groups = $groups = $groupRepository->getList($searchCriteria->create()) ->getItems(); $expected = $objectConverter->toOptionArray($groups, 'id', 'code'); diff --git a/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Parser/Adapter/Php/Tokenizer/_files/objectsCode.php.txt b/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Parser/Adapter/Php/Tokenizer/_files/objectsCode.php.txt index 72b351197a1..cf0c4a52738 100644 --- a/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Parser/Adapter/Php/Tokenizer/_files/objectsCode.php.txt +++ b/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Parser/Adapter/Php/Tokenizer/_files/objectsCode.php.txt @@ -2,4 +2,4 @@ new \Magento\Framework\Phrase('Testing'); new Phrase('More testing'); -new \Magento\Framework\Object(); +new \Magento\Framework\DataObject(); diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/Resource/CalculationTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/Resource/CalculationTest.php index 6f79798ae51..e58f74a57e3 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Model/Resource/CalculationTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Model/Resource/CalculationTest.php @@ -24,7 +24,7 @@ class CalculationTest extends \PHPUnit_Framework_TestCase $productTaxClasses = $taxRule->getProductTaxClassIds(); $taxRate = $objectManager->get('Magento\Framework\Registry') ->registry('_fixture/Magento_Tax_Model_Calculation_Rate'); - $data = new \Magento\Framework\Object(); + $data = new \Magento\Framework\DataObject(); $data->setData( [ 'tax_country_id' => 'US', diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxCalculationTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxCalculationTest.php index 63abd107378..e96bca26a98 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxCalculationTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxCalculationTest.php @@ -1951,12 +1951,12 @@ class TaxCalculationTest extends \PHPUnit_Framework_TestCase * * This utility function is used to simplify expected result verification. * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return array */ private function convertObjectToArray($object) { - if ($object instanceof \Magento\Framework\Object) { + if ($object instanceof \Magento\Framework\DataObject) { $data = $object->getData(); } else if (is_object($object)) { $data = (array)$object; diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/FieldsetConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/FieldsetConfigFilesTest.php index 34c877629d0..64241595c14 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/FieldsetConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/FieldsetConfigFilesTest.php @@ -16,7 +16,7 @@ class FieldsetConfigFilesTest extends \Magento\TestFramework\TestCase\AbstractCo */ protected function _getReaderClassName() { - return 'Magento\Framework\Object\Copy\Config\Reader'; + return 'Magento\Framework\DataObject\Copy\Config\Reader'; } /** @@ -38,6 +38,6 @@ class FieldsetConfigFilesTest extends \Magento\TestFramework\TestCase\AbstractCo */ protected function _getXsdPath() { - return '/../../lib/internal/Magento/Framework/Object/etc/fieldset_file.xsd'; + return '/../../lib/internal/Magento/Framework/DataObject/etc/fieldset_file.xsd'; } } diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/ObserverTest.php index 3740b4fd94d..b7512e79a86 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/ObserverTest.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/ObserverTest.php @@ -64,7 +64,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase protected function _createEventObserverForThemeRegistration() { $response = $this->_objectManager->create( - 'Magento\Framework\Object', + 'Magento\Framework\DataObject', ['data' => ['additional_options' => []]] ); $event = $this->_objectManager->create( diff --git a/dev/tests/integration/testsuite/Magento/Translation/Model/InlineParserTest.php b/dev/tests/integration/testsuite/Magento/Translation/Model/InlineParserTest.php index da9e72ff099..44c03aa190b 100644 --- a/dev/tests/integration/testsuite/Magento/Translation/Model/InlineParserTest.php +++ b/dev/tests/integration/testsuite/Magento/Translation/Model/InlineParserTest.php @@ -54,7 +54,7 @@ class InlineParserTest extends \PHPUnit_Framework_TestCase $this->_inlineParser->processAjaxPost($inputArray); $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Translation\Model\String' + 'Magento\Translation\Model\StringUtils' ); $model->load($originalText); try { diff --git a/dev/tests/integration/testsuite/Magento/Translation/Model/StringTest.php b/dev/tests/integration/testsuite/Magento/Translation/Model/StringTest.php index 47eb5c9722b..0dbc805c3f9 100644 --- a/dev/tests/integration/testsuite/Magento/Translation/Model/StringTest.php +++ b/dev/tests/integration/testsuite/Magento/Translation/Model/StringTest.php @@ -9,20 +9,20 @@ namespace Magento\Translation\Model; class StringTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Translation\Model\String + * @var \Magento\Translation\Model\StringUtils */ protected $_model; protected function setUp() { $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Translation\Model\String' + 'Magento\Translation\Model\StringUtils' ); } public function testConstructor() { - $this->assertInstanceOf('Magento\Translation\Model\Resource\String', $this->_model->getResource()); + $this->assertInstanceOf('Magento\Translation\Model\Resource\StringUtils', $this->_model->getResource()); } public function testSetGetString() diff --git a/dev/tests/integration/testsuite/Magento/Translation/_files/db_translate.php b/dev/tests/integration/testsuite/Magento/Translation/_files/db_translate.php index ec692d4ae8c..50032424af0 100644 --- a/dev/tests/integration/testsuite/Magento/Translation/_files/db_translate.php +++ b/dev/tests/integration/testsuite/Magento/Translation/_files/db_translate.php @@ -4,8 +4,8 @@ * See COPYING.txt for license details. */ -/** @var \Magento\Translation\Model\Resource\String $translateString */ +/** @var \Magento\Translation\Model\Resource\StringUtils $translateString */ $translateString = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Translation\Model\Resource\String' + 'Magento\Translation\Model\Resource\StringUtils' ); $translateString->saveTranslate('Fixture String', 'Fixture Db Translation'); diff --git a/dev/tests/integration/testsuite/Magento/Translation/_files/db_translate_admin_store.php b/dev/tests/integration/testsuite/Magento/Translation/_files/db_translate_admin_store.php index cf73c2cf8cf..64c21e770d6 100644 --- a/dev/tests/integration/testsuite/Magento/Translation/_files/db_translate_admin_store.php +++ b/dev/tests/integration/testsuite/Magento/Translation/_files/db_translate_admin_store.php @@ -11,8 +11,8 @@ )->load( \Magento\Framework\App\Area::PART_CONFIG ); -/** @var \Magento\Translation\Model\Resource\String $translateString */ +/** @var \Magento\Translation\Model\Resource\StringUtils $translateString */ $translateString = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Translation\Model\Resource\String' + 'Magento\Translation\Model\Resource\StringUtils' ); $translateString->saveTranslate('string to translate', 'predefined string translation', null); diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Category/TreeTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Category/TreeTest.php index 0ca9a9cadcc..0e8789c24cf 100644 --- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Category/TreeTest.php +++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Category/TreeTest.php @@ -49,7 +49,7 @@ class TreeTest extends \PHPUnit_Framework_TestCase */ public function testGetLoadTreeUrl() { - $row = new \Magento\Framework\Object(['id' => 1]); + $row = new \Magento\Framework\DataObject(['id' => 1]); $this->assertStringStartsWith( 'http://localhost/index.php', $this->_treeBlock->getLoadTreeUrl($row), diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Product/GridTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Product/GridTest.php index b0195187b54..5870c394abc 100644 --- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Product/GridTest.php +++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Product/GridTest.php @@ -34,7 +34,7 @@ class GridTest extends \PHPUnit_Framework_TestCase $this->assertStringStartsWith('http://localhost/index.php', $gridBlock->getGridUrl(), 'Grid URL is invalid'); - $row = new \Magento\Framework\Object(['id' => 1]); + $row = new \Magento\Framework\DataObject(['id' => 1]); $this->assertStringStartsWith( 'http://localhost/index.php/backend/admin/index/edit/product/1', $gridBlock->getRowUrl($row), diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/GridTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/GridTest.php index a201e3105ae..b42a2e3336c 100644 --- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/GridTest.php +++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/GridTest.php @@ -34,7 +34,7 @@ class GridTest extends \PHPUnit_Framework_TestCase $this->assertStringStartsWith('http://localhost/index.php', $gridBlock->getGridUrl(), 'Grid URL is invalid'); - $row = new \Magento\Framework\Object(['id' => 1]); + $row = new \Magento\Framework\DataObject(['id' => 1]); $this->assertStringStartsWith( 'http://localhost/index.php/backend/admin/index/edit/cms_page/1', $gridBlock->getRowUrl($row), diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Edit/FormTest.php index 570e42dad7d..7497433d8b6 100644 --- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Edit/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Edit/FormTest.php @@ -37,7 +37,7 @@ class FormTest extends \PHPUnit_Framework_TestCase public function testPrepareForm() { // Test form was configured correctly - $form = $this->_getFormInstance(['url_rewrite' => new \Magento\Framework\Object(['id' => 3])]); + $form = $this->_getFormInstance(['url_rewrite' => new \Magento\Framework\DataObject(['id' => 3])]); $this->assertInstanceOf('Magento\Framework\Data\Form', $form); $this->assertNotEmpty($form->getAction()); $this->assertEquals('edit_form', $form->getId()); @@ -82,7 +82,7 @@ class FormTest extends \PHPUnit_Framework_TestCase $sessionValues ); // Re-init form to use newly set session data - $form = $this->_getFormInstance(['url_rewrite' => new \Magento\Framework\Object()]); + $form = $this->_getFormInstance(['url_rewrite' => new \Magento\Framework\DataObject()]); // Check that all fields values are restored from session foreach ($sessionValues as $field => $value) { @@ -98,7 +98,7 @@ class FormTest extends \PHPUnit_Framework_TestCase */ public function testStoreElementSingleStore() { - $form = $this->_getFormInstance(['url_rewrite' => new \Magento\Framework\Object(['id' => 3])]); + $form = $this->_getFormInstance(['url_rewrite' => new \Magento\Framework\DataObject(['id' => 3])]); /** @var $storeElement \Magento\Framework\Data\Form\Element\AbstractElement */ $storeElement = $form->getElement('store_id'); $this->assertInstanceOf('Magento\Framework\Data\Form\Element\Hidden', $storeElement); @@ -120,7 +120,7 @@ class FormTest extends \PHPUnit_Framework_TestCase */ public function testStoreElementMultiStores() { - $form = $this->_getFormInstance(['url_rewrite' => new \Magento\Framework\Object(['id' => 3])]); + $form = $this->_getFormInstance(['url_rewrite' => new \Magento\Framework\DataObject(['id' => 3])]); /** @var $storeElement \Magento\Framework\Data\Form\Element\AbstractElement */ $storeElement = $form->getElement('store_id'); @@ -162,13 +162,13 @@ class FormTest extends \PHPUnit_Framework_TestCase { return [ [ - new \Magento\Framework\Object(), + new \Magento\Framework\DataObject(), [ 'store_id' => false, ], ], [ - new \Magento\Framework\Object(['id' => 3, 'is_autogenerated' => true]), + new \Magento\Framework\DataObject(['id' => 3, 'is_autogenerated' => true]), [ 'store_id' => true, ] diff --git a/dev/tests/integration/testsuite/Magento/Weee/Model/TaxTest.php b/dev/tests/integration/testsuite/Magento/Weee/Model/TaxTest.php index c423caff57b..162bae45761 100644 --- a/dev/tests/integration/testsuite/Magento/Weee/Model/TaxTest.php +++ b/dev/tests/integration/testsuite/Magento/Weee/Model/TaxTest.php @@ -80,7 +80,7 @@ class TaxTest extends \PHPUnit_Framework_TestCase $quote->setCustomerGroupId($fixtureGroupId); $quote->setCustomerTaxClassId($fixtureTaxClassId); $quote->setCustomer($customerDataSet); - $shipping = new \Magento\Framework\Object([ + $shipping = new \Magento\Framework\DataObject([ 'quote' => $quote, ]); $product = Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); diff --git a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/MainTest.php b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/MainTest.php index 407ff5785ed..182f9dab29c 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/MainTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/MainTest.php @@ -15,7 +15,7 @@ class MainTest extends \PHPUnit_Framework_TestCase /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->get('Magento\Framework\Registry') - ->register('current_widget_instance', new \Magento\Framework\Object()); + ->register('current_widget_instance', new \Magento\Framework\DataObject()); /** @var \Magento\Widget\Block\Adminhtml\Widget\Instance\Edit\Tab\Main $block */ $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\Framework\View\LayoutInterface' diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/ConfigTest.php index 329bfe260ba..8581eb113b0 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/ConfigTest.php @@ -35,7 +35,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase 'Magento/backend' ); - $config = new \Magento\Framework\Object(); + $config = new \Magento\Framework\DataObject(); $settings = $this->_model->getPluginSettings($config); $this->assertArrayHasKey('widget_plugin_src', $settings); @@ -56,7 +56,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function testGetWidgetWindowUrl() { - $config = new \Magento\Framework\Object(['widget_filters' => ['is_email_compatible' => 1]]); + $config = new \Magento\Framework\DataObject(['widget_filters' => ['is_email_compatible' => 1]]); $url = $this->_model->getWidgetWindowUrl($config); diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/Wishlist/Item/OptionsTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/Wishlist/Item/OptionsTest.php index 1a9842915f8..00bca25d3d5 100644 --- a/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/Wishlist/Item/OptionsTest.php +++ b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/Wishlist/Item/OptionsTest.php @@ -19,8 +19,8 @@ class OptionsTest extends \PHPUnit_Framework_TestCase 'Magento\Wishlist\Block\Customer\Wishlist\Item\Options' ); $this->assertEmpty($block->getTemplate()); - $product = new \Magento\Framework\Object(['type_id' => 'test']); - $item = new \Magento\Framework\Object(['product' => $product]); + $product = new \Magento\Framework\DataObject(['type_id' => 'test']); + $item = new \Magento\Framework\DataObject(['product' => $product]); $block->setItem($item); $this->assertNotEmpty($block->getTemplate()); $block->setTemplate('template'); diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist.php b/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist.php index cc1ab77f407..887af91d258 100644 --- a/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist.php +++ b/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist.php @@ -9,7 +9,7 @@ require __DIR__ . '/../../../Magento/Catalog/_files/product_simple.php'; $wishlist = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Wishlist\Model\Wishlist'); $wishlist->loadByCustomerId($customer->getId(), true); -$item = $wishlist->addNewItem($product, new \Magento\Framework\Object([])); +$item = $wishlist->addNewItem($product, new \Magento\Framework\DataObject([])); // 'product' => '1', // 'related_product' => '', // 'options' => array( diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist_shared.php b/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist_shared.php index 4c54aedb2b1..1d601990a8f 100644 --- a/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist_shared.php +++ b/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist_shared.php @@ -32,7 +32,7 @@ foreach ($simpleProduct->getOptions() as $option) { /* @var $wishlist \Magento\Wishlist\Model\Wishlist */ $wishlist = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Wishlist\Model\Wishlist'); $wishlist->loadByCustomerId($customer->getId(), true); -$wishlist->addNewItem($simpleProduct, new \Magento\Framework\Object(['options' => $options])); +$wishlist->addNewItem($simpleProduct, new \Magento\Framework\DataObject(['options' => $options])); $wishlist->setSharingCode('fixture_unique_code') ->setShared(1) ->save(); diff --git a/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeMessDetector.php b/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeMessDetector.php index ed5c2b33fdb..6c2f84aeec5 100644 --- a/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeMessDetector.php +++ b/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeMessDetector.php @@ -46,7 +46,13 @@ class CodeMessDetector implements ToolInterface */ public function canRun() { - return class_exists('PHPMD\TextUI\Command'); + /** TODO: Remove provided check after PHPMD will support PHP version 7 */ + $isPhpVersionSupported = version_compare( + '7.0.0', + preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION), + '>' + ); + return class_exists('PHPMD\TextUI\Command') && $isPhpVersionSupported; } /** diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeMessDetectorTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeMessDetectorTest.php index 8ea64f945af..196e065ee3e 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeMessDetectorTest.php +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeMessDetectorTest.php @@ -13,6 +13,17 @@ class CodeMessDetectorTest extends \PHPUnit_Framework_TestCase 'some/ruleset/file.xml', 'some/report/file.xml' ); - $this->assertEquals(class_exists('PHPMD\TextUI\Command'), $messDetector->canRun()); + + /** TODO: Remove provided check after PHPMD will support PHP version 7 */ + $isPhpVersionSupported = version_compare( + '7.0.0', + preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION), + '>' + ); + + $this->assertEquals( + class_exists('PHPMD\TextUI\Command') && $isPhpVersionSupported, + $messDetector->canRun() + ); } } diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php index 23fcd366b33..70fc9300695 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php @@ -86,10 +86,10 @@ class CompilerTest extends \PHPUnit_Framework_TestCase $argumentInterpreter = new \Magento\Framework\Data\Argument\Interpreter\Composite( [ 'boolean' => new \Magento\Framework\Data\Argument\Interpreter\Boolean($booleanUtils), - 'string' => new \Magento\Framework\Data\Argument\Interpreter\String($booleanUtils), + 'string' => new \Magento\Framework\Data\Argument\Interpreter\StringUtils($booleanUtils), 'number' => new \Magento\Framework\Data\Argument\Interpreter\Number(), 'null' => new \Magento\Framework\Data\Argument\Interpreter\NullType(), - 'object' => new \Magento\Framework\Data\Argument\Interpreter\Object($booleanUtils), + 'object' => new \Magento\Framework\Data\Argument\Interpreter\DataObject($booleanUtils), 'const' => $constInterpreter, 'init_parameter' => new \Magento\Framework\App\Arguments\ArgumentInterpreter($constInterpreter), ], diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/FieldsetConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/FieldsetConfigTest.php index a06e9df0f9c..7fa617249d6 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/FieldsetConfigTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/FieldsetConfigTest.php @@ -20,7 +20,7 @@ class FieldsetConfigTest extends \PHPUnit_Framework_TestCase $dom = new \DOMDocument(); $dom->loadXML(file_get_contents($configFile)); $schema = \Magento\Framework\App\Utility\Files::init()->getPathToSource() . - '/lib/internal/Magento/Framework/Object/etc/fieldset_file.xsd'; + '/lib/internal/Magento/Framework/DataObject/etc/fieldset_file.xsd'; $errors = \Magento\Framework\Config\Dom::validateDomDocument($dom, $schema); if ($errors) { $this->fail( @@ -41,7 +41,7 @@ class FieldsetConfigTest extends \PHPUnit_Framework_TestCase $dom = new \DOMDocument(); $dom->loadXML(file_get_contents($xmlFile)); $schema = \Magento\Framework\App\Utility\Files::init()->getPathToSource() . - '/lib/internal/Magento/Framework/Object/etc/fieldset.xsd'; + '/lib/internal/Magento/Framework/DataObject/etc/fieldset.xsd'; $errors = \Magento\Framework\Config\Dom::validateDomDocument($dom, $schema); if ($errors) { $this->fail( @@ -59,7 +59,7 @@ class FieldsetConfigTest extends \PHPUnit_Framework_TestCase $dom = new \DOMDocument(); $dom->loadXML(file_get_contents($xmlFile)); $schema = \Magento\Framework\App\Utility\Files::init()->getPathToSource() . - '/lib/internal/Magento/Framework/Object/etc/fieldset.xsd'; + '/lib/internal/Magento/Framework/DataObject/etc/fieldset.xsd'; $errors = \Magento\Framework\Config\Dom::validateDomDocument($dom, $schema); if (!$errors) { $this->fail('There is a problem with the schema. A known bad XML file passed validation'); @@ -72,7 +72,7 @@ class FieldsetConfigTest extends \PHPUnit_Framework_TestCase $dom = new \DOMDocument(); $dom->loadXML(file_get_contents($xmlFile)); $schema = \Magento\Framework\App\Utility\Files::init()->getPathToSource() . - '/lib/internal/Magento/Framework/Object/etc/fieldset_file.xsd'; + '/lib/internal/Magento/Framework/DataObject/etc/fieldset_file.xsd'; $errors = \Magento\Framework\Config\Dom::validateDomDocument($dom, $schema); if ($errors) { $this->fail( @@ -90,7 +90,7 @@ class FieldsetConfigTest extends \PHPUnit_Framework_TestCase $dom = new \DOMDocument(); $dom->loadXML(file_get_contents($xmlFile)); $schema = \Magento\Framework\App\Utility\Files::init()->getPathToSource() . - '/lib/internal/Magento/Framework/Object/etc/fieldset_file.xsd'; + '/lib/internal/Magento/Framework/DataObject/etc/fieldset_file.xsd'; $errors = \Magento\Framework\Config\Dom::validateDomDocument($dom, $schema); if (!$errors) { $this->fail('There is a problem with the schema. A known bad XML file passed validation'); diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/_files/fieldset.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/_files/fieldset.xml index 16dc7a030a7..7d4d901a2f1 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/_files/fieldset.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/_files/fieldset.xml @@ -6,7 +6,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../../../../../../../lib/internal/Magento/Framework/Object/etc/fieldset.xsd"> + xsi:noNamespaceSchemaLocation="../../../../../../../../../../../../lib/internal/Magento/Framework/DataObject/etc/fieldset.xsd"> <scope id="global"> <fieldset id="sales_copy_order"> <field name="customer_email"> diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/_files/fieldset_file.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/_files/fieldset_file.xml index 5d3b638d651..b504bfca1bb 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/_files/fieldset_file.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/_files/fieldset_file.xml @@ -6,7 +6,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../../../../../../../lib/internal/Magento/Framework/Object/etc/fieldset_file.xsd"> + xsi:noNamespaceSchemaLocation="../../../../../../../../../../../../lib/internal/Magento/Framework/DataObject/etc/fieldset_file.xsd"> <scope id="global"> <fieldset id="sales_copy_order"> <field name="customer_email"> diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/_files/invalid_fieldset.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/_files/invalid_fieldset.xml index a9a306b7183..72d7f977e18 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/_files/invalid_fieldset.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/_files/invalid_fieldset.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../../../lib/internal/Magento/Framework/Object/etc/fieldset_file.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../../../lib/internal/Magento/Framework/DataObject/etc/fieldset_file.xsd"> <global> <fieldsets> <sales_copy_order> diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/reference.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/reference.txt index 9f59d0c66a3..716c2178963 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/reference.txt +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/reference.txt @@ -58,10 +58,10 @@ Model3 \Magento\Mtf\ObjectManager\Config\Mapper\Dom \Magento\Mtf\Data\Argument\Interpreter\Constant \Magento\Mtf\Data\Argument\Interpreter\Boolean -\Magento\Mtf\Data\Argument\Interpreter\String +\Magento\Mtf\Data\Argument\Interpreter\StringType \Magento\Mtf\Data\Argument\Interpreter\Number \Magento\Mtf\Data\Argument\Interpreter\NullType -\Magento\Mtf\Data\Argument\Interpreter\Object +\Magento\Mtf\Data\Argument\Interpreter\ObjectType \Magento\Mtf\Data\Argument\Interpreter\Argument \Magento\Mtf\Data\Argument\Interpreter\ArrayType \Magento\Mtf\Data\Argument\InterpreterInterface diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php index 7ce25410060..7c4bd1e1b48 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php @@ -1645,11 +1645,11 @@ return [ ['Magento\Framework\App\Cache\Config\Data', 'Magento\Framework\Cache\Config\Data'], ['Magento\Framework\App\Cache\Config\Reader', 'Magento\Framework\Cache\Config\Reader'], ['Magento\Framework\App\Cache\Config\SchemaLocator', 'Magento\Framework\Cache\Config\SchemaLocator'], - ['Magento\Core\Model\Fieldset\Config', 'Magento\Framework\Object\Copy\Config'], - ['Magento\Core\Model\Fieldset\Config\Converter', 'Magento\Framework\Object\Copy\Config\Converter'], - ['Magento\Core\Model\Fieldset\Config\Data', 'Magento\Framework\Object\Copy\Config\Data'], - ['Magento\Core\Model\Fieldset\Config\Reader', 'Magento\Framework\Object\Copy\Config\Reader'], - ['Magento\Core\Model\Fieldset\Config\SchemaLocator', 'Magento\Framework\Object\Copy\Config\SchemaLocator'], + ['Magento\Core\Model\Fieldset\Config', 'Magento\Framework\DataObject\Copy\Config'], + ['Magento\Core\Model\Fieldset\Config\Converter', 'Magento\Framework\DataObject\Copy\Config\Converter'], + ['Magento\Core\Model\Fieldset\Config\Data', 'Magento\Framework\DataObject\Copy\Config\Data'], + ['Magento\Core\Model\Fieldset\Config\Reader', 'Magento\Framework\DataObject\Copy\Config\Reader'], + ['Magento\Core\Model\Fieldset\Config\SchemaLocator', 'Magento\Framework\DataObject\Copy\Config\SchemaLocator'], ['Magento\Core\Model\ModuleManager', 'Magento\Framework\Module\Manager'], ['Magento\Core\Model\EntryPoint\Media', 'Magento\Core\App\Media'], ['Magento\Core\Controller\Varien\Action', 'Magento\Framework\App\Action\Action'], @@ -1991,18 +1991,18 @@ return [ ['Magento\Catalog\Model\Category\Indexer\Flat'], ['Magento\Framework\Config\Dom\Converter\ArrayConverter'], ['Magento\Framework\Acl\Resource\Config\Dom'], - ['Magento\Validator\Composite\VarienObject', 'Magento\Framework\Validator\Object'], + ['Magento\Validator\Composite\VarienObject', 'Magento\Framework\Validator\DataObject'], ['Magento\GoogleShopping\Helper\Price', 'Magento\Catalog\Model\Product\CatalogPrice'], [ 'Magento\Core\Model\Layout\Argument\Handler\ArrayHandler', 'Magento\Framework\Data\Argument\Interpreter\ArrayType', ], - ['Magento\Core\Model\Layout\Argument\Handler\String', 'Magento\Framework\Data\Argument\Interpreter\String'], + ['Magento\Core\Model\Layout\Argument\Handler\String', 'Magento\Framework\Data\Argument\Interpreter\StringUtils'], ['Magento\Core\Model\Layout\Argument\Handler\Number', 'Magento\Framework\Data\Argument\Interpreter\Number'], ['Magento\Core\Model\Layout\Argument\Handler\Boolean', 'Magento\Framework\Data\Argument\Interpreter\Boolean'], [ 'Magento\Core\Model\Layout\Argument\Handler\Object', - 'Magento\Framework\View\Layout\Argument\Interpreter\Object', + 'Magento\Framework\View\Layout\Argument\Interpreter\DataObject', ], [ 'Magento\Core\Model\Layout\Argument\Handler\Options', @@ -2235,9 +2235,9 @@ return [ ['Magento\Core\Helper\Translate', 'Magento\Translation\Helper\Data'], ['Magento\Core\Model\Translate\Inline\Config', 'Magento\Translation\Model\Inline\Config'], ['Magento\Core\Model\Translate\Inline\Parser', 'Magento\Translation\Model\Inline\Parser'], - ['Magento\Core\Model\Resource\Translate\String', 'Magento\Translation\Model\Resource\String'], + ['Magento\Core\Model\Resource\Translate\String', 'Magento\Translation\Model\Resource\StringUtils'], ['Magento\Core\Model\Resource\Translate', 'Magento\Translation\Model\Resource\Translate'], - ['Magento\Core\Model\Translate\String', 'Magento\Translation\Model\String'], + ['Magento\Core\Model\Translate\String', 'Magento\Translation\Model\StringUtils'], ['Magento\Translation\Helper\Data'], ['Magento\Framework\Translate\Factory'], ['Magento\Backend\Model\Translate'], @@ -2408,7 +2408,7 @@ return [ ], ['Magento\Backend\Model\Translate\Inline', 'Magento\Framework\Translate\Inline'], ['Magento\Backend\Model\Resource\Translate', 'Magento\Translation\Model\Resource\Translate'], - ['Magento\Backend\Model\Resource\Translate\String', 'Magento\Translation\Model\Resource\String'], + ['Magento\Backend\Model\Resource\Translate\StringUtils', 'Magento\Translation\Model\Resource\StringUtils'], ['Magento\Core\Model\Layout', 'Magento\Framework\View\Layout'], ['Magento\Catalog\Block\Product\Price\Template'], ['Magento\Bundle\Block\Catalog\Product\View'], @@ -2531,7 +2531,7 @@ return [ ['Magento\Flag', 'Magento\Framework\Flag'], ['Magento\FlagFactory', 'Magento\Framework\FlagFactory'], ['Magento\Image', 'Magento\Framework\Image'], - ['Magento\Object', 'Magento\Framework\Object'], + ['Magento\Object', 'Magento\Framework\DataObject'], ['Magento\Currency', 'Magento\Framework\Currency'], ['Magento\CurrencyFactory', 'Magento\Framework\CurrencyFactory'], ['Magento\CurrencyInterface', 'Magento\Framework\CurrencyInterface'], @@ -3809,4 +3809,6 @@ return [ 'Magento\ConfigurableProduct\Controller\Adminhtml\Product\Initialization\Helper\Plugin\Handler\ProductType' . '\Configurable' ], + ['Magento\Framework\Object', 'Magento\Framework\DataObject'], + ['Magento\Framework\Stdlib\String', 'Magento\Framework\Stdlib\StringUtils'], ]; diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php index 6c5dd12a4ca..4706ffd1f07 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php @@ -9,8 +9,8 @@ // @codingStandardsIgnoreFile return [ - ['__get', 'Magento\Framework\Object'], - ['__set', 'Magento\Framework\Object'], + ['__get', 'Magento\Framework\DataObject'], + ['__set', 'Magento\Framework\DataObject'], ['_addItem', 'Magento\Theme\Block\Html\Head'], ['_addLink', 'Magento\Customer\Block\Account\Link'], ['_addMinimalPrice', 'Magento\Catalog\Model\Resource\Product\Collection'], @@ -1132,7 +1132,7 @@ return [ ['getPlainTemplateMode', '\Magento\Email\Model\Template\Filter'], ['getMessage', '\Magento\Core\Model\Session\Context', 'getMessageFactory'], ['getMessageFactory', '\Magento\Core\Model\Session\Context', 'getMessagesFactory'], - ['copyFieldsetToTarget', 'Magento\Core\Helper\Data', 'Magento\Framework\Object\Copy::copyFieldsetToTarget'], + ['copyFieldsetToTarget', 'Magento\Core\Helper\Data', 'Magento\Framework\DataObject\Copy::copyFieldsetToTarget'], ['formatDate', '\Magento\Core\Helper\Data', '\Magento\Core\Model\Locale::formatDate'], ['formatTime', '\Magento\Core\Helper\Data', '\Magento\Core\Model\Locale::formatTime'], ['getCustomer', 'Magento\Backend\Model\Session\Quote', 'Magento\Backend\Model\Session\Quote::getCustomerId'], @@ -2250,15 +2250,15 @@ return [ ['getFilePath', 'Magento\MediaStorage\Model\File\Storage\Request'], ['_getStoreTimezoneUtcOffset', 'Magento\Reports\Model\Resource\Report\AbstractReport'], ['_dateToUtc', 'Magento\Reports\Model\Resource\Report\AbstractReport'], - ['getDataSetDefault', 'Magento\Framework\Object'], - ['isDeleted', 'Magento\Framework\Object', 'Moved to Magento\Framework\Model\AbstractModel'], - ['hasDataChanges', 'Magento\Framework\Object', 'Moved to Magento\Framework\Model\AbstractModel'], - ['setIdFieldName', 'Magento\Framework\Object', 'Moved to Magento\Framework\Model\AbstractModel'], - ['getIdFieldName', 'Magento\Framework\Object', 'Moved to Magento\Framework\Model\AbstractModel'], - ['setOrigData', 'Magento\Framework\Object', 'Moved to Magento\Framework\Model\AbstractModel'], - ['getOrigData', 'Magento\Framework\Object', 'Moved to Magento\Framework\Model\AbstractModel'], - ['dataHasChangedFor', 'Magento\Framework\Object', 'Moved to Magento\Framework\Model\AbstractModel'], - ['setDataChanges', 'Magento\Framework\Object', 'Moved to Magento\Framework\Model\AbstractModel'], + ['getDataSetDefault', 'Magento\Framework\DataObject'], + ['isDeleted', 'Magento\Framework\DataObject', 'Moved to Magento\Framework\Model\AbstractModel'], + ['hasDataChanges', 'Magento\Framework\DataObject', 'Moved to Magento\Framework\Model\AbstractModel'], + ['setIdFieldName', 'Magento\Framework\DataObject', 'Moved to Magento\Framework\Model\AbstractModel'], + ['getIdFieldName', 'Magento\Framework\DataObject', 'Moved to Magento\Framework\Model\AbstractModel'], + ['setOrigData', 'Magento\Framework\DataObject', 'Moved to Magento\Framework\Model\AbstractModel'], + ['getOrigData', 'Magento\Framework\DataObject', 'Moved to Magento\Framework\Model\AbstractModel'], + ['dataHasChangedFor', 'Magento\Framework\DataObject', 'Moved to Magento\Framework\Model\AbstractModel'], + ['setDataChanges', 'Magento\Framework\DataObject', 'Moved to Magento\Framework\Model\AbstractModel'], [ 'getConfigureUrl', 'Magento\Checkout\Block\Cart\Item\Renderer', diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_namespaces.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_namespaces.php index 70598646726..d45f40e9cdc 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_namespaces.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_namespaces.php @@ -62,7 +62,7 @@ return [ ['Magento\Gdata', 'Magento\Framework\Gdata'], ['Magento\Image', 'Magento\Framework\Image'], ['Magento\Oauth', 'Magento\Framework\Oauth'], - ['Magento\Object', 'Magento\Framework\Object'], + ['Magento\Object', 'Magento\Framework\DataObject'], ['Magento\Connect'], ['Magento\Framework\Connect'], ['Magento\Bundle\Service'], @@ -86,5 +86,6 @@ return [ ['Magento\GoogleShopping'], ['Magento\Paypal\Block\Standard'], ['Magento\Paypal\Controller\Standard'], - ['Magento\Framework\View\Asset\ModuleNotation'] + ['Magento\Framework\View\Asset\ModuleNotation'], + ['Magento\Framework\Object', 'Magento\Framework\DataObject'], ]; diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php index 10bc4fee0ab..a3d3bdb0d9c 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php @@ -290,7 +290,7 @@ return [ ['_inlineFactory', 'Magento\Framework\App\Helper\Context', 'translateInline'], ['_inlineFactory', 'Magento\Framework\App\Helper\AbstractHelper', 'translateInline'], ['_storeManager', 'Magento\Translation\Model\Resource\Translate'], - ['_storeManager', 'Magento\Translation\Model\Resource\String'], + ['_storeManager', 'Magento\Translation\Model\Resource\StringUtils'], ['_isVdeRequest', 'Magento\DesignEditor\Helper\Data'], ['_translator', 'Magento\Framework\Phrase\Renderer\Translate', 'translator'], ['_translator', 'Magento\Core\Model\Validator\Factory'], @@ -412,8 +412,8 @@ return [ ['_emulatedLocales', 'Magento\Framework\Locale\Resolver', 'emulatedLocales'], ['_collectionAttributes', 'Magento\Eav\Model\Config'], ['_attributeFactory', '\Magento\Customer\Model\Customer'], - ['_hasDataChanges', 'Magento\Framework\Object', 'Moved to Magento\Framework\Model\AbstractModel'], - ['_origData', 'Magento\Framework\Object', 'Moved to Magento\Framework\Model\AbstractModel'], - ['_idFieldName', 'Magento\Framework\Object', 'Moved to Magento\Framework\Model\AbstractModel'], - ['_isDeleted', 'Magento\Framework\Object', 'Moved to Magento\Framework\Model\AbstractModel'], + ['_hasDataChanges', 'Magento\Framework\DataObject', 'Moved to Magento\Framework\Model\AbstractModel'], + ['_origData', 'Magento\Framework\DataObject', 'Moved to Magento\Framework\Model\AbstractModel'], + ['_idFieldName', 'Magento\Framework\DataObject', 'Moved to Magento\Framework\Model\AbstractModel'], + ['_isDeleted', 'Magento\Framework\DataObject', 'Moved to Magento\Framework\Model\AbstractModel'], ]; diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt index 160970f4107..1cf6d8c5076 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt @@ -107,7 +107,6 @@ Magento/Wishlist/Model lib/internal/Magento/Framework/Archive lib/internal/Magento/Framework/HTTP/Client lib/internal/Magento/Framework/Acl -lib/internal/phpseclib lib/internal/Magento/Framework/Convert lib/internal/Magento/Framework/App/Config Magento/Cron/Model diff --git a/dev/tools/Magento/Tools/Migration/Test/Unit/Acl/Db/Adapter/FactoryTest.php b/dev/tools/Magento/Tools/Migration/Test/Unit/Acl/Db/Adapter/FactoryTest.php index 7c28895db6a..afcb5e8c48d 100644 --- a/dev/tools/Magento/Tools/Migration/Test/Unit/Acl/Db/Adapter/FactoryTest.php +++ b/dev/tools/Magento/Tools/Migration/Test/Unit/Acl/Db/Adapter/FactoryTest.php @@ -58,7 +58,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase */ public function testGetAdapterWithInvalidType() { - $adapterType = 'Magento\Framework\Object'; + $adapterType = 'Magento\Framework\DataObject'; $adapterMock = $this->getMock($adapterType, [], [], '', false); $objectManager = $this->getMock('Magento\Framework\ObjectManagerInterface'); diff --git a/lib/internal/Magento/Framework/App/Cache/TypeList.php b/lib/internal/Magento/Framework/App/Cache/TypeList.php index 5e57ff8d979..c99fa2de10e 100644 --- a/lib/internal/Magento/Framework/App/Cache/TypeList.php +++ b/lib/internal/Magento/Framework/App/Cache/TypeList.php @@ -107,7 +107,7 @@ class TypeList implements TypeListInterface } else { $typeTags = ''; } - $types[$type] = new \Magento\Framework\Object( + $types[$type] = new \Magento\Framework\DataObject( [ 'id' => $type, 'cache_type' => $node['label'], diff --git a/lib/internal/Magento/Framework/App/Config/ScopePool.php b/lib/internal/Magento/Framework/App/Config/ScopePool.php index 1a15575b1a5..c132fa2b073 100644 --- a/lib/internal/Magento/Framework/App/Config/ScopePool.php +++ b/lib/internal/Magento/Framework/App/Config/ScopePool.php @@ -66,7 +66,7 @@ class ScopePool * Retrieve config section * * @param string $scopeType - * @param string|\Magento\Framework\Object|null $scopeCode + * @param string|\Magento\Framework\DataObject|null $scopeCode * @return \Magento\Framework\App\Config\DataInterface */ public function getScope($scopeType, $scopeCode = null) @@ -107,7 +107,7 @@ class ScopePool * Retrieve scope code value * * @param string $scopeType - * @param string|\Magento\Framework\Object|null $scopeCode + * @param string|\Magento\Framework\DataObject|null $scopeCode * @return string */ protected function _getScopeCode($scopeType, $scopeCode) diff --git a/lib/internal/Magento/Framework/App/ObjectManagerFactory.php b/lib/internal/Magento/Framework/App/ObjectManagerFactory.php index 98f338759f7..0585f359c8e 100644 --- a/lib/internal/Magento/Framework/App/ObjectManagerFactory.php +++ b/lib/internal/Magento/Framework/App/ObjectManagerFactory.php @@ -219,10 +219,10 @@ class ObjectManagerFactory $result = new \Magento\Framework\Data\Argument\Interpreter\Composite( [ 'boolean' => new \Magento\Framework\Data\Argument\Interpreter\Boolean($booleanUtils), - 'string' => new \Magento\Framework\Data\Argument\Interpreter\String($booleanUtils), + 'string' => new \Magento\Framework\Data\Argument\Interpreter\StringUtils($booleanUtils), 'number' => new \Magento\Framework\Data\Argument\Interpreter\Number(), 'null' => new \Magento\Framework\Data\Argument\Interpreter\NullType(), - 'object' => new \Magento\Framework\Data\Argument\Interpreter\Object($booleanUtils), + 'object' => new \Magento\Framework\Data\Argument\Interpreter\DataObject($booleanUtils), 'const' => $constInterpreter, 'init_parameter' => new \Magento\Framework\App\Arguments\ArgumentInterpreter($constInterpreter), ], diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/TypeListTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/TypeListTest.php index 8c2b742e8ba..424d8ac9480 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/TypeListTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/TypeListTest.php @@ -173,11 +173,11 @@ class TypeListTest extends \PHPUnit_Framework_TestCase /** * Returns prepared type * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ private function _getPreparedType() { - return new \Magento\Framework\Object( + return new \Magento\Framework\DataObject( [ 'id' => self::TYPE_KEY, 'cache_type' => $this->_typesArray[self::TYPE_KEY]['label'], diff --git a/lib/internal/Magento/Framework/App/Test/Unit/PageCache/KernelTest.php b/lib/internal/Magento/Framework/App/Test/Unit/PageCache/KernelTest.php index 6543cae509e..874f847ca90 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/PageCache/KernelTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/PageCache/KernelTest.php @@ -86,9 +86,9 @@ class KernelTest extends \PHPUnit_Framework_TestCase [$data, 'existing key', $data, true, false], [$data, 'existing key', $data, false, true], [ - new \Magento\Framework\Object($data), + new \Magento\Framework\DataObject($data), 'existing key', - new \Magento\Framework\Object($data), + new \Magento\Framework\DataObject($data), true, false ], diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ScopeResolverPoolTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ScopeResolverPoolTest.php index 91e1ebbd3fc..a2635745470 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/ScopeResolverPoolTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/ScopeResolverPoolTest.php @@ -41,7 +41,7 @@ class ScopeResolverPoolTest extends \PHPUnit_Framework_TestCase { $scopeResolver = $this->_helper->getObject('Magento\Framework\App\ScopeResolverPool', [ 'scopeResolvers' => [ - 'test' => new \Magento\Framework\Object(), + 'test' => new \Magento\Framework\DataObject(), ] ]); $scopeResolver->get($scope); diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Generator/EntityAbstractTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/Generator/EntityAbstractTest.php index 8b11e9bc25e..8ed735e0af5 100644 --- a/lib/internal/Magento/Framework/Code/Test/Unit/Generator/EntityAbstractTest.php +++ b/lib/internal/Magento/Framework/Code/Test/Unit/Generator/EntityAbstractTest.php @@ -10,9 +10,9 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase /**#@+ * Source and result class parameters */ - const SOURCE_CLASS = '\Magento\Framework\Object'; + const SOURCE_CLASS = '\Magento\Framework\DataObject'; - const RESULT_CLASS = '\Magento\Framework\Object_MyResult'; + const RESULT_CLASS = '\Magento\Framework\DataObject_MyResult'; const RESULT_FILE = 'MyResult/MyResult.php'; diff --git a/lib/internal/Magento/Framework/Controller/Noroute/Index.php b/lib/internal/Magento/Framework/Controller/Noroute/Index.php index 2d4da914cd0..34154715366 100644 --- a/lib/internal/Magento/Framework/Controller/Noroute/Index.php +++ b/lib/internal/Magento/Framework/Controller/Noroute/Index.php @@ -16,8 +16,8 @@ class Index extends \Magento\Framework\App\Action\Action public function execute() { $status = $this->getRequest()->getParam('__status__'); - if (!$status instanceof \Magento\Framework\Object) { - $status = new \Magento\Framework\Object(); + if (!$status instanceof \Magento\Framework\DataObject) { + $status = new \Magento\Framework\DataObject(); } $this->_eventManager->dispatch('controller_action_noroute', ['action' => $this, 'status' => $status]); diff --git a/lib/internal/Magento/Framework/Controller/Test/Unit/Controller/NorouteTest.php b/lib/internal/Magento/Framework/Controller/Test/Unit/Controller/NorouteTest.php index e1224c5ff7f..eabedc51f1b 100644 --- a/lib/internal/Magento/Framework/Controller/Test/Unit/Controller/NorouteTest.php +++ b/lib/internal/Magento/Framework/Controller/Test/Unit/Controller/NorouteTest.php @@ -32,7 +32,7 @@ class NorouteTest extends \PHPUnit_Framework_TestCase $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->_requestMock = $this->getMock('Magento\Framework\App\Request\Http', [], [], '', false); $this->_viewMock = $this->getMock('\Magento\Framework\App\ViewInterface'); - $this->_statusMock = $this->getMock('Magento\Framework\Object', ['getLoaded'], [], '', false); + $this->_statusMock = $this->getMock('Magento\Framework\DataObject', ['getLoaded'], [], '', false); $this->_controller = $helper->getObject( 'Magento\Framework\Controller\Noroute\Index', ['request' => $this->_requestMock, 'view' => $this->_viewMock] diff --git a/lib/internal/Magento/Framework/Convert/Object.php b/lib/internal/Magento/Framework/Convert/Object.php deleted file mode 100644 index 2503a120526..00000000000 --- a/lib/internal/Magento/Framework/Convert/Object.php +++ /dev/null @@ -1,144 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -/** - * Default converter for \Magento\Framework\Objects to arrays - * - * @author Magento Extensibility Team <DL-X-Extensibility-Team@corp.ebay.com> - */ -namespace Magento\Framework\Convert; - -class Object -{ - /** Constant used to mark cycles in the input array/objects */ - const CYCLE_DETECTED_MARK = '*** CYCLE DETECTED ***'; - - /** - * Convert input data into an array and return the resulting array. - * The resulting array should not contain any objects. - * - * @param array $data input data - * @return array Data converted to an array - */ - public function convertDataToArray($data) - { - $result = []; - foreach ($data as $key => $value) { - if (is_object($value) || is_array($value)) { - $result[$key] = $this->_convertObjectToArray($value); - } else { - $result[$key] = $value; - } - } - return $result; - } - - /** - * Converts a \Magento\Framework\Object into an array, including any children objects - * - * @param mixed $obj array or object to convert - * @param array $objects array of object hashes used for cycle detection - * @return array|string Converted object or CYCLE_DETECTED_MARK - */ - protected function _convertObjectToArray($obj, &$objects = []) - { - $data = []; - if (is_object($obj)) { - $hash = spl_object_hash($obj); - if (!empty($objects[$hash])) { - return self::CYCLE_DETECTED_MARK; - } - $objects[$hash] = true; - if ($obj instanceof \Magento\Framework\Object) { - $data = $obj->getData(); - } else { - $data = (array)$obj; - } - } elseif (is_array($obj)) { - $data = $obj; - } - - $result = []; - foreach ($data as $key => $value) { - if (is_scalar($value)) { - $result[$key] = $value; - } elseif (is_array($value)) { - $result[$key] = $this->_convertObjectToArray($value, $objects); - } elseif ($value instanceof \Magento\Framework\Object) { - $result[$key] = $this->_convertObjectToArray($value, $objects); - } - } - return $result; - } - - /** - * Converts the list of objects into an array of the form: [ [ 'label' => <id>, 'value' => <value> ], ... ]. - * - * - * The <id> and <value> values are taken from the objects in the list using the $idField and $valueField - * parameters, which can be either the name of the field to use, or a closure. - * - * @param array $items - * @param string|callable $idField - * @param string|callable $valueField - * @return array - */ - public function toOptionArray(array $items, $idField, $valueField) - { - $options = []; - foreach ($items as $item) { - $options[] = [ - 'value' => $this->_invokeGetter($item, $idField), - 'label' => $this->_invokeGetter($item, $valueField), - ]; - } - return $options; - } - - /** - * Converts the list of objects into an array of the form: [ <id> => <value>, ... ]. - * - * - * The <id> and <value> values are taken from the objects in the list using the $idField and $valueField parameters, - * which can be either the name of the field to use, or a closure. - * - * @param array $items - * @param string|callable $idField - * @param string|callable $valueField - * @return array - */ - public function toOptionHash(array $items, $idField, $valueField) - { - $options = []; - foreach ($items as $item) { - $options[$this->_invokeGetter($item, $idField)] = $this->_invokeGetter($item, $valueField); - } - return $options; - } - - /** - * Returns the value of the property represented by $field on the $item object. - * - * - * When $field is a closure, the $item parameter is passed to the $field method, otherwise the $field is assumed - * to be a property name, and the associated get method is invoked on the $item instead. - * - * @param mixed $item - * @param string|callable $field - * @return mixed - */ - protected function _invokeGetter($item, $field) - { - if (is_callable($field)) { - // if $field is a closure, use that on the item - return $field($item); - } else { - // otherwise, turn it into a call to the item's getter method - $methodName = 'get' . str_replace(' ', '', ucwords(str_replace('_', ' ', $field))); - return $item->{$methodName}(); - } - } -} diff --git a/lib/internal/Magento/Framework/Convert/Test/Unit/ObjectTest.php b/lib/internal/Magento/Framework/Convert/Test/Unit/ObjectTest.php index 85f75c30b02..25c5f0ae68b 100644 --- a/lib/internal/Magento/Framework/Convert/Test/Unit/ObjectTest.php +++ b/lib/internal/Magento/Framework/Convert/Test/Unit/ObjectTest.php @@ -5,30 +5,30 @@ */ namespace Magento\Framework\Convert\Test\Unit; -use \Magento\Framework\Convert\Object; +use \Magento\Framework\Convert\DataObject; class ObjectTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Framework\Convert\Object + * @var \Magento\Framework\Convert\DataObject */ protected $model; protected function setUp() { - $this->model = new Object(); + $this->model = new DataObject(); } public function testToOptionArray() { - $mockFirst = $this->getMock('Magento\Framework\Object', ['getId', 'getCode'], []); + $mockFirst = $this->getMock('Magento\Framework\DataObject', ['getId', 'getCode'], []); $mockFirst->expects($this->once()) ->method('getId') ->will($this->returnValue(1)); $mockFirst->expects($this->once()) ->method('getCode') ->will($this->returnValue('code1')); - $mockSecond = $this->getMock('Magento\Framework\Object', ['getId', 'getCode'], []); + $mockSecond = $this->getMock('Magento\Framework\DataObject', ['getId', 'getCode'], []); $mockSecond->expects($this->once()) ->method('getId') ->will($this->returnValue(2)); @@ -53,14 +53,14 @@ class ObjectTest extends \PHPUnit_Framework_TestCase public function testToOptionHash() { - $mockFirst = $this->getMock('Magento\Framework\Object', ['getSome', 'getId'], []); + $mockFirst = $this->getMock('Magento\Framework\DataObject', ['getSome', 'getId'], []); $mockFirst->expects($this->once()) ->method('getId') ->will($this->returnValue(3)); $mockFirst->expects($this->once()) ->method('getSome') ->will($this->returnValue('code3')); - $mockSecond = $this->getMock('Magento\Framework\Object', ['getSome', 'getId'], []); + $mockSecond = $this->getMock('Magento\Framework\DataObject', ['getSome', 'getId'], []); $mockSecond->expects($this->once()) ->method('getId') ->will($this->returnValue(4)); @@ -87,8 +87,8 @@ class ObjectTest extends \PHPUnit_Framework_TestCase { $object = new \stdClass(); $object->a = [[1]]; - $mockFirst = $this->getMock('Magento\Framework\Object', ['getData']); - $mockSecond = $this->getMock('Magento\Framework\Object', ['getData']); + $mockFirst = $this->getMock('Magento\Framework\DataObject', ['getData']); + $mockSecond = $this->getMock('Magento\Framework\DataObject', ['getData']); $mockFirst->expects($this->any()) ->method('getData') diff --git a/lib/internal/Magento/Framework/DB/AbstractMapper.php b/lib/internal/Magento/Framework/DB/AbstractMapper.php index 77c514541ce..cb38a8b07f6 100644 --- a/lib/internal/Magento/Framework/DB/AbstractMapper.php +++ b/lib/internal/Magento/Framework/DB/AbstractMapper.php @@ -10,7 +10,7 @@ use Magento\Framework\Data\Collection\Db\FetchStrategyInterface; use Magento\Framework\Data\ObjectFactory; use Magento\Framework\DB\Adapter\AdapterInterface; use Psr\Log\LoggerInterface as Logger; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Class AbstractMapper diff --git a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php index 85246e55214..ac282036050 100644 --- a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php +++ b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php @@ -22,7 +22,7 @@ use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Mview\View\Subscription; use Magento\Framework\Phrase; use Magento\Framework\Stdlib\DateTime; -use Magento\Framework\Stdlib\String; +use Magento\Framework\Stdlib\StringUtils; /** * @SuppressWarnings(PHPMD.ExcessivePublicCount) @@ -184,14 +184,14 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface private $logger; /** - * @param \Magento\Framework\Stdlib\String|String $string + * @param \Magento\Framework\Stdlib\StringUtils|String $string * @param DateTime $dateTime * @param LoggerInterface $logger * @param array $config * @throws \Zend_Db_Adapter_Exception */ public function __construct( - String $string, + StringUtils $string, DateTime $dateTime, LoggerInterface $logger, array $config = [] diff --git a/lib/internal/Magento/Framework/DB/Logger/Null.php b/lib/internal/Magento/Framework/DB/Logger/Null.php deleted file mode 100644 index 3fe41f00459..00000000000 --- a/lib/internal/Magento/Framework/DB/Logger/Null.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\DB\Logger; - -class Null implements \Magento\Framework\DB\LoggerInterface -{ - /** - * {@inheritdoc} - */ - public function log($str) - { - } - - /** - * {@inheritdoc} - */ - public function logStats($type, $sql, $bind = [], $result = null) - { - } - - /** - * {@inheritdoc} - */ - public function critical(\Exception $e) - { - } - - /** - * {@inheritdoc} - */ - public function startTimer() - { - } -} diff --git a/lib/internal/Magento/Framework/DB/Statement/Parameter.php b/lib/internal/Magento/Framework/DB/Statement/Parameter.php index f7f887ff59f..198bdabc395 100644 --- a/lib/internal/Magento/Framework/DB/Statement/Parameter.php +++ b/lib/internal/Magento/Framework/DB/Statement/Parameter.php @@ -11,7 +11,7 @@ namespace Magento\Framework\DB\Statement; * Used to transmit specific information about parameter value binding to be bound the right * way to the query. * Most used properties and methods are defined in interface. Specific things for concrete DB adapter can be - * transmitted using 'addtional' property (\Magento\Framework\Object) as a container. + * transmitted using 'addtional' property (\Magento\Framework\DataObject) as a container. * * @author Magento Core Team <core@magentocommerce.com> */ @@ -54,7 +54,7 @@ class Parameter /* * Additional information to be used by DB adapter internally - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $_additional = null; @@ -66,7 +66,7 @@ class Parameter public function __construct($value) { $this->_value = $value; - $this->_additional = new \Magento\Framework\Object(); + $this->_additional = new \Magento\Framework\DataObject(); return $this; } @@ -192,7 +192,7 @@ class Parameter * Sets additional information for concrete DB adapter. * Set there any data you want to pass along with query parameter. * - * @param \Magento\Framework\Object $additional + * @param \Magento\Framework\DataObject $additional * @return $this */ public function setAdditional($additional) @@ -204,7 +204,7 @@ class Parameter /** * Gets additional information for concrete DB adapter. * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getAdditional() { diff --git a/lib/internal/Magento/Framework/DB/Test/Unit/Adapter/Pdo/MysqlTest.php b/lib/internal/Magento/Framework/DB/Test/Unit/Adapter/Pdo/MysqlTest.php index 4d7bfa42ed2..2125f45e0c9 100644 --- a/lib/internal/Magento/Framework/DB/Test/Unit/Adapter/Pdo/MysqlTest.php +++ b/lib/internal/Magento/Framework/DB/Test/Unit/Adapter/Pdo/MysqlTest.php @@ -39,7 +39,7 @@ class MysqlTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - $string = $this->getMock('Magento\Framework\Stdlib\String'); + $string = $this->getMock('Magento\Framework\Stdlib\StringUtils'); $dateTime = $this->getMock('Magento\Framework\Stdlib\DateTime'); $logger = $this->getMockForAbstractClass('Magento\Framework\DB\LoggerInterface'); $this->_mockAdapter = $this->getMock( diff --git a/lib/internal/Magento/Framework/DB/Test/Unit/Logger/FileTest.php b/lib/internal/Magento/Framework/DB/Test/Unit/Logger/FileTest.php index 53037b0eb71..5a26a456261 100644 --- a/lib/internal/Magento/Framework/DB/Test/Unit/Logger/FileTest.php +++ b/lib/internal/Magento/Framework/DB/Test/Unit/Logger/FileTest.php @@ -134,7 +134,7 @@ class FileTest extends \PHPUnit_Framework_TestCase public function testcritical() { $exception = new \Exception('error message'); - $expected = "%aEXCEPTION%a'Exception'%a'error message'%a"; + $expected = "%aEXCEPTION%aException%aerror message%a"; $this->stream->expects($this->once()) ->method('write') diff --git a/lib/internal/Magento/Framework/Data/AbstractCriteria.php b/lib/internal/Magento/Framework/Data/AbstractCriteria.php index ced168d20ef..85787388b51 100644 --- a/lib/internal/Magento/Framework/Data/AbstractCriteria.php +++ b/lib/internal/Magento/Framework/Data/AbstractCriteria.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\Data; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Class AbstractCriteria @@ -123,7 +123,7 @@ abstract class AbstractCriteria implements \Magento\Framework\Api\CriteriaInterf ) ); } - $filter = new Object(); + $filter = new DataObject(); // implements ArrayAccess $filter['name'] = $name; $filter['field'] = $field; diff --git a/lib/internal/Magento/Framework/Data/AbstractSearchResult.php b/lib/internal/Magento/Framework/Data/AbstractSearchResult.php index 44ad1ce1835..dacd4253d32 100644 --- a/lib/internal/Magento/Framework/Data/AbstractSearchResult.php +++ b/lib/internal/Magento/Framework/Data/AbstractSearchResult.php @@ -16,7 +16,7 @@ abstract class AbstractSearchResult extends AbstractDataObject implements Search * * @var string */ - protected $dataInterface = 'Magento\Framework\Object'; + protected $dataInterface = 'Magento\Framework\DataObject'; /** * Name prefix of events that are dispatched by model @@ -95,7 +95,7 @@ abstract class AbstractSearchResult extends AbstractDataObject implements Search abstract protected function init(); /** - * @return \Magento\Framework\Object[] + * @return \Magento\Framework\DataObject[] */ public function getItems() { @@ -104,7 +104,7 @@ abstract class AbstractSearchResult extends AbstractDataObject implements Search } /** - * @param \Magento\Framework\Object[] $items + * @param \Magento\Framework\DataObject[] $items * @return $this */ public function setItems(array $items = null) @@ -170,7 +170,7 @@ abstract class AbstractSearchResult extends AbstractDataObject implements Search /** * @param array $arguments - * @return \Magento\Framework\Object|mixed + * @return \Magento\Framework\DataObject|mixed */ public function createDataObject(array $arguments = []) { @@ -196,10 +196,10 @@ abstract class AbstractSearchResult extends AbstractDataObject implements Search /** * Get collection item identifier * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return mixed */ - public function getItemId(\Magento\Framework\Object $item) + public function getItemId(\Magento\Framework\DataObject $item) { $field = $this->query->getIdFieldName(); if ($field) { @@ -252,11 +252,11 @@ abstract class AbstractSearchResult extends AbstractDataObject implements Search /** * Adding item to item array * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return void * @throws \Exception */ - protected function addItem(\Magento\Framework\Object $item) + protected function addItem(\Magento\Framework\DataObject $item) { $itemId = $this->getItemId($item); if ($itemId !== null) { diff --git a/lib/internal/Magento/Framework/Data/Argument/Interpreter/Object.php b/lib/internal/Magento/Framework/Data/Argument/Interpreter/Object.php deleted file mode 100644 index a120debf0b1..00000000000 --- a/lib/internal/Magento/Framework/Data/Argument/Interpreter/Object.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php -/** - * - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Data\Argument\Interpreter; - -use Magento\Framework\Data\Argument\InterpreterInterface; -use Magento\Framework\Stdlib\BooleanUtils; - -class Object implements InterpreterInterface -{ - /** - * @var \Magento\Framework\Stdlib\BooleanUtils - */ - protected $booleanUtils; - - /** - * @param BooleanUtils $booleanUtils - */ - public function __construct(BooleanUtils $booleanUtils) - { - $this->booleanUtils = $booleanUtils; - } - - /** - * Compute and return effective value of an argument - * - * @param array $data - * @return mixed - * @throws \InvalidArgumentException - * @throws \UnexpectedValueException - */ - public function evaluate(array $data) - { - $result = ['instance' => $data['value']]; - if (isset($data['shared'])) { - $result['shared'] = $this->booleanUtils->toBoolean($data['shared']); - } - return $result; - } -} diff --git a/lib/internal/Magento/Framework/Data/Argument/Interpreter/String.php b/lib/internal/Magento/Framework/Data/Argument/Interpreter/String.php deleted file mode 100644 index e2d1b574e86..00000000000 --- a/lib/internal/Magento/Framework/Data/Argument/Interpreter/String.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Data\Argument\Interpreter; - -use Magento\Framework\Data\Argument\InterpreterInterface; -use Magento\Framework\Stdlib\BooleanUtils; - -/** - * Interpreter of string data type that may optionally perform text translation - */ -class String implements InterpreterInterface -{ - /** - * @var BooleanUtils - */ - private $booleanUtils; - - /** - * @param BooleanUtils $booleanUtils - */ - public function __construct(BooleanUtils $booleanUtils) - { - $this->booleanUtils = $booleanUtils; - } - - /** - * {@inheritdoc} - * @return string - * @throws \InvalidArgumentException - */ - public function evaluate(array $data) - { - if (isset($data['value'])) { - $result = $data['value']; - if (!is_string($result)) { - throw new \InvalidArgumentException('String value is expected.'); - } - $needTranslation = isset($data['translate']) ? $this->booleanUtils->toBoolean($data['translate']) : false; - if ($needTranslation) { - $result = (string)new \Magento\Framework\Phrase($result); - } - } else { - $result = ''; - } - return $result; - } -} diff --git a/lib/internal/Magento/Framework/Data/Collection.php b/lib/internal/Magento/Framework/Data/Collection.php index 91a3dfd10c9..e85f53dcd4e 100644 --- a/lib/internal/Magento/Framework/Data/Collection.php +++ b/lib/internal/Magento/Framework/Data/Collection.php @@ -26,7 +26,7 @@ class Collection implements \IteratorAggregate, \Countable, ArrayInterface, Coll /** * Collection items * - * @var \Magento\Framework\Object[] + * @var \Magento\Framework\DataObject[] */ protected $_items = []; @@ -35,7 +35,7 @@ class Collection implements \IteratorAggregate, \Countable, ArrayInterface, Coll * * @var string */ - protected $_itemObjectClass = 'Magento\Framework\Object'; + protected $_itemObjectClass = 'Magento\Framework\DataObject'; /** * Order configuration @@ -47,7 +47,7 @@ class Collection implements \IteratorAggregate, \Countable, ArrayInterface, Coll /** * Filters configuration * - * @var \Magento\Framework\Object[] + * @var \Magento\Framework\DataObject[] */ protected $_filters = []; @@ -118,7 +118,7 @@ class Collection implements \IteratorAggregate, \Countable, ArrayInterface, Coll */ public function addFilter($field, $value, $type = 'and') { - $filter = new \Magento\Framework\Object(); + $filter = new \Magento\Framework\DataObject(); // implements ArrayAccess $filter['field'] = $field; $filter['value'] = $value; @@ -183,7 +183,7 @@ class Collection implements \IteratorAggregate, \Countable, ArrayInterface, Coll * - array() -- get all filters * * @param string|string[] $field - * @return \Magento\Framework\Object|\Magento\Framework\Object[]|void + * @return \Magento\Framework\DataObject|\Magento\Framework\DataObject[]|void */ public function getFilter($field) { @@ -293,7 +293,7 @@ class Collection implements \IteratorAggregate, \Countable, ArrayInterface, Coll /** * Retrieve collection first item * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getFirstItem() { @@ -310,7 +310,7 @@ class Collection implements \IteratorAggregate, \Countable, ArrayInterface, Coll /** * Retrieve collection last item * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getLastItem() { @@ -326,7 +326,7 @@ class Collection implements \IteratorAggregate, \Countable, ArrayInterface, Coll /** * Retrieve collection items * - * @return \Magento\Framework\Object[] + * @return \Magento\Framework\DataObject[] */ public function getItems() { @@ -376,7 +376,7 @@ class Collection implements \IteratorAggregate, \Countable, ArrayInterface, Coll * * @param string $column * @param mixed $value - * @return \Magento\Framework\Object || null + * @return \Magento\Framework\DataObject || null */ public function getItemByColumnValue($column, $value) { @@ -393,11 +393,11 @@ class Collection implements \IteratorAggregate, \Countable, ArrayInterface, Coll /** * Adding item to item array * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return $this * @throws \Exception */ - public function addItem(\Magento\Framework\Object $item) + public function addItem(\Magento\Framework\DataObject $item) { $itemId = $this->_getItemId($item); @@ -417,7 +417,7 @@ class Collection implements \IteratorAggregate, \Countable, ArrayInterface, Coll /** * Add item that has no id to collection * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return $this */ protected function _addItem($item) @@ -429,10 +429,10 @@ class Collection implements \IteratorAggregate, \Countable, ArrayInterface, Coll /** * Retrieve item id * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return mixed */ - protected function _getItemId(\Magento\Framework\Object $item) + protected function _getItemId(\Magento\Framework\DataObject $item) { return $item->getId(); } @@ -593,8 +593,8 @@ class Collection implements \IteratorAggregate, \Countable, ArrayInterface, Coll */ public function setItemObjectClass($className) { - if (!is_a($className, 'Magento\Framework\Object', true)) { - throw new \InvalidArgumentException($className . ' does not extend \Magento\Framework\Object'); + if (!is_a($className, 'Magento\Framework\DataObject', true)) { + throw new \InvalidArgumentException($className . ' does not extend \Magento\Framework\DataObject'); } $this->_itemObjectClass = $className; return $this; @@ -603,7 +603,7 @@ class Collection implements \IteratorAggregate, \Countable, ArrayInterface, Coll /** * Retrieve collection empty item * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getNewEmptyItem() { @@ -799,7 +799,7 @@ class Collection implements \IteratorAggregate, \Countable, ArrayInterface, Coll * Retrieve item by id * * @param mixed $idValue - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getItemById($idValue) { diff --git a/lib/internal/Magento/Framework/Data/Collection/AbstractDb.php b/lib/internal/Magento/Framework/Data/Collection/AbstractDb.php index 737a51721f8..bc83c1c3855 100644 --- a/lib/internal/Magento/Framework/Data/Collection/AbstractDb.php +++ b/lib/internal/Magento/Framework/Data/Collection/AbstractDb.php @@ -159,10 +159,10 @@ abstract class AbstractDb extends \Magento\Framework\Data\Collection /** * Get collection item identifier * - * @param \Magento\Framework\Object $item + * @param \Magento\Framework\DataObject $item * @return mixed */ - protected function _getItemId(\Magento\Framework\Object $item) + protected function _getItemId(\Magento\Framework\DataObject $item) { if ($field = $this->getIdFieldName()) { return $item->getData($field); @@ -589,10 +589,10 @@ abstract class AbstractDb extends \Magento\Framework\Data\Collection /** * Let do something before add loaded item in collection * - * @param \Magento\Framework\Object $item - * @return \Magento\Framework\Object + * @param \Magento\Framework\DataObject $item + * @return \Magento\Framework\DataObject */ - protected function beforeAddLoadedItem(\Magento\Framework\Object $item) + protected function beforeAddLoadedItem(\Magento\Framework\DataObject $item) { return $item; } diff --git a/lib/internal/Magento/Framework/Data/Collection/EntityFactory.php b/lib/internal/Magento/Framework/Data/Collection/EntityFactory.php index 6ab0ab7e5d2..98014a2d374 100644 --- a/lib/internal/Magento/Framework/Data/Collection/EntityFactory.php +++ b/lib/internal/Magento/Framework/Data/Collection/EntityFactory.php @@ -30,7 +30,7 @@ class EntityFactory implements EntityFactoryInterface * @param string $className * @param array $data * @throws \LogicException - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function create($className, array $data = []) { diff --git a/lib/internal/Magento/Framework/Data/Collection/Filesystem.php b/lib/internal/Magento/Framework/Data/Collection/Filesystem.php index 30d07a7e2bb..df7c28e5c2b 100644 --- a/lib/internal/Magento/Framework/Data/Collection/Filesystem.php +++ b/lib/internal/Magento/Framework/Data/Collection/Filesystem.php @@ -11,7 +11,7 @@ use Magento\Framework\Data\Collection; * Filesystem items collection * * Can scan a folder for files and/or folders recursively. - * Creates \Magento\Framework\Object instance for each item, with its filename and base name + * Creates \Magento\Framework\DataObject instance for each item, with its filename and base name * * Supports regexp masks that are applied to files and folders base names. * These masks apply before adding items to collection, during filesystem scanning diff --git a/lib/internal/Magento/Framework/Data/DataArray.php b/lib/internal/Magento/Framework/Data/DataArray.php index 468a0d30848..defdc0256c4 100644 --- a/lib/internal/Magento/Framework/Data/DataArray.php +++ b/lib/internal/Magento/Framework/Data/DataArray.php @@ -5,6 +5,6 @@ */ namespace Magento\Framework\Data; -class DataArray extends \Magento\Framework\Object +class DataArray extends \Magento\Framework\DataObject { } diff --git a/lib/internal/Magento/Framework/Data/Form/AbstractForm.php b/lib/internal/Magento/Framework/Data/Form/AbstractForm.php index b60e4fcb622..10103b4175f 100644 --- a/lib/internal/Magento/Framework/Data/Form/AbstractForm.php +++ b/lib/internal/Magento/Framework/Data/Form/AbstractForm.php @@ -17,7 +17,7 @@ use Magento\Framework\Data\Form\Element\Fieldset; * * @author Magento Core Team <core@magentocommerce.com> */ -class AbstractForm extends \Magento\Framework\Object +class AbstractForm extends \Magento\Framework\DataObject { /** * Form level elements collection diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Editor.php b/lib/internal/Magento/Framework/Data/Form/Element/Editor.php index d48d194fade..730f5c2810f 100644 --- a/lib/internal/Magento/Framework/Data/Form/Element/Editor.php +++ b/lib/internal/Magento/Framework/Data/Form/Element/Editor.php @@ -407,8 +407,8 @@ class Editor extends Textarea */ public function getConfig($key = null) { - if (!$this->_getData('config') instanceof \Magento\Framework\Object) { - $config = new \Magento\Framework\Object(); + if (!$this->_getData('config') instanceof \Magento\Framework\DataObject) { + $config = new \Magento\Framework\DataObject(); $this->setConfig($config); } if ($key !== null) { diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Radios.php b/lib/internal/Magento/Framework/Data/Form/Element/Radios.php index 3d56d8042cb..2fde6e9fd91 100644 --- a/lib/internal/Magento/Framework/Data/Form/Element/Radios.php +++ b/lib/internal/Magento/Framework/Data/Form/Element/Radios.php @@ -81,7 +81,7 @@ class Radios extends AbstractElement '">' . $option['label'] . '</label>'; - } elseif ($option instanceof \Magento\Framework\Object) { + } elseif ($option instanceof \Magento\Framework\DataObject) { $html .= 'id="' . $this->getHtmlId() . $option->getValue() . '"' . $option->serialize( ['label', 'title', 'value', 'class', 'style'] ); diff --git a/lib/internal/Magento/Framework/Data/ObjectFactory.php b/lib/internal/Magento/Framework/Data/ObjectFactory.php index 0cbf3f9003a..99cbbe34945 100644 --- a/lib/internal/Magento/Framework/Data/ObjectFactory.php +++ b/lib/internal/Magento/Framework/Data/ObjectFactory.php @@ -30,7 +30,7 @@ class ObjectFactory * * @param string $className * @param array $arguments - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function create($className, array $arguments) { diff --git a/lib/internal/Magento/Framework/Data/Schema.php b/lib/internal/Magento/Framework/Data/Schema.php index f5a616865f9..62f19106358 100644 --- a/lib/internal/Magento/Framework/Data/Schema.php +++ b/lib/internal/Magento/Framework/Data/Schema.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\Data; -class Schema extends \Magento\Framework\Object +class Schema extends \Magento\Framework\DataObject { /** * @param mixed $schema diff --git a/lib/internal/Magento/Framework/Data/SearchResultInterface.php b/lib/internal/Magento/Framework/Data/SearchResultInterface.php index 2a1a694e191..08fb23262dd 100644 --- a/lib/internal/Magento/Framework/Data/SearchResultInterface.php +++ b/lib/internal/Magento/Framework/Data/SearchResultInterface.php @@ -13,7 +13,7 @@ interface SearchResultInterface /** * Retrieve collection items * - * @return \Magento\Framework\Object[] + * @return \Magento\Framework\DataObject[] */ public function getItems(); diff --git a/lib/internal/Magento/Framework/Data/SearchResultProcessor.php b/lib/internal/Magento/Framework/Data/SearchResultProcessor.php index f14deb03721..e42601f0dc2 100644 --- a/lib/internal/Magento/Framework/Data/SearchResultProcessor.php +++ b/lib/internal/Magento/Framework/Data/SearchResultProcessor.php @@ -15,7 +15,7 @@ class SearchResultProcessor extends AbstractDataObject implements SearchResultPr * * @var string */ - protected $dataInterface = 'Magento\Framework\Object'; + protected $dataInterface = 'Magento\Framework\DataObject'; /** * @var AbstractSearchResult @@ -47,7 +47,7 @@ class SearchResultProcessor extends AbstractDataObject implements SearchResultPr } /** - * @return \Magento\Framework\Object|mixed + * @return \Magento\Framework\DataObject|mixed */ public function getFirstItem() { @@ -55,7 +55,7 @@ class SearchResultProcessor extends AbstractDataObject implements SearchResultPr } /** - * @return \Magento\Framework\Object|mixed + * @return \Magento\Framework\DataObject|mixed */ public function getLastItem() { @@ -77,7 +77,7 @@ class SearchResultProcessor extends AbstractDataObject implements SearchResultPr /** * @param int $id - * @return \Magento\Framework\Object|null + * @return \Magento\Framework\DataObject|null */ public function getItemById($id) { @@ -120,7 +120,7 @@ class SearchResultProcessor extends AbstractDataObject implements SearchResultPr /** * @param string $column * @param mixed $value - * @return \Magento\Framework\Object|null + * @return \Magento\Framework\DataObject|null */ public function getItemByColumnValue($column, $value) { diff --git a/lib/internal/Magento/Framework/Data/SearchResultProcessorInterface.php b/lib/internal/Magento/Framework/Data/SearchResultProcessorInterface.php index d7531b3c71b..7b1739686d5 100644 --- a/lib/internal/Magento/Framework/Data/SearchResultProcessorInterface.php +++ b/lib/internal/Magento/Framework/Data/SearchResultProcessorInterface.php @@ -34,14 +34,14 @@ interface SearchResultProcessorInterface /** * Retrieve collection first item * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getFirstItem(); /** * Retrieve collection last item * - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getLastItem(); @@ -67,7 +67,7 @@ interface SearchResultProcessorInterface * * @param string $column * @param mixed $value - * @return \Magento\Framework\Object || null + * @return \Magento\Framework\DataObject || null */ public function getItemByColumnValue($column, $value); @@ -75,7 +75,7 @@ interface SearchResultProcessorInterface * Retrieve item by id * * @param mixed $idValue - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function getItemById($idValue); diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/AbstractCriteriaTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/AbstractCriteriaTest.php index 21d555dfe9c..4c0500a64be 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/AbstractCriteriaTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/AbstractCriteriaTest.php @@ -376,7 +376,7 @@ class AbstractCriteriaTest extends \PHPUnit_Framework_TestCase 'type' => 'test-type', 'result' => [ 'test-filter-name' => $objectManager->getObject( - 'Magento\Framework\Object', + 'Magento\Framework\DataObject', [ 'data' => [ 'name' => 'test-filter-name', diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/AbstractSearchResultTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/AbstractSearchResultTest.php index b98480ef4b6..f0688fff681 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/AbstractSearchResultTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/AbstractSearchResultTest.php @@ -75,14 +75,14 @@ class AbstractSearchResultTest extends \PHPUnit_Framework_TestCase { $itemData = ['id' => 1]; - $testItem = new \Magento\Framework\Object($itemData); + $testItem = new \Magento\Framework\DataObject($itemData); $this->query->expects($this->once()) ->method('fetchAll') ->willReturn([$itemData]); $this->entityFactory->expects($this->once()) ->method('create') - ->with('Magento\Framework\Object', ['data' => $itemData]) + ->with('Magento\Framework\DataObject', ['data' => $itemData]) ->willReturn($testItem); $items = $this->searchResult->getItems(); diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Collection/DbTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Collection/DbTest.php index f10c0c0d842..8c8ebacfe1a 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Collection/DbTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Collection/DbTest.php @@ -360,13 +360,13 @@ class DbTest extends \PHPUnit_Framework_TestCase $this->collection->setConnection($adapterMock); $this->assertFalse($this->collection->fetchItem()); - $objectMock = $this->getMock('Magento\Framework\Object', ['setData'], []); + $objectMock = $this->getMock('Magento\Framework\DataObject', ['setData'], []); $objectMock->expects($this->once()) ->method('setData') ->with($data); $this->entityFactoryMock->expects($this->once()) ->method('create') - ->with('Magento\Framework\Object') + ->with('Magento\Framework\DataObject') ->will($this->returnValue($objectMock)); $this->assertEquals($objectMock, $this->collection->fetchItem()); @@ -537,7 +537,7 @@ class DbTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue([$data])); $objectMock = $this->getMock( - 'Magento\Framework\Object', + 'Magento\Framework\DataObject', ['addData', 'setIdFieldName', 'getData'], [] ); @@ -552,7 +552,7 @@ class DbTest extends \PHPUnit_Framework_TestCase ])); $this->entityFactoryMock->expects($this->once()) ->method('create') - ->with('Magento\Framework\Object') + ->with('Magento\Framework\DataObject') ->will($this->returnValue($objectMock)); $this->collection->setConnection($adapterMock); diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/CollectionTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/CollectionTest.php index db79898c29e..ff9abfd16ba 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/CollectionTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/CollectionTest.php @@ -21,8 +21,8 @@ class CollectionTest extends \PHPUnit_Framework_TestCase public function testRemoveAllItems() { - $this->_model->addItem(new \Magento\Framework\Object()); - $this->_model->addItem(new \Magento\Framework\Object()); + $this->_model->addItem(new \Magento\Framework\DataObject()); + $this->_model->addItem(new \Magento\Framework\DataObject()); $this->assertCount(2, $this->_model->getItems()); $this->_model->removeAllItems(); $this->assertEmpty($this->_model->getItems()); @@ -36,8 +36,8 @@ class CollectionTest extends \PHPUnit_Framework_TestCase { $this->assertInstanceOf('Magento\Framework\Data\Collection', $this->_model->loadWithFilter()); $this->assertEmpty($this->_model->getItems()); - $this->_model->addItem(new \Magento\Framework\Object()); - $this->_model->addItem(new \Magento\Framework\Object()); + $this->_model->addItem(new \Magento\Framework\DataObject()); + $this->_model->addItem(new \Magento\Framework\DataObject()); $this->assertCount(2, $this->_model->loadWithFilter()->getItems()); } @@ -55,12 +55,12 @@ class CollectionTest extends \PHPUnit_Framework_TestCase */ public function setItemObjectClassDataProvider() { - return [['Magento\Framework\Url'], ['Magento\Framework\Object']]; + return [['Magento\Framework\Url'], ['Magento\Framework\DataObject']]; } /** * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Incorrect_ClassName does not extend \Magento\Framework\Object + * @expectedExceptionMessage Incorrect_ClassName does not extend \Magento\Framework\DataObject */ public function testSetItemObjectClassException() { @@ -103,8 +103,14 @@ class CollectionTest extends \PHPUnit_Framework_TestCase public function testPossibleFlowWithItem() { - $firstItemMock = $this->getMock('Magento\Framework\Object', ['getId', 'getData', 'toArray'], [], '', false); - $secondItemMock = $this->getMock('Magento\Framework\Object', ['getId', 'getData', 'toArray'], [], '', false); + $firstItemMock = $this->getMock('Magento\Framework\DataObject', ['getId', 'getData', 'toArray'], [], '', false); + $secondItemMock = $this->getMock( + 'Magento\Framework\DataObject', + ['getId', 'getData', 'toArray'], + [], + '', + false + ); $requiredFields = ['required_field_one', 'required_field_two']; $arrItems = [ 'totalRecords' => 1, diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php index 736c72b7826..0bd45313695 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php @@ -260,7 +260,7 @@ class AbstractElementTest extends \PHPUnit_Framework_TestCase $value = '<a href="#hash_tag">my \'quoted\' string</a>'; $expectedValue = '<a href="#hash_tag">my \'quoted\' string</a>'; - $filterMock = $this->getMock('Magento\Framework\Object', ['filter'], [], '', false); + $filterMock = $this->getMock('Magento\Framework\DataObject', ['filter'], [], '', false); $filterMock->expects($this->once()) ->method('filter') ->with($value) diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ButtonTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ButtonTest.php index bcb5135b047..8ad614c507d 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ButtonTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ButtonTest.php @@ -37,7 +37,7 @@ class ButtonTest extends \PHPUnit_Framework_TestCase $collectionFactoryMock, $escaperMock ); - $formMock = new \Magento\Framework\Object(); + $formMock = new \Magento\Framework\DataObject(); $formMock->getHtmlIdPrefix('id_prefix'); $formMock->getHtmlIdPrefix('id_suffix'); $this->_model->setForm($formMock); diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/CheckboxTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/CheckboxTest.php index 5f0fd55c035..62679513e71 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/CheckboxTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/CheckboxTest.php @@ -37,7 +37,7 @@ class CheckboxTest extends \PHPUnit_Framework_TestCase $collectionFactoryMock, $escaperMock ); - $formMock = new \Magento\Framework\Object(); + $formMock = new \Magento\Framework\DataObject(); $formMock->getHtmlIdPrefix('id_prefix'); $formMock->getHtmlIdPrefix('id_suffix'); $this->_model->setForm($formMock); diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ColumnTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ColumnTest.php index e559055322c..72b0659e85a 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ColumnTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ColumnTest.php @@ -37,7 +37,7 @@ class ColumnTest extends \PHPUnit_Framework_TestCase $collectionFactoryMock, $escaperMock ); - $formMock = new \Magento\Framework\Object(); + $formMock = new \Magento\Framework\DataObject(); $formMock->getHtmlIdPrefix('id_prefix'); $formMock->getHtmlIdPrefix('id_suffix'); $this->_model->setForm($formMock); diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/EditablemultiselectTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/EditablemultiselectTest.php index a4bafc94422..8c17f6569c3 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/EditablemultiselectTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/EditablemultiselectTest.php @@ -22,7 +22,7 @@ class EditablemultiselectTest extends \PHPUnit_Framework_TestCase ['value' => 3, 'label' => 'Value3'], ]; $value = [1, 3]; - $this->_model->setForm(new \Magento\Framework\Object()); + $this->_model->setForm(new \Magento\Framework\DataObject()); $this->_model->setData(['values' => $values, 'value' => $value]); } diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/EditorTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/EditorTest.php index b88de63daef..95c8c65d6d7 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/EditorTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/EditorTest.php @@ -34,12 +34,12 @@ class EditorTest extends \PHPUnit_Framework_TestCase protected $escaperMock; /** - * @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject */ protected $formMock; /** - * @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject */ protected $configMock; @@ -60,7 +60,7 @@ class EditorTest extends \PHPUnit_Framework_TestCase false ); $this->escaperMock = $this->getMock('\Magento\Framework\Escaper', [], [], '', false); - $this->configMock = $this->getMock('\Magento\Framework\Object', ['getData'], [], '', false); + $this->configMock = $this->getMock('\Magento\Framework\DataObject', ['getData'], [], '', false); $this->model = $this->objectManager->getObject( 'Magento\Framework\Data\Form\Element\Editor', @@ -165,7 +165,7 @@ class EditorTest extends \PHPUnit_Framework_TestCase public function testGetConfig() { - $config = $this->getMock('\Magento\Framework\Object', ['getData'], [], '', false); + $config = $this->getMock('\Magento\Framework\DataObject', ['getData'], [], '', false); $this->assertEquals($config, $this->model->getConfig()); $this->configMock->expects($this->once())->method('getData')->with('test')->willReturn('test'); diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/FileTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/FileTest.php index 19165e58bff..fac421f5f3d 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/FileTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/FileTest.php @@ -37,7 +37,7 @@ class FileTest extends \PHPUnit_Framework_TestCase $collectionFactoryMock, $escaperMock ); - $formMock = new \Magento\Framework\Object(); + $formMock = new \Magento\Framework\DataObject(); $formMock->getHtmlIdPrefix('id_prefix'); $formMock->getHtmlIdPrefix('id_suffix'); $this->_model->setForm($formMock); diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/HiddenTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/HiddenTest.php index 3b821161069..517fd66fde0 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/HiddenTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/HiddenTest.php @@ -37,7 +37,7 @@ class HiddenTest extends \PHPUnit_Framework_TestCase $collectionFactoryMock, $escaperMock ); - $formMock = new \Magento\Framework\Object(); + $formMock = new \Magento\Framework\DataObject(); $formMock->getHtmlIdPrefix('id_prefix'); $formMock->getHtmlIdPrefix('id_suffix'); $this->_model->setForm($formMock); diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ImageTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ImageTest.php index db253018181..a72c544acdf 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ImageTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ImageTest.php @@ -46,7 +46,7 @@ class ImageTest extends \PHPUnit_Framework_TestCase $escaperMock, $this->urlBuilder ); - $formMock = new \Magento\Framework\Object(); + $formMock = new \Magento\Framework\DataObject(); $formMock->getHtmlIdPrefix('id_prefix'); $formMock->getHtmlIdPrefix('id_suffix'); $this->_image->setForm($formMock); diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/LinkTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/LinkTest.php index b1146e86bde..75274460957 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/LinkTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/LinkTest.php @@ -37,7 +37,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase $collectionFactoryMock, $escaperMock ); - $formMock = new \Magento\Framework\Object(); + $formMock = new \Magento\Framework\DataObject(); $formMock->getHtmlIdPrefix('id_prefix'); $formMock->getHtmlIdPrefix('id_suffix'); $this->_link->setForm($formMock); diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/MultiselectTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/MultiselectTest.php index e24ab55c5f1..21dc39d711a 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/MultiselectTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/MultiselectTest.php @@ -16,7 +16,7 @@ class MultiselectTest extends \PHPUnit_Framework_TestCase { $testHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->_model = $testHelper->getObject('Magento\Framework\Data\Form\Element\Editablemultiselect'); - $this->_model->setForm(new \Magento\Framework\Object()); + $this->_model->setForm(new \Magento\Framework\DataObject()); } /** diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/NoteTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/NoteTest.php index 8fcf5673702..23e07bf7fb2 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/NoteTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/NoteTest.php @@ -37,7 +37,7 @@ class NoteTest extends \PHPUnit_Framework_TestCase $collectionFactoryMock, $escaperMock ); - $formMock = new \Magento\Framework\Object(); + $formMock = new \Magento\Framework\DataObject(); $formMock->getHtmlIdPrefix('id_prefix'); $formMock->getHtmlIdPrefix('id_suffix'); $this->_model->setForm($formMock); diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ObscureTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ObscureTest.php index 640aebb71a4..d3943a57abf 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ObscureTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ObscureTest.php @@ -37,7 +37,7 @@ class ObscureTest extends \PHPUnit_Framework_TestCase $collectionFactoryMock, $escaperMock ); - $formMock = new \Magento\Framework\Object(); + $formMock = new \Magento\Framework\DataObject(); $formMock->getHtmlIdPrefix('id_prefix'); $formMock->getHtmlIdPrefix('id_suffix'); $this->_model->setForm($formMock); diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/PasswordTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/PasswordTest.php index 0fd77983e52..fdd68543eb1 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/PasswordTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/PasswordTest.php @@ -37,7 +37,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase $collectionFactoryMock, $escaperMock ); - $formMock = new \Magento\Framework\Object(); + $formMock = new \Magento\Framework\DataObject(); $formMock->getHtmlIdPrefix('id_prefix'); $formMock->getHtmlIdPrefix('id_suffix'); $this->_model->setForm($formMock); diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/RadioTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/RadioTest.php index b8340600e63..8ed66d8c8f1 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/RadioTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/RadioTest.php @@ -37,7 +37,7 @@ class RadioTest extends \PHPUnit_Framework_TestCase $collectionFactoryMock, $escaperMock ); - $formMock = new \Magento\Framework\Object(); + $formMock = new \Magento\Framework\DataObject(); $formMock->getHtmlIdPrefix('id_prefix'); $formMock->getHtmlIdPrefix('id_suffix'); $this->_model->setForm($formMock); diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ResetTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ResetTest.php index 427b0391a8d..a27f1834303 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ResetTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ResetTest.php @@ -37,7 +37,7 @@ class ResetTest extends \PHPUnit_Framework_TestCase $collectionFactoryMock, $escaperMock ); - $formMock = new \Magento\Framework\Object(); + $formMock = new \Magento\Framework\DataObject(); $formMock->getHtmlIdPrefix('id_prefix'); $formMock->getHtmlIdPrefix('id_suffix'); $this->_model->setForm($formMock); diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/SubmitTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/SubmitTest.php index 7d93c9009de..4998ac9f9c9 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/SubmitTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/SubmitTest.php @@ -37,7 +37,7 @@ class SubmitTest extends \PHPUnit_Framework_TestCase $collectionFactoryMock, $escaperMock ); - $formMock = new \Magento\Framework\Object(); + $formMock = new \Magento\Framework\DataObject(); $formMock->getHtmlIdPrefix('id_prefix'); $formMock->getHtmlIdPrefix('id_suffix'); $this->_model->setForm($formMock); diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/TextTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/TextTest.php index 85d93de729a..b92913d8edb 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/TextTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/TextTest.php @@ -37,7 +37,7 @@ class TextTest extends \PHPUnit_Framework_TestCase $collectionFactoryMock, $escaperMock ); - $formMock = new \Magento\Framework\Object(); + $formMock = new \Magento\Framework\DataObject(); $formMock->getHtmlIdPrefix('id_prefix'); $formMock->getHtmlIdPrefix('id_suffix'); $this->_model->setForm($formMock); diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/TextareaTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/TextareaTest.php index 926de7ebb97..35d9aebc9ae 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/TextareaTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/TextareaTest.php @@ -37,7 +37,7 @@ class TextareaTest extends \PHPUnit_Framework_TestCase $collectionFactoryMock, $escaperMock ); - $formMock = new \Magento\Framework\Object(); + $formMock = new \Magento\Framework\DataObject(); $formMock->getHtmlIdPrefix('id_prefix'); $formMock->getHtmlIdPrefix('id_suffix'); $this->_model->setForm($formMock); diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Helper/PostHelperTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Helper/PostHelperTest.php index 92157b4e94c..86007b370e9 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Helper/PostHelperTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Helper/PostHelperTest.php @@ -12,11 +12,11 @@ class PostHelperTest extends \PHPUnit_Framework_TestCase public function testGetPostData() { $url = '/controller/sample/action/url/'; - $product = ['product' => new \Magento\Framework\Object(['id' => 1])]; + $product = ['product' => new \Magento\Framework\DataObject(['id' => 1])]; $expected = json_encode([ 'action' => $url, 'data' => [ - 'product' => new \Magento\Framework\Object(['id' => 1]), + 'product' => new \Magento\Framework\DataObject(['id' => 1]), Action::PARAM_NAME_URL_ENCODED => strtr(base64_encode($url . 'for_uenc'), '+/=', '-_,'), ], ]); diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/SearchResultProcessorTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/SearchResultProcessorTest.php index fc6f636a651..30f2683dcfe 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/SearchResultProcessorTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/SearchResultProcessorTest.php @@ -66,8 +66,8 @@ class SearchResultProcessorTest extends \PHPUnit_Framework_TestCase $itemData = ['id' => 1]; $itemData2 = ['id' => 2]; - $testItem = new \Magento\Framework\Object($itemData); - $testItem2 = new \Magento\Framework\Object($itemData2); + $testItem = new \Magento\Framework\DataObject($itemData); + $testItem2 = new \Magento\Framework\DataObject($itemData2); $this->searchResultCollectionMock->expects($this->once()) ->method('getItems') @@ -81,8 +81,8 @@ class SearchResultProcessorTest extends \PHPUnit_Framework_TestCase $itemData = ['id' => 1]; $itemData2 = ['id' => 2]; - $testItem = new \Magento\Framework\Object($itemData); - $testItem2 = new \Magento\Framework\Object($itemData2); + $testItem = new \Magento\Framework\DataObject($itemData); + $testItem2 = new \Magento\Framework\DataObject($itemData2); $this->searchResultCollectionMock->expects($this->once()) ->method('getItems') @@ -96,7 +96,7 @@ class SearchResultProcessorTest extends \PHPUnit_Framework_TestCase $itemData = ['id' => 1]; $ids = [1]; - $testItem = new \Magento\Framework\Object($itemData); + $testItem = new \Magento\Framework\DataObject($itemData); $this->searchResultCollectionMock->expects($this->once()) ->method('getItems') @@ -114,8 +114,8 @@ class SearchResultProcessorTest extends \PHPUnit_Framework_TestCase $itemData = ['id' => 1]; $itemData2 = ['id' => 2]; - $testItem = new \Magento\Framework\Object($itemData); - $testItem2 = new \Magento\Framework\Object($itemData2); + $testItem = new \Magento\Framework\DataObject($itemData); + $testItem2 = new \Magento\Framework\DataObject($itemData2); $this->searchResultCollectionMock->expects($this->once()) ->method('getItems') @@ -130,7 +130,7 @@ class SearchResultProcessorTest extends \PHPUnit_Framework_TestCase $columnValue = 'columnValue'; $itemData = ['id' => 1, $columnKey => $columnValue]; - $testItem = new \Magento\Framework\Object($itemData); + $testItem = new \Magento\Framework\DataObject($itemData); $this->searchResultCollectionMock->expects($this->once()) ->method('getItems') @@ -145,8 +145,8 @@ class SearchResultProcessorTest extends \PHPUnit_Framework_TestCase $itemData = ['id' => 1, $columnKey => $columnValue]; $itemData2 = ['id' => 2, $columnKey => $columnValue]; - $testItem = new \Magento\Framework\Object($itemData); - $testItem2 = new \Magento\Framework\Object($itemData2); + $testItem = new \Magento\Framework\DataObject($itemData); + $testItem2 = new \Magento\Framework\DataObject($itemData2); $this->searchResultCollectionMock->expects($this->once()) ->method('getItems') @@ -166,8 +166,8 @@ class SearchResultProcessorTest extends \PHPUnit_Framework_TestCase $itemData = ['id' => 1, $columnKey => $columnValue]; $itemData2 = ['id' => 2, $columnKey => $columnValue2]; - $testItem = new \Magento\Framework\Object($itemData); - $testItem2 = new \Magento\Framework\Object($itemData2); + $testItem = new \Magento\Framework\DataObject($itemData); + $testItem2 = new \Magento\Framework\DataObject($itemData2); $this->searchResultCollectionMock->expects($this->once()) ->method('getItems') diff --git a/lib/internal/Magento/Framework/Data/Tree/Node.php b/lib/internal/Magento/Framework/Data/Tree/Node.php index 69bb2b8d474..6c4fdf34f1e 100644 --- a/lib/internal/Magento/Framework/Data/Tree/Node.php +++ b/lib/internal/Magento/Framework/Data/Tree/Node.php @@ -13,7 +13,7 @@ use Magento\Framework\Data\Tree\Node\Collection; * * @author Magento Core Team <core@magentocommerce.com> */ -class Node extends \Magento\Framework\Object +class Node extends \Magento\Framework\DataObject { /** * Parent node diff --git a/lib/internal/Magento/Framework/Event.php b/lib/internal/Magento/Framework/Event.php index 606b9a2e79f..d3f96cda3ab 100644 --- a/lib/internal/Magento/Framework/Event.php +++ b/lib/internal/Magento/Framework/Event.php @@ -11,7 +11,7 @@ */ namespace Magento\Framework; -class Event extends \Magento\Framework\Object +class Event extends \Magento\Framework\DataObject { /** * Observers collection diff --git a/lib/internal/Magento/Framework/Event/Observer.php b/lib/internal/Magento/Framework/Event/Observer.php index e63dd844735..781d29a14be 100644 --- a/lib/internal/Magento/Framework/Event/Observer.php +++ b/lib/internal/Magento/Framework/Event/Observer.php @@ -7,7 +7,7 @@ namespace Magento\Framework\Event; use Magento\Framework\Event; -class Observer extends \Magento\Framework\Object +class Observer extends \Magento\Framework\DataObject { /** * Checks the observer's event_regex against event's name @@ -60,7 +60,7 @@ class Observer extends \Magento\Framework\Object /** * @param string $data - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function setName($data) { @@ -77,7 +77,7 @@ class Observer extends \Magento\Framework\Object /** * @param string $data - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function setEventName($data) { @@ -94,7 +94,7 @@ class Observer extends \Magento\Framework\Object /** * @param string $data - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function setCallback($data) { @@ -113,7 +113,7 @@ class Observer extends \Magento\Framework\Object /** * @param mixed $data - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function setEvent($data) { diff --git a/lib/internal/Magento/Framework/Filesystem/Io/Sftp.php b/lib/internal/Magento/Framework/Filesystem/Io/Sftp.php index 8c9e25bc218..cc23ef77fd7 100644 --- a/lib/internal/Magento/Framework/Filesystem/Io/Sftp.php +++ b/lib/internal/Magento/Framework/Filesystem/Io/Sftp.php @@ -13,7 +13,6 @@ namespace Magento\Framework\Filesystem\Io; * * @link http://www.php.net/manual/en/function.ssh2-connect.php */ -require_once 'phpseclib/Net/SFTP.php'; class Sftp extends AbstractIo { const REMOTE_TIMEOUT = 10; diff --git a/lib/internal/Magento/Framework/Filter/Factory.php b/lib/internal/Magento/Framework/Filter/Factory.php index 9b61863e0c6..915da96fc5e 100644 --- a/lib/internal/Magento/Framework/Filter/Factory.php +++ b/lib/internal/Magento/Framework/Filter/Factory.php @@ -19,7 +19,7 @@ class Factory extends AbstractFactory 'email' => 'Magento\Framework\Filter\Email', 'money' => 'Magento\Framework\Filter\Money', 'simple' => 'Magento\Framework\Filter\Template\Simple', - 'object' => 'Magento\Framework\Filter\Object', + 'object' => 'Magento\Framework\Filter\DataObject', 'sprintf' => 'Magento\Framework\Filter\Sprintf', 'template' => 'Magento\Framework\Filter\Template', 'arrayFilter' => 'Magento\Framework\Filter\ArrayFilter', diff --git a/lib/internal/Magento/Framework/Filter/Object.php b/lib/internal/Magento/Framework/Filter/Object.php deleted file mode 100644 index 981e54fd814..00000000000 --- a/lib/internal/Magento/Framework/Filter/Object.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Filter; - -class Object extends \Zend_Filter -{ - /** - * @var array - */ - protected $_columnFilters = []; - - /** - * @var \Magento\Framework\Data\Collection\EntityFactoryInterface - */ - protected $_entityFactory; - - /** - * @param \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory - */ - public function __construct(\Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory) - { - $this->_entityFactory = $entityFactory; - } - - /** - * @param \Zend_Filter_Interface $filter - * @param string $column - * @return null|\Zend_Filter - */ - public function addFilter(\Zend_Filter_Interface $filter, $column = '') - { - if ('' === $column) { - parent::addFilter($filter); - } else { - if (!isset($this->_columnFilters[$column])) { - $this->_columnFilters[$column] = new \Zend_Filter(); - } - $this->_columnFilters[$column]->addFilter($filter); - } - } - - /** - * @param \Magento\Framework\Object $object - * @return \Magento\Framework\Object - * @throws \Exception - */ - public function filter($object) - { - if (!$object instanceof \Magento\Framework\Object) { - throw new \InvalidArgumentException('Expecting an instance of \Magento\Framework\Object'); - } - $class = get_class($object); - $out = $this->_entityFactory->create($class); - foreach ($object->getData() as $column => $value) { - $value = parent::filter($value); - if (isset($this->_columnFilters[$column])) { - $value = $this->_columnFilters[$column]->filter($value); - } - $out->setData($column, $value); - } - return $out; - } -} diff --git a/lib/internal/Magento/Framework/Filter/Object/Grid.php b/lib/internal/Magento/Framework/Filter/Object/Grid.php deleted file mode 100644 index b7fe2018fc2..00000000000 --- a/lib/internal/Magento/Framework/Filter/Object/Grid.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Filter\Object; - -use Magento\Framework\Object; - -class Grid extends \Magento\Framework\Filter\Object -{ - /** - * @param Object[] $grid - * @return Object[] - */ - public function filter($grid) - { - $out = []; - if (is_array($grid)) { - foreach ($grid as $key => $gridItem) { - $out[$key] = parent::filter($gridItem); - } - } - return $out; - } -} diff --git a/lib/internal/Magento/Framework/Filter/Template.php b/lib/internal/Magento/Framework/Filter/Template.php index 79433be98a5..3c183a8098e 100644 --- a/lib/internal/Magento/Framework/Filter/Template.php +++ b/lib/internal/Magento/Framework/Filter/Template.php @@ -49,15 +49,15 @@ class Template implements \Zend_Filter_Interface protected $templateProcessor = null; /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; /** - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param array $variables */ - public function __construct(\Magento\Framework\Stdlib\String $string, $variables = []) + public function __construct(\Magento\Framework\Stdlib\StringUtils $string, $variables = []) { $this->string = $string; $this->setVariables($variables); @@ -320,7 +320,7 @@ class Template implements \Zend_Filter_Interface $stackVars[$i]['variable'] = & $this->templateVars[$stackVars[$i]['name']]; } elseif ( isset($stackVars[$i - 1]['variable']) - && $stackVars[$i - 1]['variable'] instanceof \Magento\Framework\Object + && $stackVars[$i - 1]['variable'] instanceof \Magento\Framework\DataObject ) { // If object calling methods or getting properties if ($stackVars[$i]['type'] == 'property') { diff --git a/lib/internal/Magento/Framework/Filter/Template/Simple.php b/lib/internal/Magento/Framework/Filter/Template/Simple.php index ad0a95d89c6..fa9964ffd5c 100644 --- a/lib/internal/Magento/Framework/Filter/Template/Simple.php +++ b/lib/internal/Magento/Framework/Filter/Template/Simple.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\Filter\Template; -class Simple extends \Magento\Framework\Object implements \Zend_Filter_Interface +class Simple extends \Magento\Framework\DataObject implements \Zend_Filter_Interface { /** * @var string diff --git a/lib/internal/Magento/Framework/Filter/Test/Unit/Object/GridTest.php b/lib/internal/Magento/Framework/Filter/Test/Unit/Object/GridTest.php index ba5ca51b902..7c312da712e 100644 --- a/lib/internal/Magento/Framework/Filter/Test/Unit/Object/GridTest.php +++ b/lib/internal/Magento/Framework/Filter/Test/Unit/Object/GridTest.php @@ -6,9 +6,9 @@ namespace Magento\Framework\Filter\Test\Unit\Object; -use \Magento\Framework\Filter\Object\Grid; +use \Magento\Framework\Filter\DataObject\Grid; -use Magento\Framework\Object; +use Magento\Framework\DataObject; class GridTest extends \PHPUnit_Framework_TestCase { @@ -24,19 +24,19 @@ class GridTest extends \PHPUnit_Framework_TestCase $entityFactoryMock ->expects($this->any()) ->method('create') - ->with('Magento\Framework\Object', []) + ->with('Magento\Framework\DataObject', []) ->will( $this->returnCallback( function () { - return new Object(); + return new DataObject(); } ) ); $gridFilter = new Grid($entityFactoryMock); $grid = [ - new Object(['field1' => 'value11', 'field2' => 'value12']), - new Object(['field3' => 'value23', 'field2' => 'value22']), + new DataObject(['field1' => 'value11', 'field2' => 'value12']), + new DataObject(['field3' => 'value23', 'field2' => 'value22']), ]; /** @var \Zend_Filter_Interface $filterMock */ diff --git a/lib/internal/Magento/Framework/Filter/Test/Unit/TemplateTest.php b/lib/internal/Magento/Framework/Filter/Test/Unit/TemplateTest.php index ee098f8614b..4eaec482f21 100644 --- a/lib/internal/Magento/Framework/Filter/Test/Unit/TemplateTest.php +++ b/lib/internal/Magento/Framework/Filter/Test/Unit/TemplateTest.php @@ -23,7 +23,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase { $this->templateFilter->setVariables( [ - 'customer' => new \Magento\Framework\Object(['firstname' => 'Felicia', 'lastname' => 'Henry']), + 'customer' => new \Magento\Framework\DataObject(['firstname' => 'Felicia', 'lastname' => 'Henry']), 'company' => 'A. L. Price', 'street1' => '687 Vernon Street', 'city' => 'Parker Dam', @@ -140,8 +140,8 @@ EXPECTED_RESULT; public function varDirectiveDataProvider() { - /* @var $stub \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject */ - $stub = $this->getMockBuilder('\Magento\Framework\Object') + /* @var $stub \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject */ + $stub = $this->getMockBuilder('\Magento\Framework\DataObject') ->disableOriginalConstructor() ->disableProxyingToOriginalMethods() ->setMethods(['bar']) diff --git a/lib/internal/Magento/Framework/Filter/Test/Unit/TruncateTest.php b/lib/internal/Magento/Framework/Filter/Test/Unit/TruncateTest.php index baff4d78018..f02fc27722f 100644 --- a/lib/internal/Magento/Framework/Filter/Test/Unit/TruncateTest.php +++ b/lib/internal/Magento/Framework/Filter/Test/Unit/TruncateTest.php @@ -32,13 +32,13 @@ class TruncateTest extends \PHPUnit_Framework_TestCase return [ '1' => [ '1234567890', - [new \Magento\Framework\Stdlib\String(), 5, '...', '', true], + [new \Magento\Framework\Stdlib\StringUtils(), 5, '...', '', true], '12...', '34567890', ], '2' => [ '123 456 789', - [new \Magento\Framework\Stdlib\String(), 8, '..', $remainder, false], + [new \Magento\Framework\Stdlib\StringUtils(), 8, '..', $remainder, false], '123..', ' 456 789', ] diff --git a/lib/internal/Magento/Framework/Filter/Translit.php b/lib/internal/Magento/Framework/Filter/Translit.php index a0b145ae344..c8e6e59de02 100644 --- a/lib/internal/Magento/Framework/Filter/Translit.php +++ b/lib/internal/Magento/Framework/Filter/Translit.php @@ -370,7 +370,7 @@ class Translit implements \Zend_Filter_Interface { $string = strtr($string, $this->getConvertTable()); return '"libiconv"' == ICONV_IMPL ? iconv( - \Magento\Framework\Stdlib\String::ICONV_CHARSET, + \Magento\Framework\Stdlib\StringUtils::ICONV_CHARSET, 'ascii//ignore//translit', $string ) : $string; diff --git a/lib/internal/Magento/Framework/Filter/Truncate.php b/lib/internal/Magento/Framework/Filter/Truncate.php index e6c20bdacba..357265cd2c2 100644 --- a/lib/internal/Magento/Framework/Filter/Truncate.php +++ b/lib/internal/Magento/Framework/Filter/Truncate.php @@ -34,19 +34,19 @@ class Truncate implements \Zend_Filter_Interface protected $breakWords; /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; /** - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param int $length * @param string $etc * @param string &$remainder * @param bool $breakWords */ public function __construct( - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, $length = 80, $etc = '...', &$remainder = '', diff --git a/lib/internal/Magento/Framework/HTTP/Header.php b/lib/internal/Magento/Framework/HTTP/Header.php index 7dba8faecfe..2abbbec2728 100644 --- a/lib/internal/Magento/Framework/HTTP/Header.php +++ b/lib/internal/Magento/Framework/HTTP/Header.php @@ -21,15 +21,15 @@ class Header protected $_request; /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $_converter; /** * @param \Magento\Framework\App\RequestInterface $httpRequest - * @param \Magento\Framework\Stdlib\String $converter + * @param \Magento\Framework\Stdlib\StringUtils $converter */ - public function __construct(\Magento\Framework\App\RequestInterface $httpRequest, \Magento\Framework\Stdlib\String $converter) + public function __construct(\Magento\Framework\App\RequestInterface $httpRequest, \Magento\Framework\Stdlib\StringUtils $converter) { $this->_request = $httpRequest; $this->_converter = $converter; diff --git a/lib/internal/Magento/Framework/HTTP/Test/Unit/HeaderTest.php b/lib/internal/Magento/Framework/HTTP/Test/Unit/HeaderTest.php index 24bd8ff4e21..40c6705fee0 100644 --- a/lib/internal/Magento/Framework/HTTP/Test/Unit/HeaderTest.php +++ b/lib/internal/Magento/Framework/HTTP/Test/Unit/HeaderTest.php @@ -18,7 +18,7 @@ class HeaderTest extends \PHPUnit_Framework_TestCase protected $_request; /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $_converter; @@ -34,7 +34,7 @@ class HeaderTest extends \PHPUnit_Framework_TestCase false ); - $this->_converter = $this->getMock('\Magento\Framework\Stdlib\String', ['cleanString']); + $this->_converter = $this->getMock('\Magento\Framework\Stdlib\StringUtils', ['cleanString']); } /** diff --git a/lib/internal/Magento/Framework/Locale/Bundle/DataBundle.php b/lib/internal/Magento/Framework/Locale/Bundle/DataBundle.php index d5ddb742c70..cac367822ce 100644 --- a/lib/internal/Magento/Framework/Locale/Bundle/DataBundle.php +++ b/lib/internal/Magento/Framework/Locale/Bundle/DataBundle.php @@ -28,21 +28,31 @@ class DataBundle $locale = $this->cleanLocale($locale); $class = get_class($this); if (!isset(static::$bundles[$class][$locale])) { - try { - $bundle = new \ResourceBundle($locale, $this->path); - if (!$bundle && $this->path != 'ICUDATA') { - $bundle = new \ResourceBundle($locale, 'ICUDATA'); - } - } catch (\Exception $e) { - // HHVM compatibility: constructor throws on invalid resource - $bundle = null; + $bundle = $this->createResourceBundle($locale, $this->path); + if (!$bundle && $this->path != 'ICUDATA') { + $bundle = $this->createResourceBundle($locale, 'ICUDATA'); } - static::$bundles[$class][$locale] = $bundle; } return static::$bundles[$class][$locale]; } + /** + * @param string $locale + * @param string $path + * @return null|\ResourceBundle + */ + protected function createResourceBundle($locale, $path) + { + try { + $bundle = new \ResourceBundle($locale, $path); + } catch (\Exception $e) { + // HHVM compatibility: constructor throws on invalid resource + $bundle = null; + } + return $bundle; + } + /** * Clean locale leaving only language and script * diff --git a/lib/internal/Magento/Framework/Locale/Currency.php b/lib/internal/Magento/Framework/Locale/Currency.php index 9df31a3da57..7126189ce88 100644 --- a/lib/internal/Magento/Framework/Locale/Currency.php +++ b/lib/internal/Magento/Framework/Locale/Currency.php @@ -89,7 +89,7 @@ class Currency implements \Magento\Framework\Locale\CurrencyInterface $options[self::CURRENCY_OPTION_SYMBOL] = $currency; } - $options = new \Magento\Framework\Object($options); + $options = new \Magento\Framework\DataObject($options); $this->_eventManager->dispatch( 'currency_display_options_forming', ['currency_options' => $options, 'base_code' => $currency] diff --git a/lib/internal/Magento/Framework/Locale/Test/Unit/TranslatedListsTest.php b/lib/internal/Magento/Framework/Locale/Test/Unit/TranslatedListsTest.php index b2ccd64f10d..37b129a104e 100644 --- a/lib/internal/Magento/Framework/Locale/Test/Unit/TranslatedListsTest.php +++ b/lib/internal/Magento/Framework/Locale/Test/Unit/TranslatedListsTest.php @@ -71,12 +71,14 @@ class TranslatedListsTest extends \PHPUnit_Framework_TestCase $expectedResults = ['USD', 'EUR', 'GBP', 'UAH']; $currencyList = $this->listsModel->getOptionCurrencies(); + $currencyCodes = array_map( + function ($data) { + return $data['value']; + }, + $currencyList + ); foreach ($expectedResults as $value) { - $found = false; - foreach ($currencyList as $item) { - $found = $found || ($value == $item['value']); - } - $this->assertTrue($found); + $this->assertContains($value, $currencyCodes); } } diff --git a/lib/internal/Magento/Framework/Locale/TranslatedLists.php b/lib/internal/Magento/Framework/Locale/TranslatedLists.php index f67c73cd0dd..b84c725e5c5 100644 --- a/lib/internal/Magento/Framework/Locale/TranslatedLists.php +++ b/lib/internal/Magento/Framework/Locale/TranslatedLists.php @@ -168,7 +168,10 @@ class TranslatedLists implements ListsInterface */ public function getOptionAllCurrencies() { - $currencies = (new CurrencyBundle())->get($this->localeResolver->getLocale())['Currencies'] ?: []; + $currencyBundle = new \Magento\Framework\Locale\Bundle\CurrencyBundle(); + $locale = $this->localeResolver->getLocale(); + $currencies = $currencyBundle->get($locale)['Currencies'] ?: []; + $options = []; foreach ($currencies as $code => $data) { $options[] = ['label' => $data[1], 'value' => $code]; diff --git a/lib/internal/Magento/Framework/Model/AbstractModel.php b/lib/internal/Magento/Framework/Model/AbstractModel.php index 72f6357f06c..630090d5f83 100644 --- a/lib/internal/Magento/Framework/Model/AbstractModel.php +++ b/lib/internal/Magento/Framework/Model/AbstractModel.php @@ -14,7 +14,7 @@ use Magento\Framework\Phrase; * @SuppressWarnings(PHPMD.NumberOfChildren) * @SuppressWarnings(PHPMD.TooManyFields) */ -abstract class AbstractModel extends \Magento\Framework\Object +abstract class AbstractModel extends \Magento\Framework\DataObject { /** * Prefix of model events names @@ -184,7 +184,7 @@ abstract class AbstractModel extends \Magento\Framework\Object $this->_actionValidator = $context->getActionValidator(); if (method_exists($this->_resource, 'getIdFieldName') - || $this->_resource instanceof \Magento\Framework\Object + || $this->_resource instanceof \Magento\Framework\DataObject ) { $this->_idFieldName = $this->_getResource()->getIdFieldName(); } diff --git a/lib/internal/Magento/Framework/Model/Resource/AbstractResource.php b/lib/internal/Magento/Framework/Model/Resource/AbstractResource.php index 191f43aa29c..21847e3dc99 100644 --- a/lib/internal/Magento/Framework/Model/Resource/AbstractResource.php +++ b/lib/internal/Magento/Framework/Model/Resource/AbstractResource.php @@ -137,13 +137,13 @@ abstract class AbstractResource /** * Serialize specified field in an object * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @param string $field * @param mixed $defaultValue * @param bool $unsetEmpty * @return $this */ - protected function _serializeField(\Magento\Framework\Object $object, $field, $defaultValue = null, $unsetEmpty = false) + protected function _serializeField(\Magento\Framework\DataObject $object, $field, $defaultValue = null, $unsetEmpty = false) { $value = $object->getData($field); if (empty($value)) { @@ -163,14 +163,14 @@ abstract class AbstractResource } /** - * Unserialize \Magento\Framework\Object field in an object + * Unserialize \Magento\Framework\DataObject field in an object * * @param \Magento\Framework\Model\AbstractModel $object * @param string $field * @param mixed $defaultValue * @return void */ - protected function _unserializeField(\Magento\Framework\Object $object, $field, $defaultValue = null) + protected function _unserializeField(\Magento\Framework\DataObject $object, $field, $defaultValue = null) { $value = $object->getData($field); if (empty($value)) { @@ -183,11 +183,11 @@ abstract class AbstractResource /** * Prepare data for passed table * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @param string $table * @return array */ - protected function _prepareDataForTable(\Magento\Framework\Object $object, $table) + protected function _prepareDataForTable(\Magento\Framework\DataObject $object, $table) { $data = []; $fields = $this->_getWriteAdapter()->describeTable($table); diff --git a/lib/internal/Magento/Framework/Model/Resource/Db/AbstractDb.php b/lib/internal/Magento/Framework/Model/Resource/Db/AbstractDb.php index e86d486b1f1..29cead33f59 100644 --- a/lib/internal/Magento/Framework/Model/Resource/Db/AbstractDb.php +++ b/lib/internal/Magento/Framework/Model/Resource/Db/AbstractDb.php @@ -614,7 +614,7 @@ abstract class AbstractDb extends AbstractResource $this->_uniqueFields = [['field' => $fields, 'title' => $fields]]; } - $data = new \Magento\Framework\Object($this->_prepareDataForSave($object)); + $data = new \Magento\Framework\DataObject($this->_prepareDataForSave($object)); $select = $this->_getWriteAdapter()->select()->from($this->getMainTable()); foreach ($fields as $unique) { @@ -664,7 +664,7 @@ abstract class AbstractDb extends AbstractResource /** * Perform actions after object load * - * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\Object $object + * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\DataObject $object * @return $this * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -676,7 +676,7 @@ abstract class AbstractDb extends AbstractResource /** * Perform actions before object save * - * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\Object $object + * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\DataObject $object * @return $this * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -688,7 +688,7 @@ abstract class AbstractDb extends AbstractResource /** * Perform actions after object save * - * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\Object $object + * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\DataObject $object * @return $this * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -700,7 +700,7 @@ abstract class AbstractDb extends AbstractResource /** * Perform actions before object delete * - * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\Object $object + * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\DataObject $object * @return $this * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -712,7 +712,7 @@ abstract class AbstractDb extends AbstractResource /** * Perform actions after object delete * - * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\Object $object + * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\DataObject $object * @return $this * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ diff --git a/lib/internal/Magento/Framework/Model/Resource/Db/VersionControl/Collection.php b/lib/internal/Magento/Framework/Model/Resource/Db/VersionControl/Collection.php index 84f2334021e..bc3db1d5810 100644 --- a/lib/internal/Magento/Framework/Model/Resource/Db/VersionControl/Collection.php +++ b/lib/internal/Magento/Framework/Model/Resource/Db/VersionControl/Collection.php @@ -59,7 +59,7 @@ abstract class Collection extends \Magento\Framework\Model\Resource\Db\Collectio /** * @inheritdoc */ - protected function beforeAddLoadedItem(\Magento\Framework\Object $item) + protected function beforeAddLoadedItem(\Magento\Framework\DataObject $item) { $this->entitySnapshot->registerSnapshot($item); return $item; diff --git a/lib/internal/Magento/Framework/Model/Resource/Db/VersionControl/Metadata.php b/lib/internal/Magento/Framework/Model/Resource/Db/VersionControl/Metadata.php index b761d22717f..81306ef386f 100644 --- a/lib/internal/Magento/Framework/Model/Resource/Db/VersionControl/Metadata.php +++ b/lib/internal/Magento/Framework/Model/Resource/Db/VersionControl/Metadata.php @@ -18,11 +18,11 @@ class Metadata /** * Returns list of entity fields that are applicable for persistence operations * - * @param \Magento\Framework\Object $entity + * @param \Magento\Framework\DataObject $entity * @return array * @throws \Magento\Framework\Exception\LocalizedException */ - public function getFields(\Magento\Framework\Object $entity) + public function getFields(\Magento\Framework\DataObject $entity) { $entityClass = get_class($entity); if (!isset($this->metadataInfo[$entityClass])) { diff --git a/lib/internal/Magento/Framework/Model/Resource/Db/VersionControl/Snapshot.php b/lib/internal/Magento/Framework/Model/Resource/Db/VersionControl/Snapshot.php index dc837426020..86377a0e30a 100644 --- a/lib/internal/Magento/Framework/Model/Resource/Db/VersionControl/Snapshot.php +++ b/lib/internal/Magento/Framework/Model/Resource/Db/VersionControl/Snapshot.php @@ -36,11 +36,11 @@ class Snapshot /** * Register snapshot of entity data, for tracking changes * - * @param \Magento\Framework\Object $entity + * @param \Magento\Framework\DataObject $entity * @return void * @SuppressWarnings(PHPMD.UnusedLocalVariable) */ - public function registerSnapshot(\Magento\Framework\Object $entity) + public function registerSnapshot(\Magento\Framework\DataObject $entity) { $metaData = $this->metadata->getFields($entity); $filteredData = array_intersect_key($entity->getData(), $metaData); @@ -51,10 +51,10 @@ class Snapshot /** * Check is current entity has changes, by comparing current object state with stored snapshot * - * @param \Magento\Framework\Object $entity + * @param \Magento\Framework\DataObject $entity * @return bool */ - public function isModified(\Magento\Framework\Object $entity) + public function isModified(\Magento\Framework\DataObject $entity) { if (!$entity->getId()) { return true; diff --git a/lib/internal/Magento/Framework/Model/Resource/Iterator.php b/lib/internal/Magento/Framework/Model/Resource/Iterator.php index 483122d6bbc..d14ecbc9e8a 100644 --- a/lib/internal/Magento/Framework/Model/Resource/Iterator.php +++ b/lib/internal/Magento/Framework/Model/Resource/Iterator.php @@ -10,7 +10,7 @@ namespace Magento\Framework\Model\Resource; -class Iterator extends \Magento\Framework\Object +class Iterator extends \Magento\Framework\DataObject { /** * Walk over records fetched from query one by one using callback function diff --git a/lib/internal/Magento/Framework/Model/Resource/Type/Db/Pdo/Mysql.php b/lib/internal/Magento/Framework/Model/Resource/Type/Db/Pdo/Mysql.php index 162526fba27..8cf878e9ca2 100644 --- a/lib/internal/Magento/Framework/Model/Resource/Type/Db/Pdo/Mysql.php +++ b/lib/internal/Magento/Framework/Model/Resource/Type/Db/Pdo/Mysql.php @@ -15,7 +15,7 @@ use Magento\Framework\Model\Resource\Type\Db; class Mysql extends Db implements ConnectionAdapterInterface { /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -30,12 +30,12 @@ class Mysql extends Db implements ConnectionAdapterInterface protected $_connectionConfig; /** - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\Stdlib\DateTime $dateTime * @param array $config */ public function __construct( - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\Stdlib\DateTime $dateTime, array $config ) { diff --git a/lib/internal/Magento/Framework/Model/Test/Unit/AbstractExtensibleModelTest.php b/lib/internal/Magento/Framework/Model/Test/Unit/AbstractExtensibleModelTest.php index 8cead443a6b..b65ed8f6369 100644 --- a/lib/internal/Magento/Framework/Model/Test/Unit/AbstractExtensibleModelTest.php +++ b/lib/internal/Magento/Framework/Model/Test/Unit/AbstractExtensibleModelTest.php @@ -96,9 +96,9 @@ class AbstractExtensibleModelTest extends \PHPUnit_Framework_TestCase ->method('getCustomAttributesMetadata') ->willReturn( [ - new \Magento\Framework\Object(['attribute_code' => 'attribute1']), - new \Magento\Framework\Object(['attribute_code' => 'attribute2']), - new \Magento\Framework\Object(['attribute_code' => 'attribute3']), + new \Magento\Framework\DataObject(['attribute_code' => 'attribute1']), + new \Magento\Framework\DataObject(['attribute_code' => 'attribute2']), + new \Magento\Framework\DataObject(['attribute_code' => 'attribute3']), ] ); $extensionAttributesFactory = $this->getMockBuilder('Magento\Framework\Api\ExtensionAttributesFactory') diff --git a/lib/internal/Magento/Framework/Model/Test/Unit/AbstractModelTest.php b/lib/internal/Magento/Framework/Model/Test/Unit/AbstractModelTest.php index 0b692b8c033..c601e5edece 100644 --- a/lib/internal/Magento/Framework/Model/Test/Unit/AbstractModelTest.php +++ b/lib/internal/Magento/Framework/Model/Test/Unit/AbstractModelTest.php @@ -124,7 +124,7 @@ class AbstractModelTest extends \PHPUnit_Framework_TestCase } /** - * Tests \Magento\Framework\Object->isDeleted() + * Tests \Magento\Framework\DataObject->isDeleted() */ public function testIsDeleted() { @@ -136,7 +136,7 @@ class AbstractModelTest extends \PHPUnit_Framework_TestCase } /** - * Tests \Magento\Framework\Object->hasDataChanges() + * Tests \Magento\Framework\DataObject->hasDataChanges() */ public function testHasDataChanges() { @@ -156,7 +156,7 @@ class AbstractModelTest extends \PHPUnit_Framework_TestCase } /** - * Tests \Magento\Framework\Object->getId() + * Tests \Magento\Framework\DataObject->getId() */ public function testSetGetId() { @@ -172,7 +172,7 @@ class AbstractModelTest extends \PHPUnit_Framework_TestCase } /** - * Tests \Magento\Framework\Object->setOrigData() + * Tests \Magento\Framework\DataObject->setOrigData() */ public function testOrigData() { @@ -188,7 +188,7 @@ class AbstractModelTest extends \PHPUnit_Framework_TestCase } /** - * Tests \Magento\Framework\Object->setDataChanges() + * Tests \Magento\Framework\DataObject->setDataChanges() */ public function testSetDataChanges() { diff --git a/lib/internal/Magento/Framework/Model/Test/Unit/Resource/Db/Collection/AbstractCollectionTest.php b/lib/internal/Magento/Framework/Model/Test/Unit/Resource/Db/Collection/AbstractCollectionTest.php index 99858753a86..37b2c735123 100644 --- a/lib/internal/Magento/Framework/Model/Test/Unit/Resource/Db/Collection/AbstractCollectionTest.php +++ b/lib/internal/Magento/Framework/Model/Test/Unit/Resource/Db/Collection/AbstractCollectionTest.php @@ -9,7 +9,7 @@ namespace Magento\Framework\Model\Test\Unit\Resource\Db\Collection; use Magento\Framework\Model\Resource\Db\Collection\AbstractCollection; -use Magento\Framework\Object as MagentoObject; +use Magento\Framework\DataObject as MagentoObject; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; /** @@ -321,7 +321,7 @@ class AbstractCollectionTest extends \PHPUnit_Framework_TestCase /** * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Zend_Db_Select does not extend \Magento\Framework\Object + * @expectedExceptionMessage Zend_Db_Select does not extend \Magento\Framework\DataObject */ public function testSetModelInvalidType() { @@ -330,13 +330,13 @@ class AbstractCollectionTest extends \PHPUnit_Framework_TestCase public function testSetModel() { - $this->assertTrue($this->uut->setModel('Magento\Framework\Object') instanceof Uut); + $this->assertTrue($this->uut->setModel('Magento\Framework\DataObject') instanceof Uut); } public function testGetModelName() { - $this->uut->setModel('Magento\Framework\Object'); - $this->assertEquals('Magento\Framework\Object', $this->uut->getModelName()); + $this->uut->setModel('Magento\Framework\DataObject'); + $this->assertEquals('Magento\Framework\DataObject', $this->uut->getModelName()); } public function testGetResourceModelName() @@ -403,8 +403,8 @@ class AbstractCollectionTest extends \PHPUnit_Framework_TestCase public function testSave() { for ($i = 0; $i < 3; $i++) { - /** @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject $item */ - $item = $this->getMock('Magento\Framework\Object', ['save']); + /** @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject $item */ + $item = $this->getMock('Magento\Framework\DataObject', ['save']); $item->expects($this->once())->method('save'); $this->uut->addItem($item); } diff --git a/lib/internal/Magento/Framework/Model/Test/Unit/Resource/Type/Db/Pdo/MysqlTest.php b/lib/internal/Magento/Framework/Model/Test/Unit/Resource/Type/Db/Pdo/MysqlTest.php index 93edd6e6740..932410823ae 100644 --- a/lib/internal/Magento/Framework/Model/Test/Unit/Resource/Type/Db/Pdo/MysqlTest.php +++ b/lib/internal/Magento/Framework/Model/Test/Unit/Resource/Type/Db/Pdo/MysqlTest.php @@ -11,7 +11,7 @@ use \Magento\Framework\Model\Resource\Type\Db\Pdo\Mysql; class MysqlTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Framework\Stdlib\String|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Stdlib\StringUtils|\PHPUnit_Framework_MockObject_MockObject */ private $string; @@ -22,7 +22,7 @@ class MysqlTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->string = $this->getMock('\Magento\Framework\Stdlib\String'); + $this->string = $this->getMock('\Magento\Framework\Stdlib\StringUtils'); $this->dateTime = $this->getMock('\Magento\Framework\Stdlib\DateTime'); } diff --git a/lib/internal/Magento/Framework/Module/Dir.php b/lib/internal/Magento/Framework/Module/Dir.php index 376303356d9..3e3307f92f4 100644 --- a/lib/internal/Magento/Framework/Module/Dir.php +++ b/lib/internal/Magento/Framework/Module/Dir.php @@ -10,7 +10,7 @@ namespace Magento\Framework\Module; use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\Filesystem; use Magento\Framework\Filesystem\Directory\ReadInterface; -use Magento\Framework\Stdlib\String as StringHelper; +use Magento\Framework\Stdlib\StringUtils as StringHelper; use Magento\Framework\Module\ModuleRegistryInterface; class Dir @@ -32,7 +32,7 @@ class Dir protected $_modulesDirectory; /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $_string; diff --git a/lib/internal/Magento/Framework/Module/PackageInfo.php b/lib/internal/Magento/Framework/Module/PackageInfo.php index f45173da62d..22f6d5f9ddd 100644 --- a/lib/internal/Magento/Framework/Module/PackageInfo.php +++ b/lib/internal/Magento/Framework/Module/PackageInfo.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\Module; -use Magento\Framework\Stdlib\String; +use Magento\Framework\Stdlib\StringUtils; /** * Provide information of dependencies and conflicts in composer.json files, mapping of package name to module name, @@ -56,7 +56,7 @@ class PackageInfo private $reader; /** - * String utilities + * StringUtils utilities * * @var String */ @@ -67,9 +67,9 @@ class PackageInfo * * @param ModuleList\Loader $loader * @param Dir\Reader $reader - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string */ - public function __construct(ModuleList\Loader $loader, Dir\Reader $reader, String $string) + public function __construct(ModuleList\Loader $loader, Dir\Reader $reader, StringUtils $string) { $this->loader = $loader; $this->reader = $reader; @@ -87,7 +87,7 @@ class PackageInfo $jsonData = $this->reader->getComposerJsonFiles()->toArray(); foreach (array_keys($this->loader->load()) as $moduleName) { $key = $this->string->upperCaseWords($moduleName, '_', '/') . '/composer.json'; - if (isset($jsonData[$key])) { + if (isset($jsonData[$key]) && $jsonData[$key]) { $packageData = \Zend_Json::decode($jsonData[$key]); if (isset($packageData['name'])) { $this->packageModuleMap[$packageData['name']] = $moduleName; diff --git a/lib/internal/Magento/Framework/Module/Test/Unit/DirTest.php b/lib/internal/Magento/Framework/Module/Test/Unit/DirTest.php index 616aae5a110..bacb2890c36 100644 --- a/lib/internal/Magento/Framework/Module/Test/Unit/DirTest.php +++ b/lib/internal/Magento/Framework/Module/Test/Unit/DirTest.php @@ -18,7 +18,7 @@ class DirTest extends \PHPUnit_Framework_TestCase protected $filesystemMock; /** - * @var \Magento\Framework\Stdlib\String|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Stdlib\StringUtils|\PHPUnit_Framework_MockObject_MockObject */ protected $_stringMock; @@ -43,7 +43,7 @@ class DirTest extends \PHPUnit_Framework_TestCase false, false ); - $this->_stringMock = $this->getMock('Magento\Framework\Stdlib\String', [], [], '', false, false); + $this->_stringMock = $this->getMock('Magento\Framework\Stdlib\StringUtils', [], [], '', false, false); $this->moduleRegistryMock = $this->getMock( 'Magento\Framework\Module\ModuleRegistryInterface', [], diff --git a/lib/internal/Magento/Framework/Module/Test/Unit/PackageInfoTest.php b/lib/internal/Magento/Framework/Module/Test/Unit/PackageInfoTest.php index 45eaa3cbb2f..230ab9c0a82 100644 --- a/lib/internal/Magento/Framework/Module/Test/Unit/PackageInfoTest.php +++ b/lib/internal/Magento/Framework/Module/Test/Unit/PackageInfoTest.php @@ -47,7 +47,7 @@ class PackageInfoTest extends \PHPUnit_Framework_TestCase ->method('getComposerJsonFiles') ->will($this->returnValue($fileIteratorMock)); - $this->packageInfo = new PackageInfo($this->loader, $this->reader, new \Magento\Framework\Stdlib\String()); + $this->packageInfo = new PackageInfo($this->loader, $this->reader, new \Magento\Framework\Stdlib\StringUtils()); } public function testGetModuleName() diff --git a/lib/internal/Magento/Framework/Mview/View.php b/lib/internal/Magento/Framework/Mview/View.php index 1aaf0105668..6026a28c834 100644 --- a/lib/internal/Magento/Framework/Mview/View.php +++ b/lib/internal/Magento/Framework/Mview/View.php @@ -11,7 +11,7 @@ namespace Magento\Framework\Mview; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class View extends \Magento\Framework\Object implements ViewInterface +class View extends \Magento\Framework\DataObject implements ViewInterface { /** * @var string diff --git a/lib/internal/Magento/Framework/Object.php b/lib/internal/Magento/Framework/Object.php deleted file mode 100644 index 8ad8f30f624..00000000000 --- a/lib/internal/Magento/Framework/Object.php +++ /dev/null @@ -1,541 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework; - -/** - * Universal data container with array access implementation - * - * @author Magento Core Team <core@magentocommerce.com> - * @SuppressWarnings(PHPMD.NumberOfChildren) - */ -class Object implements \ArrayAccess -{ - /** - * Object attributes - * - * @var array - */ - protected $_data = []; - - /** - * Setter/Getter underscore transformation cache - * - * @var array - */ - protected static $_underscoreCache = []; - - /** - * Constructor - * - * By default is looking for first argument as array and assigns it as object attributes - * This behavior may change in child classes - * - * @param array $data - */ - public function __construct(array $data = []) - { - $this->_data = $data; - } - - /** - * Add data to the object. - * - * Retains previous data in the object. - * - * @param array $arr - * @return $this - */ - public function addData(array $arr) - { - foreach ($arr as $index => $value) { - $this->setData($index, $value); - } - return $this; - } - - /** - * Overwrite data in the object. - * - * The $key parameter can be string or array. - * If $key is string, the attribute value will be overwritten by $value - * - * If $key is an array, it will overwrite all the data in the object. - * - * @param string|array $key - * @param mixed $value - * @return $this - */ - public function setData($key, $value = null) - { - if ($key === (array)$key) { - $this->_data = $key; - } else { - $this->_data[$key] = $value; - } - return $this; - } - - /** - * Unset data from the object. - * - * @param null|string|array $key - * @return $this - */ - public function unsetData($key = null) - { - if ($key === null) { - $this->setData([]); - } elseif (is_string($key)) { - if (isset($this->_data[$key]) || array_key_exists($key, $this->_data)) { - unset($this->_data[$key]); - } - } elseif ($key === (array)$key) { - foreach ($key as $element) { - $this->unsetData($element); - } - } - return $this; - } - - /** - * Object data getter - * - * If $key is not defined will return all the data as an array. - * Otherwise it will return value of the element specified by $key. - * It is possible to use keys like a/b/c for access nested array data - * - * If $index is specified it will assume that attribute data is an array - * and retrieve corresponding member. If data is the string - it will be explode - * by new line character and converted to array. - * - * @param string $key - * @param string|int $index - * @return mixed - */ - - public function getData($key = '', $index = null) - { - if ('' === $key) { - return $this->_data; - } - - /* process a/b/c key as ['a']['b']['c'] */ - if (strpos($key, '/')) { - $data = $this->getDataByPath($key); - } else { - $data = $this->_getData($key); - } - - if ($index !== null) { - if ($data === (array)$data) { - $data = isset($data[$index]) ? $data[$index] : null; - } elseif (is_string($data)) { - $data = explode(PHP_EOL, $data); - $data = isset($data[$index]) ? $data[$index] : null; - } elseif ($data instanceof \Magento\Framework\Object) { - $data = $data->getData($index); - } else { - $data = null; - } - } - return $data; - } - - /** - * Get object data by path - * - * Method consider the path as chain of keys: a/b/c => ['a']['b']['c'] - * - * @param string $path - * @return mixed - */ - public function getDataByPath($path) - { - $keys = explode('/', $path); - - $data = $this->_data; - foreach ($keys as $key) { - if ((array)$data === $data && isset($data[$key])) { - $data = $data[$key]; - } elseif ($data instanceof \Magento\Framework\Object) { - $data = $data->getDataByKey($key); - } else { - return null; - } - } - return $data; - } - - /** - * Get object data by particular key - * - * @param string $key - * @return mixed - */ - public function getDataByKey($key) - { - return $this->_getData($key); - } - - /** - * Get value from _data array without parse key - * - * @param string $key - * @return mixed - */ - protected function _getData($key) - { - if (isset($this->_data[$key])) { - return $this->_data[$key]; - } - return null; - } - - /** - * Set object data with calling setter method - * - * @param string $key - * @param mixed $args - * @return $this - */ - public function setDataUsingMethod($key, $args = []) - { - $method = 'set' . str_replace(' ', '', ucwords(str_replace('_', ' ', $key))); - $this->{$method}($args); - return $this; - } - - /** - * Get object data by key with calling getter method - * - * @param string $key - * @param mixed $args - * @return mixed - */ - public function getDataUsingMethod($key, $args = null) - { - $method = 'get' . str_replace(' ', '', ucwords(str_replace('_', ' ', $key))); - return $this->{$method}($args); - } - - /** - * If $key is empty, checks whether there's any data in the object - * Otherwise checks if the specified attribute is set. - * - * @param string $key - * @return bool - */ - public function hasData($key = '') - { - if (empty($key) || !is_string($key)) { - return !empty($this->_data); - } - return array_key_exists($key, $this->_data); - } - - /** - * Convert array of object data with to array with keys requested in $keys array - * - * @param array $keys array of required keys - * @return array - */ - public function toArray(array $keys = []) - { - if (empty($keys)) { - return $this->_data; - } - - $result = []; - foreach ($keys as $key) { - if (isset($this->_data[$key])) { - $result[$key] = $this->_data[$key]; - } else { - $result[$key] = null; - } - } - return $result; - } - - /** - * The "__" style wrapper for toArray method - * - * @param array $keys - * @return array - */ - public function convertToArray(array $keys = []) - { - return $this->toArray($keys); - } - - /** - * Convert object data into XML string - * - * @param array $keys array of keys that must be represented - * @param string $rootName root node name - * @param bool $addOpenTag flag that allow to add initial xml node - * @param bool $addCdata flag that require wrap all values in CDATA - * @return string - */ - public function toXml(array $keys = [], $rootName = 'item', $addOpenTag = false, $addCdata = true) - { - $xml = ''; - $data = $this->toArray($keys); - foreach ($data as $fieldName => $fieldValue) { - if ($addCdata === true) { - $fieldValue = "<![CDATA[{$fieldValue}]]>"; - } else { - $fieldValue = str_replace( - ['&', '"', "'", '<', '>'], - ['&', '"', ''', '<', '>'], - $fieldValue - ); - } - $xml .= "<{$fieldName}>{$fieldValue}</{$fieldName}>\n"; - } - if ($rootName) { - $xml = "<{$rootName}>\n{$xml}</{$rootName}>\n"; - } - if ($addOpenTag) { - $xml = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . $xml; - } - return $xml; - } - - /** - * The "__" style wrapper for toXml method - * - * @param array $arrAttributes array of keys that must be represented - * @param string $rootName root node name - * @param bool $addOpenTag flag that allow to add initial xml node - * @param bool $addCdata flag that require wrap all values in CDATA - * @return string - */ - public function convertToXml( - array $arrAttributes = [], - $rootName = 'item', - $addOpenTag = false, - $addCdata = true - ) { - return $this->toXml($arrAttributes, $rootName, $addOpenTag, $addCdata); - } - - /** - * Convert object data to JSON - * - * @param array $keys array of required keys - * @return string - */ - public function toJson(array $keys = []) - { - $data = $this->toArray($keys); - return \Zend_Json::encode($data); - } - - /** - * The "__" style wrapper for toJson - * - * @param array $keys - * @return string - */ - public function convertToJson(array $keys = []) - { - return $this->toJson($keys); - } - - /** - * Convert object data into string with predefined format - * - * Will use $format as an template and substitute {{key}} for attributes - * - * @param string $format - * @return string - */ - public function toString($format = '') - { - if (empty($format)) { - $result = implode(', ', $this->getData()); - } else { - preg_match_all('/\{\{([a-z0-9_]+)\}\}/is', $format, $matches); - foreach ($matches[1] as $var) { - $format = str_replace('{{' . $var . '}}', $this->getData($var), $format); - } - $result = $format; - } - return $result; - } - - /** - * Set/Get attribute wrapper - * - * @param string $method - * @param array $args - * @return mixed - * @throws \Magento\Framework\Exception\LocalizedException - */ - public function __call($method, $args) - { - switch (substr($method, 0, 3)) { - case 'get': - $key = $this->_underscore(substr($method, 3)); - $index = isset($args[0]) ? $args[0] : null; - return $this->getData($key, $index); - case 'set': - $key = $this->_underscore(substr($method, 3)); - $value = isset($args[0]) ? $args[0] : null; - return $this->setData($key, $value); - case 'uns': - $key = $this->_underscore(substr($method, 3)); - return $this->unsetData($key); - case 'has': - $key = $this->_underscore(substr($method, 3)); - return isset($this->_data[$key]); - } - throw new \Magento\Framework\Exception\LocalizedException( - new \Magento\Framework\Phrase('Invalid method %1::%2(%3)', [get_class($this), $method, print_r($args, 1)]) - ); - } - - /** - * Checks whether the object is empty - * - * @return bool - */ - public function isEmpty() - { - if (empty($this->_data)) { - return true; - } - return false; - } - - /** - * Converts field names for setters and getters - * - * $this->setMyField($value) === $this->setData('my_field', $value) - * Uses cache to eliminate unnecessary preg_replace - * - * @param string $name - * @return string - */ - protected function _underscore($name) - { - if (isset(self::$_underscoreCache[$name])) { - return self::$_underscoreCache[$name]; - } - $result = strtolower(trim(preg_replace('/([A-Z]|[0-9]+)/', "_$1", $name), '_')); - self::$_underscoreCache[$name] = $result; - return $result; - } - - /** - * Convert object data into string with defined keys and values. - * - * Example: key1="value1" key2="value2" ... - * - * @param array $keys array of accepted keys - * @param string $valueSeparator separator between key and value - * @param string $fieldSeparator separator between key/value pairs - * @param string $quote quoting sign - * @return string - */ - public function serialize($keys = [], $valueSeparator = '=', $fieldSeparator = ' ', $quote = '"') - { - $data = []; - if (empty($keys)) { - $keys = array_keys($this->_data); - } - - foreach ($this->_data as $key => $value) { - if (in_array($key, $keys)) { - $data[] = $key . $valueSeparator . $quote . $value . $quote; - } - } - $res = implode($fieldSeparator, $data); - return $res; - } - - /** - * Present object data as string in debug mode - * - * @param mixed $data - * @param array &$objects - * @return array - */ - public function debug($data = null, &$objects = []) - { - if ($data === null) { - $hash = spl_object_hash($this); - if (!empty($objects[$hash])) { - return '*** RECURSION ***'; - } - $objects[$hash] = true; - $data = $this->getData(); - } - $debug = []; - foreach ($data as $key => $value) { - if (is_scalar($value)) { - $debug[$key] = $value; - } elseif (is_array($value)) { - $debug[$key] = $this->debug($value, $objects); - } elseif ($value instanceof \Magento\Framework\Object) { - $debug[$key . ' (' . get_class($value) . ')'] = $value->debug(null, $objects); - } - } - return $debug; - } - - /** - * Implementation of \ArrayAccess::offsetSet() - * - * @param string $offset - * @param mixed $value - * @return void - * @link http://www.php.net/manual/en/arrayaccess.offsetset.php - */ - public function offsetSet($offset, $value) - { - $this->_data[$offset] = $value; - } - - /** - * Implementation of \ArrayAccess::offsetExists() - * - * @param string $offset - * @return bool - * @link http://www.php.net/manual/en/arrayaccess.offsetexists.php - */ - public function offsetExists($offset) - { - return isset($this->_data[$offset]) || array_key_exists($offset, $this->_data); - } - - /** - * Implementation of \ArrayAccess::offsetUnset() - * - * @param string $offset - * @return void - * @link http://www.php.net/manual/en/arrayaccess.offsetunset.php - */ - public function offsetUnset($offset) - { - unset($this->_data[$offset]); - } - - /** - * Implementation of \ArrayAccess::offsetGet() - * - * @param string $offset - * @return mixed - * @link http://www.php.net/manual/en/arrayaccess.offsetget.php - */ - public function offsetGet($offset) - { - if (isset($this->_data[$offset])) { - return $this->_data[$offset]; - } - return null; - } -} diff --git a/lib/internal/Magento/Framework/Object/Cache.php b/lib/internal/Magento/Framework/Object/Cache.php deleted file mode 100644 index 911eaf0749c..00000000000 --- a/lib/internal/Magento/Framework/Object/Cache.php +++ /dev/null @@ -1,476 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Object; - -/** - * Object Cache - * - * Stores objects for reuse, cleanup and to avoid circular references - * - * @author Magento Core Team <core@magentocommerce.com> - */ -class Cache -{ - /** - * Singleton instance - * - * @var \Magento\Framework\Object\Cache - */ - protected static $_instance; - - /** - * Running object index for anonymous objects - * - * @var integer - */ - protected $_idx = 0; - - /** - * Array of objects - * - * @var array of objects - */ - protected $_objects = []; - - /** - * SPL object hashes - * - * @var array - */ - protected $_hashes = []; - - /** - * SPL hashes by object - * - * @var array - */ - protected $_objectHashes = []; - - /** - * Objects by tags for cleanup - * - * @var array 2D - */ - protected $_tags = []; - - /** - * Tags by objects - * - * @var array 2D - */ - protected $_objectTags = []; - - /** - * References to objects - * - * @var array - */ - protected $_references = []; - - /** - * References by object - * - * @var array 2D - */ - protected $_objectReferences = []; - - /** - * Debug data such as backtrace per class - * - * @var array - */ - protected $_debug = []; - - /** - * Singleton factory - * - * @return \Magento\Framework\Object\Cache - */ - public static function singleton() - { - if (!self::$_instance) { - self::$_instance = new self(); - } - return self::$_instance; - } - - /** - * Load an object from registry - * - * @param string|object $idx - * @param object $default - * @return object - */ - public function load($idx, $default = null) - { - if (isset($this->_references[$idx])) { - $idx = $this->_references[$idx]; - } - if (isset($this->_objects[$idx])) { - return $this->_objects[$idx]; - } - return $default; - } - - /** - * Save an object entry - * - * @param object $object - * @param string $idx - * @param array|string $tags - * @return string - * @throws \Magento\Framework\Exception\LocalizedException - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) - */ - public function save($object, $idx = null, $tags = null) - { - //\Magento\Framework\Profiler::start('OBJECT_SAVE'); - if (!is_object($object)) { - return false; - } - - $hash = spl_object_hash($object); - if ($idx !== null && strpos($idx, '{')) { - $idx = str_replace('{hash}', $hash, $idx); - } - if (isset($this->_hashes[$hash])) { - //throw new \Exception('test'); - if ($idx !== null) { - $this->_references[$idx] = $this->_hashes[$hash]; - } - return $this->_hashes[$hash]; - } - - if ($idx === null) { - $idx = '#' . ++$this->_idx; - } - - if (isset($this->_objects[$idx])) { - throw new \Magento\Framework\Exception\LocalizedException( - new \Magento\Framework\Phrase( - 'Object already exists in registry (%1). Old object class: %2, new object class: %3', - [$idx, get_class($this->_objects[$idx]), get_class($object)] - ) - ); - } - - $this->_objects[$idx] = $object; - - $this->_hashes[$hash] = $idx; - $this->_objectHashes[$idx] = $hash; - - if (is_string($tags)) { - $this->_tags[$tags][$idx] = true; - $this->_objectTags[$idx][$tags] = true; - } elseif (is_array($tags)) { - foreach ($tags as $t) { - $this->_tags[$t][$idx] = true; - $this->_objectTags[$idx][$t] = true; - } - } - //\Magento\Framework\Profiler::stop('OBJECT_SAVE'); - - return $idx; - } - - /** - * Add a reference to an object - * - * @param string|array $refName - * @param string $idx - * @return bool|void - * @throws \Magento\Framework\Exception\LocalizedException - */ - public function reference($refName, $idx) - { - if (is_array($refName)) { - foreach ($refName as $ref) { - $this->reference($ref, $idx); - } - return; - } - - if (isset($this->_references[$refName])) { - throw new \Magento\Framework\Exception\LocalizedException( - new \Magento\Framework\Phrase( - 'The reference already exists: %1. New index: %2, old index: %3', - [$refName, $idx, $this->_references[$refName]] - ) - ); - } - $this->_references[$refName] = $idx; - $this->_objectReferences[$idx][$refName] = true; - - return true; - } - - /** - * Delete an object from registry - * - * @param string|object $idx - * @return boolean - */ - public function delete($idx) - { - //\Magento\Framework\Profiler::start("OBJECT_DELETE"); - if (is_object($idx)) { - $idx = $this->find($idx); - if (false === $idx) { - //\Magento\Framework\Profiler::stop("OBJECT_DELETE"); - return false; - } - unset($this->_objects[$idx]); - //\Magento\Framework\Profiler::stop("OBJECT_DELETE"); - return false; - } elseif (!isset($this->_objects[$idx])) { - //\Magento\Framework\Profiler::stop("OBJECT_DELETE"); - return false; - } - - unset($this->_objects[$idx]); - - unset($this->_hashes[$this->_objectHashes[$idx]], $this->_objectHashes[$idx]); - - if (isset($this->_objectTags[$idx])) { - foreach ($this->_objectTags[$idx] as $t => $dummy) { - unset($this->_tags[$t][$idx]); - } - unset($this->_objectTags[$idx]); - } - - if (isset($this->_objectReferences[$idx])) { - foreach ($this->_references as $r => $dummy) { - unset($this->_references[$r]); - } - unset($this->_objectReferences[$idx]); - } - //\Magento\Framework\Profiler::stop("OBJECT_DELETE"); - - return true; - } - - /** - * Cleanup by class name for objects of subclasses too - * - * @param string $class - * @return void - */ - public function deleteByClass($class) - { - foreach ($this->_objects as $idx => $object) { - if ($object instanceof $class) { - $this->delete($idx); - } - } - } - - /** - * Cleanup objects by tags - * - * @param array|string $tags - * @return true - * @SuppressWarnings(PHPMD.UnusedLocalVariable) - */ - public function deleteByTags($tags) - { - if (is_string($tags)) { - $tags = [$tags]; - } - foreach ($tags as $t) { - foreach ($this->_tags[$t] as $idx => $dummy) { - $this->delete($idx); - } - } - return true; - } - - /** - * Check whether object id exists in registry - * - * @param string $idx - * @return boolean - */ - public function has($idx) - { - return isset($this->_objects[$idx]) || isset($this->_references[$idx]); - } - - /** - * Find an object id - * - * @param object $object - * @return string|boolean - */ - public function find($object) - { - foreach ($this->_objects as $idx => $obj) { - if ($object === $obj) { - return $idx; - } - } - return false; - } - - /** - * Find objects by ids - * - * @param string[] $ids - * @return array - */ - public function findByIds($ids) - { - $objects = []; - foreach ($this->_objects as $idx => $obj) { - if (in_array($idx, $ids)) { - $objects[$idx] = $obj; - } - } - return $objects; - } - - /** - * Find object by hash - * - * @param string $hash - * @return object - */ - public function findByHash($hash) - { - return isset($this->_hashes[$hash]) ? $this->_objects[$this->_hashes[$hash]] : null; - } - - /** - * Find objects by tags - * - * @param array|string $tags - * @return array - * @SuppressWarnings(PHPMD.UnusedLocalVariable) - */ - public function findByTags($tags) - { - if (is_string($tags)) { - $tags = [$tags]; - } - $objects = []; - foreach ($tags as $t) { - foreach ($this->_tags[$t] as $idx => $dummy) { - if (isset($objects[$idx])) { - continue; - } - $objects[$idx] = $this->load($idx); - } - } - return $objects; - } - - /** - * Find by class name for objects of subclasses too - * - * @param string $class - * @return array - */ - public function findByClass($class) - { - $objects = []; - foreach ($this->_objects as $idx => $object) { - if ($object instanceof $class) { - $objects[$idx] = $object; - } - } - return $objects; - } - - /** - * Debug - * - * @param string $idx - * @param object|null $object - * @return void - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function debug($idx, $object = null) - { - $bt = debug_backtrace(); - $debug = []; - foreach ($bt as $i => $step) { - $debug[$i] = [ - 'file' => isset($step['file']) ? $step['file'] : null, - 'line' => isset($step['line']) ? $step['line'] : null, - 'function' => isset($step['function']) ? $step['function'] : null, - ]; - } - $this->_debug[$idx] = $debug; - } - - /** - * Return debug information by ids - * - * @param array|string $ids - * @return array - */ - public function debugByIds($ids) - { - if (is_string($ids)) { - $ids = [$ids]; - } - $debug = []; - foreach ($ids as $idx) { - $debug[$idx] = $this->_debug[$idx]; - } - return $debug; - } - - /** - * Get all objects - * - * @return array - */ - public function getAllObjects() - { - return $this->_objects; - } - - /** - * Get all tags - * - * @return array - */ - public function getAllTags() - { - return $this->_tags; - } - - /** - * Get all tags by object - * - * @return array - */ - public function getAllTagsByObject() - { - return $this->_objectTags; - } - - /** - * Get all references - * - * @return array - */ - public function getAllReferences() - { - return $this->_references; - } - - /** - * Get all references by object - * - * @return array - */ - public function getAllReferencesByObject() - { - return $this->_referencesByObject; - } -} diff --git a/lib/internal/Magento/Framework/Object/Copy.php b/lib/internal/Magento/Framework/Object/Copy.php deleted file mode 100644 index 6217a5ae524..00000000000 --- a/lib/internal/Magento/Framework/Object/Copy.php +++ /dev/null @@ -1,186 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -/** - * Utility class for copying data sets between objects - */ -namespace Magento\Framework\Object; - -class Copy -{ - /** - * @var \Magento\Framework\Object\Copy\Config - */ - protected $_fieldsetConfig; - - /** - * Core event manager proxy - * - * @var \Magento\Framework\Event\ManagerInterface - */ - protected $_eventManager = null; - - /** - * @param \Magento\Framework\Event\ManagerInterface $eventManager - * @param \Magento\Framework\Object\Copy\Config $fieldsetConfig - */ - public function __construct( - \Magento\Framework\Event\ManagerInterface $eventManager, - \Magento\Framework\Object\Copy\Config $fieldsetConfig - ) { - $this->_eventManager = $eventManager; - $this->_fieldsetConfig = $fieldsetConfig; - } - - /** - * Copy data from object|array to object|array containing fields from fieldset matching an aspect. - * - * Contents of $aspect are a field name in target object or array. - * If targetField attribute is not provided - will be used the same name as in the source object or array. - * - * @param string $fieldset - * @param string $aspect - * @param array|\Magento\Framework\Object $source - * @param array|\Magento\Framework\Object $target - * @param string $root - * @return array|\Magento\Framework\Object|null the value of $target - * - * @api - */ - public function copyFieldsetToTarget($fieldset, $aspect, $source, $target, $root = 'global') - { - if (!$this->_isFieldsetInputValid($source, $target)) { - return null; - } - $fields = $this->_fieldsetConfig->getFieldset($fieldset, $root); - if ($fields === null) { - return $target; - } - $targetIsArray = is_array($target); - - foreach ($fields as $code => $node) { - if (empty($node[$aspect])) { - continue; - } - - $value = $this->_getFieldsetFieldValue($source, $code); - - $targetCode = (string)$node[$aspect]; - $targetCode = $targetCode == '*' ? $code : $targetCode; - - if ($targetIsArray) { - $target[$targetCode] = $value; - } else { - $target->setDataUsingMethod($targetCode, $value); - } - } - - $target = $this->dispatchCopyFieldSetEvent($fieldset, $aspect, $source, $target, $root, $targetIsArray); - - return $target; - } - - /** - * Dispatch copy fieldset event - * - * @param string $fieldset - * @param string $aspect - * @param array|\Magento\Framework\Object $source - * @param array|\Magento\Framework\Object $target - * @param string $root - * @param bool $targetIsArray - * @return \Magento\Framework\Object|mixed - */ - protected function dispatchCopyFieldSetEvent($fieldset, $aspect, $source, $target, $root, $targetIsArray) - { - $eventName = sprintf('core_copy_fieldset_%s_%s', $fieldset, $aspect); - if ($targetIsArray) { - $target = new \Magento\Framework\Object($target); - } - $this->_eventManager->dispatch( - $eventName, - ['target' => $target, 'source' => $source, 'root' => $root] - ); - if ($targetIsArray) { - $target = $target->getData(); - } - return $target; - } - - /** - * Get data from object|array to object|array containing fields - * from fieldset matching an aspect. - * - * @param string $fieldset - * @param string $aspect a field name - * @param array|\Magento\Framework\Object $source - * @param string $root - * @return array $data - * - * @api - */ - public function getDataFromFieldset($fieldset, $aspect, $source, $root = 'global') - { - if (!(is_array($source) || $source instanceof \Magento\Framework\Object)) { - return null; - } - $fields = $this->_fieldsetConfig->getFieldset($fieldset, $root); - if ($fields === null) { - return null; - } - - $data = []; - foreach ($fields as $code => $node) { - if (empty($node[$aspect])) { - continue; - } - - $value = $this->_getFieldsetFieldValue($source, $code); - - $targetCode = (string)$node[$aspect]; - $targetCode = $targetCode == '*' ? $code : $targetCode; - $data[$targetCode] = $value; - } - - return $data; - } - - /** - * Check if source and target are valid input for converting using fieldset - * - * @param array|\Magento\Framework\Object $source - * @param array|\Magento\Framework\Object $target - * @return bool - */ - protected function _isFieldsetInputValid($source, $target) - { - return (is_array( - $source - ) || $source instanceof \Magento\Framework\Object) && (is_array( - $target - ) || $target instanceof \Magento\Framework\Object); - } - - /** - * Get value of source by code - * - * @param \Magento\Framework\Object|array $source - * @param string $code - * @return mixed - * @throws \InvalidArgumentException - */ - protected function _getFieldsetFieldValue($source, $code) - { - if (is_array($source)) { - $value = isset($source[$code]) ? $source[$code] : null; - } elseif ($source instanceof \Magento\Framework\Object) { - $value = $source->getDataUsingMethod($code); - } else { - throw new \InvalidArgumentException('Source should be array or Magento Object'); - } - return $value; - } -} diff --git a/lib/internal/Magento/Framework/Object/Copy/Config.php b/lib/internal/Magento/Framework/Object/Copy/Config.php deleted file mode 100644 index 6a59dfb88ba..00000000000 --- a/lib/internal/Magento/Framework/Object/Copy/Config.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Object\Copy; - -class Config -{ - /** - * @var \Magento\Framework\Object\Copy\Config\Data - */ - protected $_dataStorage; - - /** - * @param \Magento\Framework\Object\Copy\Config\Data $dataStorage - */ - public function __construct(\Magento\Framework\Object\Copy\Config\Data $dataStorage) - { - $this->_dataStorage = $dataStorage; - } - - /** - * Get fieldsets by $path - * - * @param string $path - * @return array - */ - public function getFieldsets($path) - { - return $this->_dataStorage->get($path); - } - - /** - * Get the fieldset for an area - * - * @param string $name fieldset name - * @param string $root fieldset area, could be 'admin' - * @return null|array - */ - public function getFieldset($name, $root = 'global') - { - $fieldsets = $this->getFieldsets($root); - if (empty($fieldsets)) { - return null; - } - return isset($fieldsets[$name]) ? $fieldsets[$name] : null; - } -} diff --git a/lib/internal/Magento/Framework/Object/Copy/Config/Converter.php b/lib/internal/Magento/Framework/Object/Copy/Config/Converter.php deleted file mode 100644 index c5d201040a5..00000000000 --- a/lib/internal/Magento/Framework/Object/Copy/Config/Converter.php +++ /dev/null @@ -1,87 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Object\Copy\Config; - -class Converter implements \Magento\Framework\Config\ConverterInterface -{ - /** - * Convert dom node tree to array - * - * @param \DOMDocument $source - * @return array - */ - public function convert($source) - { - $fieldsets = []; - $xpath = new \DOMXPath($source); - /** @var \DOMNode $fieldset */ - foreach ($xpath->query('/config/scope') as $scope) { - $scopeId = $scope->attributes->getNamedItem('id')->nodeValue; - $fieldsets[$scopeId] = $this->_convertScope($scope); - } - return $fieldsets; - } - - /** - * Convert Scope node to Magento array - * - * @param \DOMNode $scope - * @return array - */ - protected function _convertScope($scope) - { - $result = []; - foreach ($scope->childNodes as $fieldset) { - if (!$fieldset instanceof \DOMElement) { - continue; - } - $fieldsetName = $fieldset->attributes->getNamedItem('id')->nodeValue; - $result[$fieldsetName] = $this->_convertFieldset($fieldset); - } - return $result; - } - - /** - * Convert Fieldset node to Magento array - * - * @param \DOMNode $fieldset - * @return array - */ - protected function _convertFieldset($fieldset) - { - $result = []; - foreach ($fieldset->childNodes as $field) { - if (!$field instanceof \DOMElement) { - continue; - } - $fieldName = $field->attributes->getNamedItem('name')->nodeValue; - $result[$fieldName] = $this->_convertField($field); - } - return $result; - } - - /** - * Convert Field node to Magento array - * - * @param \DOMNode $field - * @return array - */ - protected function _convertField($field) - { - $result = []; - foreach ($field->childNodes as $aspect) { - if (!$aspect instanceof \DOMElement) { - continue; - } - /** @var \DOMNamedNodeMap $aspectAttributes */ - $aspectAttributes = $aspect->attributes; - $aspectName = $aspectAttributes->getNamedItem('name')->nodeValue; - $targetField = $aspectAttributes->getNamedItem('targetField'); - $result[$aspectName] = $targetField === null ? '*' : $targetField->nodeValue; - } - return $result; - } -} diff --git a/lib/internal/Magento/Framework/Object/Copy/Config/Data.php b/lib/internal/Magento/Framework/Object/Copy/Config/Data.php deleted file mode 100644 index 4c75cd8db7a..00000000000 --- a/lib/internal/Magento/Framework/Object/Copy/Config/Data.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php -/** - * Fieldset configuration data container. Provides fieldset configuration data. - * - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Object\Copy\Config; - -class Data extends \Magento\Framework\Config\Data -{ -} diff --git a/lib/internal/Magento/Framework/Object/Copy/Config/Data/Proxy.php b/lib/internal/Magento/Framework/Object/Copy/Config/Data/Proxy.php deleted file mode 100644 index ea974307333..00000000000 --- a/lib/internal/Magento/Framework/Object/Copy/Config/Data/Proxy.php +++ /dev/null @@ -1,124 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Object\Copy\Config\Data; - -/** - * Proxy class for @see \Magento\Framework\Object\Copy\Config\Data - */ -class Proxy extends \Magento\Framework\Object\Copy\Config\Data -{ - /** - * Object Manager instance - * - * @var \Magento\Framework\ObjectManagerInterface - */ - protected $_objectManager = null; - - /** - * Proxied instance name - * - * @var string - */ - protected $_instanceName = null; - - /** - * Proxied instance - * - * @var \Magento\Framework\Object\Copy\Config\Data - */ - protected $_subject = null; - - /** - * Instance shareability flag - * - * @var bool - */ - protected $_isShared = null; - - /** - * Proxy constructor - * - * @param \Magento\Framework\ObjectManagerInterface $objectManager - * @param string $instanceName - * @param bool $shared - */ - public function __construct( - \Magento\Framework\ObjectManagerInterface $objectManager, - $instanceName = '\\Magento\\Framework\\Object\\Copy\\Config\\Data', - $shared = true - ) { - $this->_objectManager = $objectManager; - $this->_instanceName = $instanceName; - $this->_isShared = $shared; - } - - /** - * @return array - */ - public function __sleep() - { - return ['_subject', '_isShared']; - } - - /** - * Retrieve ObjectManager from global scope - * - * @return void - */ - public function __wakeup() - { - $this->_objectManager = \Magento\Framework\App\ObjectManager::getInstance(); - } - - /** - * Clone proxied instance - * - * @return void - */ - public function __clone() - { - $this->_subject = clone $this->_getSubject(); - } - - /** - * Get proxied instance - * - * @return \Magento\Framework\Object\Copy\Config\Data - */ - protected function _getSubject() - { - if (!$this->_subject) { - $this->_subject = true === $this->_isShared - ? $this->_objectManager->get($this->_instanceName) - : $this->_objectManager->create($this->_instanceName); - } - return $this->_subject; - } - - /** - * {@inheritdoc} - */ - public function merge(array $config) - { - return $this->_getSubject()->merge($config); - } - - /** - * {@inheritdoc} - */ - public function get($path = null, $default = null) - { - return $this->_getSubject()->get($path, $default); - } - - /** - * {@inheritdoc} - */ - public function reset() - { - return $this->_getSubject()->reset(); - } -} diff --git a/lib/internal/Magento/Framework/Object/Copy/Config/Reader.php b/lib/internal/Magento/Framework/Object/Copy/Config/Reader.php deleted file mode 100644 index 899975dbd1b..00000000000 --- a/lib/internal/Magento/Framework/Object/Copy/Config/Reader.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/** - * Fieldset configuration reader - * - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Object\Copy\Config; - -class Reader extends \Magento\Framework\Config\Reader\Filesystem -{ - /** - * List of identifier attributes for merging - * - * @var array - */ - protected $_idAttributes = [ - '/config/scope' => 'id', - '/config/scope/fieldset' => 'id', - '/config/scope/fieldset/field' => 'name', - '/config/scope/fieldset/field/aspect' => 'name', - ]; - - /** - * @param \Magento\Framework\Config\FileResolverInterface $fileResolver - * @param \Magento\Framework\Object\Copy\Config\Converter $converter - * @param \Magento\Framework\Config\SchemaLocatorInterface $schemaLocator - * @param \Magento\Framework\Config\ValidationStateInterface $validationState - * @param string $fileName - * @param array $idAttributes - * @param string $domDocumentClass - * @param string $defaultScope - */ - public function __construct( - \Magento\Framework\Config\FileResolverInterface $fileResolver, - \Magento\Framework\Object\Copy\Config\Converter $converter, - \Magento\Framework\Config\SchemaLocatorInterface $schemaLocator, - \Magento\Framework\Config\ValidationStateInterface $validationState, - $fileName = 'fieldset.xml', - $idAttributes = [], - $domDocumentClass = 'Magento\Framework\Config\Dom', - $defaultScope = 'global' - ) { - parent::__construct( - $fileResolver, - $converter, - $schemaLocator, - $validationState, - $fileName, - $idAttributes, - $domDocumentClass, - $defaultScope - ); - } -} diff --git a/lib/internal/Magento/Framework/Object/Copy/Config/SchemaLocator.php b/lib/internal/Magento/Framework/Object/Copy/Config/SchemaLocator.php deleted file mode 100644 index 5f7f4d681ee..00000000000 --- a/lib/internal/Magento/Framework/Object/Copy/Config/SchemaLocator.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php -/** - * Locator for fieldset XSD schemas. - * - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Object\Copy\Config; - -use Magento\Framework\App\Filesystem\DirectoryList; -use Magento\Framework\Filesystem; - -class SchemaLocator implements \Magento\Framework\Config\SchemaLocatorInterface -{ - /** - * Path to corresponding XSD file with validation rules for merged config - * - * @var string - */ - protected $_schema; - - /** - * Path to corresponding XSD file with validation rules for separate config files - * - * @var string - */ - protected $_perFileSchema; - - /** - * @param Filesystem $filesystem - * @param string $schema - * @param string $perFileSchema - */ - public function __construct(Filesystem $filesystem, $schema, $perFileSchema) - { - $rootDir = $filesystem->getDirectoryRead(DirectoryList::ROOT); - $this->_schema = $rootDir->getAbsolutePath($schema); - $this->_perFileSchema = $rootDir->getAbsolutePath($perFileSchema); - } - - /** - * Get path to merged config schema - * - * @return string|null - */ - public function getSchema() - { - return $this->_schema; - } - - /** - * Get path to per file validation schema - * - * @return string|null - */ - public function getPerFileSchema() - { - return $this->_perFileSchema; - } -} diff --git a/lib/internal/Magento/Framework/Object/Factory.php b/lib/internal/Magento/Framework/Object/Factory.php deleted file mode 100644 index b1efd679d40..00000000000 --- a/lib/internal/Magento/Framework/Object/Factory.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Object; - -class Factory -{ - /** - * Create Magento object with provided params - * - * @param array $data - * @return \Magento\Framework\Object - */ - public function create(array $data = []) - { - return new \Magento\Framework\Object($data); - } -} diff --git a/lib/internal/Magento/Framework/Object/IdentityInterface.php b/lib/internal/Magento/Framework/Object/IdentityInterface.php deleted file mode 100644 index 2a3714d574f..00000000000 --- a/lib/internal/Magento/Framework/Object/IdentityInterface.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Object; - -/** - * Interface for - * 1. models which require cache refresh when it is created/updated/deleted - * 2. blocks which render this information to front-end - */ -interface IdentityInterface -{ - /** - * Return unique ID(s) for each object in system - * - * @return array - */ - public function getIdentities(); -} diff --git a/lib/internal/Magento/Framework/Object/KeyValueObjectInterface.php b/lib/internal/Magento/Framework/Object/KeyValueObjectInterface.php deleted file mode 100644 index 9ddf818234a..00000000000 --- a/lib/internal/Magento/Framework/Object/KeyValueObjectInterface.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Framework\Object; - -interface KeyValueObjectInterface -{ - const KEY = 'key'; - const VALUE = 'value'; - - /** - * Get object key - * - * @return string - */ - public function getKey(); - - /** - * Set object key - * - * @param string $key - * @return $this - */ - public function setKey($key); - - /** - * Get object value - * - * @return string - */ - public function getValue(); - - /** - * Set object value - * - * @param string $value - * @return $this - */ - public function setValue($value); -} diff --git a/lib/internal/Magento/Framework/Object/Mapper.php b/lib/internal/Magento/Framework/Object/Mapper.php deleted file mode 100644 index ffa9bcb041e..00000000000 --- a/lib/internal/Magento/Framework/Object/Mapper.php +++ /dev/null @@ -1,132 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -/** - * Utility class for mapping data between objects or arrays - */ -namespace Magento\Framework\Object; - -/** - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) - */ -class Mapper -{ - /** - * Convert data from source to target item using map array - * - * Will get or set data with generic or magic, or specified Magento Object methods, or with array keys - * from or to \Magento\Framework\Object or array - * :) - * - * Map must either be associative array of keys from=>to - * or a numeric array of keys, assuming from = to - * - * Defaults must be assoc array of keys => values. Target will get default, if the value is not present in source - * If the source has getter defined instead of magic method, the value will be taken only if not empty - * - * Callbacks explanation (when $from or $to is not array): - * for $from: - * <\Magento\Framework\Object> => $from->getData($key) (default) - * array(<\Magento\Framework\Object>, <method>) => $from->$method($key) - * for $to (makes sense only for \Magento\Framework\Object): - * <\Magento\Framework\Object> => $from->setData($key, <from>) - * array(<\Magento\Framework\Object>, <method>) => $from->$method($key, <from>) - * - * @param array|\Magento\Framework\Object|callback $from - * @param array|\Magento\Framework\Object|callback $to - * @param array $map - * @param array $defaults - * @return array|object - */ - public static function &accumulateByMap($from, $to, array $map, array $defaults = []) - { - $get = 'getData'; - if (is_array( - $from - ) && isset( - $from[0] - ) && is_object( - $from[0] - ) && isset( - $from[1] - ) && is_string( - $from[1] - ) && is_callable( - $from - ) - ) { - list($from, $get) = $from; - } - $fromIsArray = is_array($from); - $fromIsVO = $from instanceof \Magento\Framework\Object; - - $set = 'setData'; - if (is_array( - $to - ) && isset( - $to[0] - ) && is_object( - $to[0] - ) && isset( - $to[1] - ) && is_string( - $to[1] - ) && is_callable( - $to - ) - ) { - list($to, $set) = $to; - } - $toIsArray = is_array($to); - $toIsVO = $to instanceof \Magento\Framework\Object; - - foreach ($map as $keyFrom => $keyTo) { - if (!is_string($keyFrom)) { - $keyFrom = $keyTo; - } - if ($fromIsArray) { - if (array_key_exists($keyFrom, $from)) { - if ($toIsArray) { - $to[$keyTo] = $from[$keyFrom]; - } elseif ($toIsVO) { - $to->{$set}($keyTo, $from[$keyFrom]); - } - } - } elseif ($fromIsVO) { - // get value if (any) value is found as in magic data or a non-empty value with declared getter - $value = null; - if ($shouldGet = $from->hasData($keyFrom)) { - $value = $from->{$get}($keyFrom); - } elseif (method_exists($from, $get)) { - $value = $from->{$get}($keyFrom); - if ($value) { - $shouldGet = true; - } - } - if ($shouldGet) { - if ($toIsArray) { - $to[$keyTo] = $value; - } elseif ($toIsVO) { - $to->{$set}($keyTo, $value); - } - } - } - } - foreach ($defaults as $keyTo => $value) { - if ($toIsArray) { - if (!isset($to[$keyTo])) { - $to[$keyTo] = $value; - } - } elseif ($toIsVO) { - if (!$to->hasData($keyTo)) { - $to->{$set}($keyTo, $value); - } - } - } - return $to; - } -} diff --git a/lib/internal/Magento/Framework/Object/README.md b/lib/internal/Magento/Framework/Object/README.md deleted file mode 100644 index 624c4e759be..00000000000 --- a/lib/internal/Magento/Framework/Object/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Object - -**Object** library contains functionality for mapping, management and the creation of dynamic member objects. -This also includes the objects which merge, read and make available xml configurations. \ No newline at end of file diff --git a/lib/internal/Magento/Framework/Object/Test/Unit/CacheTest.php b/lib/internal/Magento/Framework/Object/Test/Unit/CacheTest.php deleted file mode 100644 index 6e66bb3f370..00000000000 --- a/lib/internal/Magento/Framework/Object/Test/Unit/CacheTest.php +++ /dev/null @@ -1,143 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Framework\Object\Test\Unit; - -class CacheTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Framework\Object\Cache - */ - protected $cache; - - protected function setUp() - { - $this->cache = new \Magento\Framework\Object\Cache(); - } - - public function testSaveWhenArgumentIsNotObject() - { - $this->assertEquals(false, $this->cache->save('string')); - } - - /** - * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Object already exists in registry (#1). Old object class: stdClass - */ - public function testSaveWhenObjectAlreadyExistsInRegistry() - { - $object = new \stdClass(); - $hash = spl_object_hash($object); - $newIdx = 'idx' . $hash; - $this->assertEquals($newIdx, $this->cache->save($object, 'idx{hash}', ['tags_array'])); - $this->assertEquals([$newIdx => $object], $this->cache->findByClass('stdClass')); - $this->assertEquals([$newIdx => $object], $this->cache->getAllObjects()); - $this->assertEquals($newIdx, $this->cache->find($object)); - $this->assertEquals([$newIdx => $object], $this->cache->findByIds([$newIdx])); - $objectTwo = new \stdClass(); - $this->assertEquals('#1', $this->cache->save($objectTwo, null, 'tags_string')); - $objectThree = new \stdClass(); - $this->cache->save($objectThree, '#1'); - } - - public function testSaveAndDeleteWhenHashAlreadyExist() - { - $object = new \stdClass(); - $hash = spl_object_hash($object); - $this->assertEquals('idx' . $hash, $this->cache->save($object, 'idx{hash}')); - $this->assertEquals('idx' . $hash, $this->cache->save($object)); - $this->assertTrue($this->cache->delete('idx' . $hash)); - $this->assertFalse($this->cache->delete('idx' . $hash)); - } - - /** - * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage The reference already exists: refName. New index: idx, old index: idx - */ - public function testReferenceWhenReferenceAlreadyExist() - { - $refName = ['refName', 'refName']; - $this->cache->reference($refName, 'idx'); - } - - public function testReferenceWhenReferenceEmpty() - { - $this->assertEquals(null, $this->cache->reference([], 'idx')); - } - - public function testLoadWhenReferenceAndObjectAlreadyExists() - { - $idx = 'idx'; - $this->cache->reference('refName', $idx); - $object = new \stdClass(); - $hash = spl_object_hash($object); - $this->assertEquals(null, $this->cache->findByHash($hash)); - $this->cache->save($object, $idx); - $this->assertEquals($object, $this->cache->load($idx)); - $this->assertEquals(true, $this->cache->has($idx)); - $this->assertEquals($object, $this->cache->findByHash($hash)); - $this->assertEquals(['refName' => 'idx'], $this->cache->getAllReferences()); - } - - public function testLoad() - { - $this->assertEquals('default', $this->cache->load('idx', 'default')); - } - - public function testDeleteWhenIdxIsObject() - { - $object = new \stdClass(); - $this->cache->save($object, 'idx{hash}'); - $this->assertFalse($this->cache->delete($object)); - $this->cache->save($object, false); - $this->assertFalse($this->cache->delete($object)); - } - - public function testDeleteIfReferencesExists() - { - $this->cache->reference('refName', 'idx'); - $object = new \stdClass(); - $this->cache->save($object, 'idx'); - $this->assertTrue($this->cache->delete('idx')); - } - - public function testDeleteByClass() - { - $object = new \stdClass(); - $this->cache->save($object, 'idx'); - $this->cache->deleteByClass('stdClass'); - $this->assertFalse($this->cache->find($object)); - } - - public function testDebug() - { - $object = new \stdClass(); - $hash = spl_object_hash($object); - $newIdx = 'idx' . $hash; - $this->assertEquals($newIdx, $this->cache->save($object, 'idx{hash}')); - $this->cache->debug($newIdx); - $this->assertTrue(array_key_exists($newIdx, $this->cache->debugByIds($newIdx))); - } - - public function testGetAndDeleteTags() - { - $object = new \stdClass(); - $hash = spl_object_hash($object); - $newIdx = 'idx' . $hash; - $tags = ['tags_array' => [$newIdx => true]]; - $tagsByObj = [$newIdx => ['tags_array' => true]]; - $this->assertEquals($newIdx, $this->cache->save($object, 'idx{hash}', ['tags_array'])); - $this->assertEquals($tags, $this->cache->getAllTags()); - $this->assertEquals([$newIdx => $object], $this->cache->findByTags('tags_array')); - $this->assertEquals($tagsByObj, $this->cache->getAllTagsByObject()); - $this->assertTrue($this->cache->deleteByTags('tags_array')); - } - - public function testSinglton() - { - $this->assertEquals($this->cache, $this->cache->singleton()); - } -} diff --git a/lib/internal/Magento/Framework/Object/Test/Unit/Copy/Config/ConverterTest.php b/lib/internal/Magento/Framework/Object/Test/Unit/Copy/Config/ConverterTest.php deleted file mode 100644 index b32a4064c20..00000000000 --- a/lib/internal/Magento/Framework/Object/Test/Unit/Copy/Config/ConverterTest.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php -/** - * \Magento\Framework\Object\Copy\Config\Converter - * - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Object\Test\Unit\Copy\Config; - -class ConverterTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Object\Copy\Config\Converter - */ - protected $_model; - - public function setUp() - { - $this->_model = new \Magento\Framework\Object\Copy\Config\Converter(); - } - - public function testConvert() - { - $dom = new \DOMDocument(); - $xmlFile = __DIR__ . '/_files/fieldset.xml'; - $dom->loadXML(file_get_contents($xmlFile)); - - $convertedFile = __DIR__ . '/_files/fieldset_config.php'; - $expectedResult = include $convertedFile; - $this->assertEquals($expectedResult, $this->_model->convert($dom)); - } -} diff --git a/lib/internal/Magento/Framework/Object/Test/Unit/Copy/Config/SchemaLocatorTest.php b/lib/internal/Magento/Framework/Object/Test/Unit/Copy/Config/SchemaLocatorTest.php deleted file mode 100644 index 853c441ea3c..00000000000 --- a/lib/internal/Magento/Framework/Object/Test/Unit/Copy/Config/SchemaLocatorTest.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Framework\Object\Test\Unit\Copy\Config; - -use Magento\Framework\App\Filesystem\DirectoryList; - -class SchemaLocatorTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Framework\Object\Copy\Config\SchemaLocator - */ - protected $model; - - protected function setUp() - { - $rootDirMock = $this->getMockForAbstractClass('\Magento\Framework\Filesystem\Directory\ReadInterface'); - $rootDirMock->expects($this->exactly(2)) - ->method('getAbsolutePath') - ->will($this->returnCallback(function ($path) { - return 'schema_dir/' . $path; - })); - $fileSystemMock = $this->getMock( - 'Magento\Framework\Filesystem', - [], - [], - '', - false - ); - $fileSystemMock->expects($this->once()) - ->method('getDirectoryRead') - ->with(DirectoryList::ROOT) - ->will($this->returnValue($rootDirMock)); - - $this->model = new \Magento\Framework\Object\Copy\Config\SchemaLocator( - $fileSystemMock, - 'schema.xsd', - 'perFileSchema.xsd' - ); - } - - public function testGetSchema() - { - $this->assertEquals('schema_dir/schema.xsd', $this->model->getSchema()); - } - - public function testGetPerFileSchema() - { - $this->assertEquals('schema_dir/perFileSchema.xsd', $this->model->getPerFileSchema()); - } -} diff --git a/lib/internal/Magento/Framework/Object/Test/Unit/Copy/Config/_files/fieldset.xml b/lib/internal/Magento/Framework/Object/Test/Unit/Copy/Config/_files/fieldset.xml deleted file mode 100644 index 1b534231b98..00000000000 --- a/lib/internal/Magento/Framework/Object/Test/Unit/Copy/Config/_files/fieldset.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../../../../../lib/internal/Magento/Framework/Object/etc/fieldset.xsd"> - <scope id="global"> - <fieldset id="sales_convert_quote_address"> - <field name="company"> - <aspect name="to_order_address" /> - <aspect name="to_customer_address" /> - </field> - <field name="street_full"> - <aspect name="to_order_address" targetField="street" /> - </field> - <field name="street"> - <aspect name="to_customer_address" /> - </field> - </fieldset> - </scope> -</config> diff --git a/lib/internal/Magento/Framework/Object/Test/Unit/Copy/Config/_files/fieldset_config.php b/lib/internal/Magento/Framework/Object/Test/Unit/Copy/Config/_files/fieldset_config.php deleted file mode 100644 index 38e39b0576c..00000000000 --- a/lib/internal/Magento/Framework/Object/Test/Unit/Copy/Config/_files/fieldset_config.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -return [ - 'global' => [ - 'sales_convert_quote_address' => [ - 'company' => ['to_order_address' => '*', 'to_customer_address' => '*'], - 'street_full' => ['to_order_address' => 'street'], - 'street' => ['to_customer_address' => '*'], - ], - ] -]; diff --git a/lib/internal/Magento/Framework/Object/Test/Unit/Copy/ConfigTest.php b/lib/internal/Magento/Framework/Object/Test/Unit/Copy/ConfigTest.php deleted file mode 100644 index 884a77ef08c..00000000000 --- a/lib/internal/Magento/Framework/Object/Test/Unit/Copy/ConfigTest.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php -/** - * \Magento\Framework\Object\Copy\Config - * - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Object\Test\Unit\Copy; - -class ConfigTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Framework\Object\Copy\Config\Data|PHPUnit_Framework_MockObject_MockObject - */ - protected $_storageMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Object\Copy\Config - */ - protected $_model; - - public function setUp() - { - $this->_storageMock = $this->getMock( - 'Magento\Framework\Object\Copy\Config\Data', - ['get'], - [], - '', - false - ); - - $this->_model = new \Magento\Framework\Object\Copy\Config($this->_storageMock); - } - - public function testGetFieldsets() - { - $expected = [ - 'sales_convert_quote_address' => [ - 'company' => ['to_order_address' => '*', 'to_customer_address' => '*'], - 'street_full' => ['to_order_address' => 'street'], - 'street' => ['to_customer_address' => '*'], - ], - ]; - $this->_storageMock->expects($this->once())->method('get')->will($this->returnValue($expected)); - $result = $this->_model->getFieldsets('global'); - $this->assertEquals($expected, $result); - } - - public function testGetFieldset() - { - $expectedFieldset = ['aspect' => 'firstAspect']; - $fieldsets = ['test' => $expectedFieldset, 'test_second' => ['aspect' => 'secondAspect']]; - $this->_storageMock->expects($this->once())->method('get')->will($this->returnValue($fieldsets)); - $result = $this->_model->getFieldset('test'); - $this->assertEquals($expectedFieldset, $result); - } - - public function testGetFieldsetIfFieldsetIsEmpty() - { - $this->_storageMock->expects($this->once())->method('get') - ->will($this->returnValue([])); - $result = $this->_model->getFieldset('test'); - $this->assertEquals(null, $result); - } -} diff --git a/lib/internal/Magento/Framework/Object/Test/Unit/CopyTest.php b/lib/internal/Magento/Framework/Object/Test/Unit/CopyTest.php deleted file mode 100644 index 35f07349993..00000000000 --- a/lib/internal/Magento/Framework/Object/Test/Unit/CopyTest.php +++ /dev/null @@ -1,218 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Framework\Object\Test\Unit; - -class CopyTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Framework\Object\Copy - */ - protected $copy; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $fieldsetConfigMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $eventManagerMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $targetMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $sourceMock; - - protected function setUp() - { - $this->fieldsetConfigMock = $this->getMock('Magento\Framework\Object\Copy\Config', [], [], '', false); - $this->eventManagerMock = $this->getMock('Magento\Framework\Event\ManagerInterface'); - $this->sourceMock = $this->getMock('Magento\Framework\Object', [], [], '', false); - $this->targetMock = $this->getMock('Magento\Framework\Object', [], [], '', false); - $this->copy = new \Magento\Framework\Object\Copy( - $this->eventManagerMock, - $this->fieldsetConfigMock - ); - } - - public function testCopyFieldsetToTargetWhenFieldsetInputInvalid() - { - $this->fieldsetConfigMock->expects($this->never())->method('getFieldset'); - $this->assertEquals( - null, - $this->copy->copyFieldsetToTarget('fieldset', 'aspect', [], 'target') - ); - } - - public function testCopyFieldsetToTargetWhenFieldIsNotExists() - { - $this->fieldsetConfigMock - ->expects($this->once()) - ->method('getFieldset') - ->with('fieldset', 'global') - ->will($this->returnValue(null)); - $this->eventManagerMock->expects($this->never())->method('dispatch'); - $this->assertEquals( - [$this->targetMock], - $this->copy->copyFieldsetToTarget('fieldset', 'aspect', $this->sourceMock, [$this->targetMock]) - ); - } - - public function testCopyFieldsetToTargetWhenFieldExists() - { - $fields['code']['node']['aspect'] = []; - $this->fieldsetConfigMock - ->expects($this->once()) - ->method('getFieldset') - ->with('fieldset', 'global') - ->will($this->returnValue($fields)); - - $eventName = sprintf('core_copy_fieldset_%s_%s', 'fieldset', 'aspect'); - $data = [ - 'target' => new \Magento\Framework\Object([$this->targetMock]), - 'source' => $this->sourceMock, - 'root' => 'global', - ]; - $this->eventManagerMock->expects($this->once())->method('dispatch')->with($eventName, $data); - $this->assertEquals( - [$this->targetMock], - $this->copy->copyFieldsetToTarget('fieldset', 'aspect', $this->sourceMock, [$this->targetMock]) - ); - } - - public function testCopyFieldsetToTargetWhenTargetNotArray() - { - $fields['code']['aspect'] = 'value'; - $this->fieldsetConfigMock - ->expects($this->once()) - ->method('getFieldset') - ->with('fieldset', 'global') - ->will($this->returnValue($fields)); - - $this->sourceMock - ->expects($this->once()) - ->method('getDataUsingMethod') - ->with('code') - ->will($this->returnValue('value')); - - $this->targetMock - ->expects($this->once()) - ->method('setDataUsingMethod') - ->with('value') - ->will($this->returnSelf()); - $eventName = sprintf('core_copy_fieldset_%s_%s', 'fieldset', 'aspect'); - $data = [ - 'target' => $this->targetMock, - 'source' => $this->sourceMock, - 'root' => 'global', - ]; - $this->eventManagerMock->expects($this->once())->method('dispatch')->with($eventName, $data); - $this->assertEquals( - $this->targetMock, - $this->copy->copyFieldsetToTarget('fieldset', 'aspect', $this->sourceMock, $this->targetMock) - ); - } - - public function testGetCopyFieldsetToTargetWhenTargetIsArray() - { - $fields['code']['aspect'] = 'value'; - $target['code'] = []; - $this->fieldsetConfigMock - ->expects($this->once()) - ->method('getFieldset') - ->with('fieldset', 'global') - ->will($this->returnValue($fields)); - - $this->sourceMock - ->expects($this->once()) - ->method('getDataUsingMethod') - ->with('code') - ->will($this->returnValue('value')); - - $this->targetMock - ->expects($this->never()) - ->method('setDataUsingMethod'); - $eventName = sprintf('core_copy_fieldset_%s_%s', 'fieldset', 'aspect'); - $newTarget = [ - 'code' => [], - 'value' => 'value', - ]; - $data = [ - 'target' => new \Magento\Framework\Object($newTarget), - 'source' => $this->sourceMock, - 'root' => 'global', - ]; - $this->eventManagerMock->expects($this->once())->method('dispatch')->with($eventName, $data); - $this->assertEquals( - $newTarget, - $this->copy->copyFieldsetToTarget('fieldset', 'aspect', $this->sourceMock, $target) - ); - } - - public function testGetDataFromFieldsetWhenSourceIsInvalid() - { - $this->fieldsetConfigMock->expects($this->never())->method('getFieldset'); - $this->assertNull($this->copy->getDataFromFieldset('fieldset', 'aspect', 'source')); - } - - public function testGetDataFromFieldsetWhenFieldsetDoesNotExist() - { - $this->fieldsetConfigMock - ->expects($this->once()) - ->method('getFieldset') - ->with('fieldset', 'global') - ->will($this->returnValue(null)); - $this->sourceMock - ->expects($this->never()) - ->method('getDataUsingMethod'); - $this->assertNull($this->copy->getDataFromFieldset('fieldset', 'aspect', $this->sourceMock)); - } - - public function testGetDataFromFieldsetWhenFieldExists() - { - $fields['code']['aspect'] = 'value'; - $this->fieldsetConfigMock - ->expects($this->once()) - ->method('getFieldset') - ->with('fieldset', 'global') - ->will($this->returnValue($fields)); - $this->sourceMock - ->expects($this->once()) - ->method('getDataUsingMethod') - ->with('code') - ->will($this->returnValue('value')); - - $this->assertEquals( - ['value' => 'value'], - $this->copy->getDataFromFieldset('fieldset', 'aspect', $this->sourceMock) - ); - } - - public function testGetDataFromFieldsetWhenFieldDoesNotExists() - { - $fields['code']['aspect'] = []; - $this->fieldsetConfigMock - ->expects($this->once()) - ->method('getFieldset') - ->with('fieldset', 'global') - ->will($this->returnValue($fields)); - $this->sourceMock - ->expects($this->never()) - ->method('getDataUsingMethod'); - - $this->assertEquals( - [], - $this->copy->getDataFromFieldset('fieldset', 'aspect', $this->sourceMock) - ); - } -} diff --git a/lib/internal/Magento/Framework/Object/Test/Unit/MapperTest.php b/lib/internal/Magento/Framework/Object/Test/Unit/MapperTest.php deleted file mode 100644 index 32c94af756c..00000000000 --- a/lib/internal/Magento/Framework/Object/Test/Unit/MapperTest.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Framework\Object\Test\Unit; - -class MapperTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Framework\Object\Mapper - */ - protected $mapper; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $fromMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $toMock; - - protected function setUp() - { - $this->fromMock = $this->getMock('Magento\Framework\Object', [], [], '', false); - $this->toMock = $this->getMock('Magento\Framework\Object', [], [], '', false); - $this->mapper = new \Magento\Framework\Object\Mapper(); - } - - public function testAccumulateByMapWhenToIsArrayFromIsObject() - { - $map['key'] = 'map_value'; - $to['key'] = 'from_value'; - $default['new_key'] = 'default_value'; - $this->fromMock->expects($this->once())->method('hasData')->with('key')->will($this->returnValue(true)); - $this->fromMock->expects($this->once())->method('getData')->with('key')->will($this->returnValue('from_value')); - $expected['key'] = 'from_value'; - $expected['map_value'] = 'from_value'; - $expected['new_key'] = 'default_value'; - $this->assertEquals($expected, $this->mapper->accumulateByMap($this->fromMock, $to, $map, $default)); - } - - public function testAccumulateByMapWhenToAndFromAreObjects() - { - $from = [ - $this->fromMock, - 'getData', - ]; - $to = [ - $this->toMock, - 'setData', - ]; - $default = [0]; - $map['key'] = ['value']; - $this->fromMock->expects($this->once())->method('hasData')->with('key')->will($this->returnValue(false)); - $this->fromMock->expects($this->once())->method('getData')->with('key')->will($this->returnValue(true)); - $this->assertEquals($this->toMock, $this->mapper->accumulateByMap($from, $to, $map, $default)); - } - - public function testAccumulateByMapWhenFromIsArrayToIsObject() - { - $map['key'] = 'map_value'; - $from['key'] = 'from_value'; - $default['new_key'] = 'default_value'; - $this->toMock->expects($this->exactly(2))->method('setData'); - $this->assertEquals($this->toMock, $this->mapper->accumulateByMap($from, $this->toMock, $map, $default)); - } - - public function testAccumulateByMapFromAndToAreArrays() - { - $from['value'] = 'from_value'; - $map[false] = 'value'; - $to['key'] = 'to_value'; - $default['new_key'] = 'value'; - $expected['key'] = 'to_value'; - $expected['value'] = 'from_value'; - $expected['new_key'] = 'value'; - $this->assertEquals($expected, $this->mapper->accumulateByMap($from, $to, $map, $default)); - } -} diff --git a/lib/internal/Magento/Framework/Object/etc/fieldset.xsd b/lib/internal/Magento/Framework/Object/etc/fieldset.xsd deleted file mode 100644 index ea259ad436c..00000000000 --- a/lib/internal/Magento/Framework/Object/etc/fieldset.xsd +++ /dev/null @@ -1,69 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:element name="config"> - <xs:annotation> - <xs:documentation> - Specifies a configuration. - </xs:documentation> - </xs:annotation> - <xs:complexType> - <xs:sequence minOccurs="0" maxOccurs="unbounded"> - <xs:element name="scope" type="scopeType"/> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:complexType name="scopeType"> - <xs:annotation> - <xs:documentation> - The definition of the current scope. - </xs:documentation> - </xs:annotation> - <xs:sequence> - <xs:element minOccurs="1" maxOccurs="unbounded" name="fieldset" type="fieldsetType"/> - </xs:sequence> - <xs:attribute name="id" type="xs:ID" use="required"/> - </xs:complexType> - - <xs:complexType name="fieldsetType"> - <xs:annotation> - <xs:documentation> - The set of fields which will be used to filter existing Magento Object data - </xs:documentation> - </xs:annotation> - <xs:sequence> - <xs:element minOccurs="1" maxOccurs="unbounded" name="field" type="fieldType"/> - </xs:sequence> - <xs:attribute name="id" type="xs:ID" use="required"/> - </xs:complexType> - - <xs:complexType name="fieldType"> - <xs:annotation> - <xs:documentation> - The name of a field used to extract data from an existing Magento Object - </xs:documentation> - </xs:annotation> - <xs:sequence> - <xs:element minOccurs="1" maxOccurs="unbounded" name="aspect" type="aspectType"/> - </xs:sequence> - <xs:attribute name="name" type="xs:token" use="required"/> - </xs:complexType> - - <xs:complexType name="aspectType"> - <xs:annotation> - <xs:documentation> - The name of an aspect associated with a field. If the targetField is populated, the field data will be - provided under the name specified by targetField. - </xs:documentation> - </xs:annotation> - <xs:attribute name="name" type="xs:token" use="required"/> - <xs:attribute name="targetField" type="xs:token" use="optional"/> - </xs:complexType> - -</xs:schema> \ No newline at end of file diff --git a/lib/internal/Magento/Framework/Object/etc/fieldset_file.xsd b/lib/internal/Magento/Framework/Object/etc/fieldset_file.xsd deleted file mode 100644 index 64dc7677c3e..00000000000 --- a/lib/internal/Magento/Framework/Object/etc/fieldset_file.xsd +++ /dev/null @@ -1,69 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:element name="config"> - <xs:annotation> - <xs:documentation> - Specifies a configuration. - </xs:documentation> - </xs:annotation> - <xs:complexType> - <xs:sequence minOccurs="0" maxOccurs="unbounded"> - <xs:element name="scope" type="scopeType"/> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:complexType name="scopeType"> - <xs:annotation> - <xs:documentation> - The definition of the current scope. - </xs:documentation> - </xs:annotation> - <xs:sequence> - <xs:element minOccurs="0" maxOccurs="unbounded" name="fieldset" type="fieldsetType"/> - </xs:sequence> - <xs:attribute name="id" type="xs:ID" use="required"/> - </xs:complexType> - - <xs:complexType name="fieldsetType"> - <xs:annotation> - <xs:documentation> - The set of fields which will be used to filter existing Magento Object data - </xs:documentation> - </xs:annotation> - <xs:sequence> - <xs:element minOccurs="0" maxOccurs="unbounded" name="field" type="fieldType"/> - </xs:sequence> - <xs:attribute name="id" type="xs:ID" use="required"/> - </xs:complexType> - - <xs:complexType name="fieldType"> - <xs:annotation> - <xs:documentation> - The name of a field used to extract data from an existing Magento Object - </xs:documentation> - </xs:annotation> - <xs:sequence> - <xs:element minOccurs="0" maxOccurs="unbounded" name="aspect" type="aspectType"/> - </xs:sequence> - <xs:attribute name="name" type="xs:token" use="required"/> - </xs:complexType> - - <xs:complexType name="aspectType"> - <xs:annotation> - <xs:documentation> - The name of an aspect associated with a field. If the targetField is populated, the field data will be - provided under the name specified by targetField. - </xs:documentation> - </xs:annotation> - <xs:attribute name="name" type="xs:token" use="required"/> - <xs:attribute name="targetField" type="xs:token" use="optional"/> - </xs:complexType> - -</xs:schema> diff --git a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Helper/CompositeTest.php b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Helper/CompositeTest.php index 110d83544ef..2c43702f243 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Helper/CompositeTest.php +++ b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Helper/CompositeTest.php @@ -31,12 +31,12 @@ class CompositeTest extends \PHPUnit_Framework_TestCase public function testFilterAndSortDeclaredComponents() { - $firstComponent = new \Magento\Framework\Object(); - $secondComponent = new \Magento\Framework\Object(); - $thirdComponent = new \Magento\Framework\Object(); + $firstComponent = new \Magento\Framework\DataObject(); + $secondComponent = new \Magento\Framework\DataObject(); + $thirdComponent = new \Magento\Framework\DataObject(); $contexts = [ [ - 'type' => new \Magento\Framework\Object(), + 'type' => new \Magento\Framework\DataObject(), ], [ 'sortOrder' => 50, diff --git a/lib/internal/Magento/Framework/Pricing/Test/Unit/Adjustment/FactoryTest.php b/lib/internal/Magento/Framework/Pricing/Test/Unit/Adjustment/FactoryTest.php index f9ac188ac89..04dfa32e448 100644 --- a/lib/internal/Magento/Framework/Pricing/Test/Unit/Adjustment/FactoryTest.php +++ b/lib/internal/Magento/Framework/Pricing/Test/Unit/Adjustment/FactoryTest.php @@ -67,7 +67,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase */ public function testCreateWithException() { - $invalidAdjustmentInterface = 'Magento\Framework\Object'; + $invalidAdjustmentInterface = 'Magento\Framework\DataObject'; $adjustmentFactory = $this->prepareAdjustmentFactory($invalidAdjustmentInterface); $adjustmentFactory->create($invalidAdjustmentInterface); } diff --git a/lib/internal/Magento/Framework/Reflection/Test/Unit/AttributeTypeResolverTest.php b/lib/internal/Magento/Framework/Reflection/Test/Unit/AttributeTypeResolverTest.php index 755b4b66689..66001ce8c13 100644 --- a/lib/internal/Magento/Framework/Reflection/Test/Unit/AttributeTypeResolverTest.php +++ b/lib/internal/Magento/Framework/Reflection/Test/Unit/AttributeTypeResolverTest.php @@ -65,18 +65,18 @@ class AttributeTypeResolverTest extends \PHPUnit_Framework_TestCase $config = [ 'Some\Class' => [ 'some_code' => [ - 'type' => '\Magento\Framework\Object', + 'type' => '\Magento\Framework\DataObject', ], ] ]; $this->typeProcessor->expects($this->once()) ->method('getArrayItemType') - ->with('\Magento\Framework\Object') - ->willReturn('\Magento\Framework\Object'); + ->with('\Magento\Framework\DataObject') + ->willReturn('\Magento\Framework\DataObject'); $this->configMock->expects($this->once())->method('get')->willReturn($config); - $this->assertEquals('\Magento\Framework\Object', $this->model->resolveObjectType($code, $value, $context)); + $this->assertEquals('\Magento\Framework\DataObject', $this->model->resolveObjectType($code, $value, $context)); } /** diff --git a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Filter/Builder.php b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Filter/Builder.php index 9b55177403a..133cfd4ec32 100644 --- a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Filter/Builder.php +++ b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Filter/Builder.php @@ -13,8 +13,11 @@ use Magento\Framework\Search\Adapter\Mysql\Filter\Builder\Term; use Magento\Framework\Search\Adapter\Mysql\Filter\Builder\Wildcard; use Magento\Framework\Search\Adapter\Mysql\Query\QueryContainer; use Magento\Framework\Search\Request\FilterInterface as RequestFilterInterface; -use Magento\Framework\Search\Request\Query\Bool; +use Magento\Framework\Search\Request\Query\BoolExpression; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class Builder implements BuilderInterface { /** @@ -133,6 +136,6 @@ class Builder implements BuilderInterface */ private function isNegation($conditionType) { - return Bool::QUERY_CONDITION_NOT === $conditionType; + return BoolExpression::QUERY_CONDITION_NOT === $conditionType; } } diff --git a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Mapper.php b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Mapper.php index fe2da6d2a4d..454cd4d14c3 100644 --- a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Mapper.php +++ b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Mapper.php @@ -13,7 +13,7 @@ use Magento\Framework\Search\Adapter\Mysql\Query\MatchContainer; use Magento\Framework\Search\Adapter\Mysql\Query\QueryContainer; use Magento\Framework\Search\Adapter\Mysql\Query\QueryContainerFactory; use Magento\Framework\Search\EntityMetadata; -use Magento\Framework\Search\Request\Query\Bool as BoolQuery; +use Magento\Framework\Search\Request\Query\BoolExpression as BoolQuery; use Magento\Framework\Search\Request\Query\Filter as FilterQuery; use Magento\Framework\Search\Request\Query\Match as MatchQuery; use Magento\Framework\Search\Request\QueryInterface as RequestQueryInterface; diff --git a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Query/Builder/Match.php b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Query/Builder/Match.php index 7e1c52ec089..cdc941f4830 100644 --- a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Query/Builder/Match.php +++ b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Query/Builder/Match.php @@ -10,7 +10,7 @@ use Magento\Framework\DB\Select; use Magento\Framework\Search\Adapter\Mysql\Field\FieldInterface; use Magento\Framework\Search\Adapter\Mysql\Field\ResolverInterface; use Magento\Framework\Search\Adapter\Mysql\ScoreBuilder; -use Magento\Framework\Search\Request\Query\Bool; +use Magento\Framework\Search\Request\Query\BoolExpression; use Magento\Framework\Search\Request\QueryInterface as RequestQueryInterface; class Match implements QueryInterface @@ -99,9 +99,9 @@ class Match implements QueryInterface $queryValue = str_replace($this->replaceSymbols, ' ', $queryValue); $stringPrefix = ''; - if ($conditionType === Bool::QUERY_CONDITION_MUST) { + if ($conditionType === BoolExpression::QUERY_CONDITION_MUST) { $stringPrefix = '+'; - } elseif ($conditionType === Bool::QUERY_CONDITION_NOT) { + } elseif ($conditionType === BoolExpression::QUERY_CONDITION_NOT) { $stringPrefix = '-'; } diff --git a/lib/internal/Magento/Framework/Search/Request/Filter/Bool.php b/lib/internal/Magento/Framework/Search/Request/Filter/Bool.php deleted file mode 100644 index 2be1a0af0f1..00000000000 --- a/lib/internal/Magento/Framework/Search/Request/Filter/Bool.php +++ /dev/null @@ -1,105 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Search\Request\Filter; - -use Magento\Framework\Search\Request\FilterInterface; - -/** - * Bool Filter - */ -class Bool implements FilterInterface -{ - /** - * @var string - */ - protected $name; - - /** - * Filter names to which result set MUST satisfy - * - * @var array - */ - protected $must = []; - - /** - * Filter names to which result set SHOULD satisfy - * - * @var array - */ - protected $should = []; - - /** - * Filter names to which result set MUST NOT satisfy - * - * @var array - */ - protected $mustNot = []; - - /** - * @param string $name - * @param array $must - * @param array $should - * @param array $not - * @codeCoverageIgnore - */ - public function __construct($name, array $must = [], array $should = [], array $not = []) - { - $this->name = $name; - $this->must = $must; - $this->should = $should; - $this->mustNot = $not; - } - - /** - * {@inheritdoc} - */ - public function getType() - { - return FilterInterface::TYPE_BOOL; - } - - /** - * {@inheritdoc} - * @codeCoverageIgnore - */ - public function getName() - { - return $this->name; - } - - /** - * Get Must filters - * - * @return \Magento\Framework\Search\Request\FilterInterface[] - * @codeCoverageIgnore - */ - public function getMust() - { - return $this->must; - } - - /** - * Get Should filters - * - * @return \Magento\Framework\Search\Request\FilterInterface[] - * @codeCoverageIgnore - */ - public function getShould() - { - return $this->should; - } - - /** - * Get Must Not filters - * - * @return \Magento\Framework\Search\Request\FilterInterface[] - * @codeCoverageIgnore - */ - public function getMustNot() - { - return $this->mustNot; - } -} diff --git a/lib/internal/Magento/Framework/Search/Request/Mapper.php b/lib/internal/Magento/Framework/Search/Request/Mapper.php index d69d5e4e6d6..4a36cff5dbf 100644 --- a/lib/internal/Magento/Framework/Search/Request/Mapper.php +++ b/lib/internal/Magento/Framework/Search/Request/Mapper.php @@ -153,7 +153,7 @@ class Mapper case QueryInterface::TYPE_BOOL: $aggregatedByType = $this->aggregateQueriesByType($query['queryReference']); $query = $this->objectManager->create( - 'Magento\Framework\Search\Request\Query\Bool', + 'Magento\Framework\Search\Request\Query\BoolExpression', array_merge( ['name' => $query['name'], 'boost' => isset($query['boost']) ? $query['boost'] : 1], $aggregatedByType @@ -222,7 +222,7 @@ class Mapper case FilterInterface::TYPE_BOOL: $aggregatedByType = $this->aggregateFiltersByType($filter['filterReference']); $filter = $this->objectManager->create( - 'Magento\Framework\Search\Request\Filter\Bool', + 'Magento\Framework\Search\Request\Filter\BoolExpression', array_merge( ['name' => $filter['name']], $aggregatedByType diff --git a/lib/internal/Magento/Framework/Search/Request/Query/Bool.php b/lib/internal/Magento/Framework/Search/Request/Query/Bool.php deleted file mode 100644 index df660e42364..00000000000 --- a/lib/internal/Magento/Framework/Search/Request/Query/Bool.php +++ /dev/null @@ -1,128 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Search\Request\Query; - -use Magento\Framework\Search\Request\QueryInterface; - -/** - * Bool Query - */ -class Bool implements QueryInterface -{ - const QUERY_CONDITION_MUST = 'must'; - const QUERY_CONDITION_SHOULD = 'should'; - const QUERY_CONDITION_NOT = 'not'; - - /** - * Boost - * - * @var int|null - */ - protected $boost; - - /** - * Query Name - * - * @var string - */ - protected $name; - - /** - * Query names to which result set SHOULD satisfy - * - * @var array - */ - protected $should = []; - - /** - * Query names to which result set MUST satisfy - * - * @var array - */ - protected $must = []; - - /** - * Query names to which result set MUST NOT satisfy - * - * @var array - */ - protected $mustNot = []; - - /** - * @param string $name - * @param int|null $boost - * @param array $must - * @param array $should - * @param array $not - * @codeCoverageIgnore - */ - public function __construct($name, $boost, array $must = [], array $should = [], array $not = []) - { - $this->name = $name; - $this->boost = $boost; - $this->must = $must; - $this->should = $should; - $this->mustNot = $not; - } - - /** - * {@inheritdoc} - */ - public function getType() - { - return QueryInterface::TYPE_BOOL; - } - - /** - * {@inheritdoc} - * @codeCoverageIgnore - */ - public function getName() - { - return $this->name; - } - - /** - * {@inheritdoc} - */ - public function getBoost() - { - return $this->boost; - } - - /** - * Get Should queries - * - * @return QueryInterface[] - * @codeCoverageIgnore - */ - public function getShould() - { - return $this->should; - } - - /** - * Get Must queries - * - * @return QueryInterface[] - * @codeCoverageIgnore - */ - public function getMust() - { - return $this->must; - } - - /** - * Get Must Not queries - * - * @return QueryInterface[] - * @codeCoverageIgnore - */ - public function getMustNot() - { - return $this->mustNot; - } -} diff --git a/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/Filter/BuilderTest.php b/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/Filter/BuilderTest.php index 8c1cc50ded3..0558ff08f86 100644 --- a/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/Filter/BuilderTest.php +++ b/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/Filter/BuilderTest.php @@ -9,7 +9,7 @@ namespace Magento\Framework\Search\Test\Unit\Adapter\Mysql\Filter; use Magento\Framework\Search\Adapter\Mysql\Filter\PreprocessorInterface; use Magento\Framework\Search\Adapter\Mysql\ConditionManager; use Magento\Framework\Search\Request\FilterInterface; -use Magento\Framework\Search\Request\Query\Bool as RequestBoolQuery; +use Magento\Framework\Search\Request\Query\BoolExpression as RequestBoolQuery; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; class BuilderTest extends \PHPUnit_Framework_TestCase @@ -202,7 +202,7 @@ class BuilderTest extends \PHPUnit_Framework_TestCase /** * @param $field * @param $value - * @return \Magento\Framework\Search\Request\Filter\Bool|\PHPUnit_Framework_MockObject_MockObject + * @return \Magento\Framework\Search\Request\Filter\BoolExpression|\PHPUnit_Framework_MockObject_MockObject */ private function createTermFilter($field, $value) { @@ -246,7 +246,7 @@ class BuilderTest extends \PHPUnit_Framework_TestCase * @param $field * @param $from * @param $to - * @return \Magento\Framework\Search\Request\Filter\Bool|\PHPUnit_Framework_MockObject_MockObject + * @return \Magento\Framework\Search\Request\Filter\BoolExpression|\PHPUnit_Framework_MockObject_MockObject */ private function createRangeFilter($field, $from, $to) { @@ -382,11 +382,11 @@ class BuilderTest extends \PHPUnit_Framework_TestCase * @param array $must * @param array $should * @param array $mustNot - * @return \Magento\Framework\Search\Request\Filter\Bool|\PHPUnit_Framework_MockObject_MockObject + * @return \Magento\Framework\Search\Request\Filter\BoolExpression|\PHPUnit_Framework_MockObject_MockObject */ private function createBoolFilter(array $must, array $should, array $mustNot) { - $filter = $this->getMockBuilder('Magento\Framework\Search\Request\Filter\Bool') + $filter = $this->getMockBuilder('Magento\Framework\Search\Request\Filter\BoolExpression') ->setMethods(['getMust', 'getShould', 'getMustNot']) ->disableOriginalConstructor() ->getMock(); diff --git a/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/MapperTest.php b/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/MapperTest.php index 167a16c22ea..bd35aa0ba49 100644 --- a/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/MapperTest.php +++ b/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/MapperTest.php @@ -9,7 +9,7 @@ use \Magento\Framework\Search\Adapter\Mysql\Mapper; use PHPUnit_Framework_MockObject_MockObject as MockObject; use Magento\Framework\App\Resource; -use Magento\Framework\Search\Request\Query\Bool; +use Magento\Framework\Search\Request\Query\BoolExpression; use Magento\Framework\Search\Request\Query\Filter; use Magento\Framework\Search\Request\QueryInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; @@ -172,7 +172,7 @@ class MapperTest extends \PHPUnit_Framework_TestCase ->with( $this->equalTo($this->select), $this->equalTo($query), - $this->equalTo(Bool::QUERY_CONDITION_MUST) + $this->equalTo(BoolExpression::QUERY_CONDITION_MUST) ) ->will($this->returnValue($this->select)); @@ -343,7 +343,7 @@ class MapperTest extends \PHPUnit_Framework_TestCase */ private function createBoolQuery(array $must, array $should, array $mustNot) { - $query = $this->getMockBuilder('Magento\Framework\Search\Request\Query\Bool') + $query = $this->getMockBuilder('Magento\Framework\Search\Request\Query\BoolExpression') ->setMethods(['getMust', 'getShould', 'getMustNot', 'getType']) ->disableOriginalConstructor() ->getMockForAbstractClass(); diff --git a/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/Query/Builder/MatchTest.php b/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/Query/Builder/MatchTest.php index 6e8bfe5d8aa..901474b5773 100644 --- a/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/Query/Builder/MatchTest.php +++ b/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/Query/Builder/MatchTest.php @@ -6,7 +6,7 @@ namespace Magento\Framework\Search\Test\Unit\Adapter\Mysql\Query\Builder; use Magento\Framework\DB\Select; -use Magento\Framework\Search\Request\Query\Bool; +use Magento\Framework\Search\Request\Query\BoolExpression; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; class MatchTest extends \PHPUnit_Framework_TestCase @@ -102,7 +102,7 @@ class MatchTest extends \PHPUnit_Framework_TestCase $this->scoreBuilder->expects($this->once()) ->method('addCondition'); - $result = $this->match->build($this->scoreBuilder, $select, $query, Bool::QUERY_CONDITION_NOT); + $result = $this->match->build($this->scoreBuilder, $select, $query, BoolExpression::QUERY_CONDITION_NOT); $this->assertEquals($select, $result); } diff --git a/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/Query/QueryContainerTest.php b/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/Query/QueryContainerTest.php index 10d77becf5a..55a6bfbb0c6 100644 --- a/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/Query/QueryContainerTest.php +++ b/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/Query/QueryContainerTest.php @@ -7,8 +7,7 @@ namespace Magento\Framework\Search\Test\Unit\Adapter\Mysql\Query; use Magento\Framework\Search\Adapter\Mysql\Query\MatchContainerFactory; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; -use Magento\Framework\Search\Adapter\Mysql\Query\QueryContainer; -use Magento\Framework\Search\Request\Query\Bool; +use Magento\Framework\Search\Request\Query\BoolExpression; class QueryContainerTest extends \PHPUnit_Framework_TestCase { @@ -59,7 +58,11 @@ class QueryContainerTest extends \PHPUnit_Framework_TestCase $this->matchContainerFactory->expects($this->once())->method('create') ->willReturn('asdf'); - $result = $this->queryContainer->addMatchQuery($this->select, $this->requestQuery, Bool::QUERY_CONDITION_MUST); + $result = $this->queryContainer->addMatchQuery( + $this->select, + $this->requestQuery, + BoolExpression::QUERY_CONDITION_MUST + ); $this->assertEquals($this->select, $result); } @@ -68,7 +71,11 @@ class QueryContainerTest extends \PHPUnit_Framework_TestCase $this->matchContainerFactory->expects($this->once())->method('create') ->willReturn('asdf'); - $result = $this->queryContainer->addMatchQuery($this->select, $this->requestQuery, Bool::QUERY_CONDITION_MUST); + $result = $this->queryContainer->addMatchQuery( + $this->select, + $this->requestQuery, + BoolExpression::QUERY_CONDITION_MUST + ); $this->assertEquals($this->select, $result); $queries = $this->queryContainer->getDerivedQueries(); diff --git a/lib/internal/Magento/Framework/Search/Test/Unit/Request/MapperTest.php b/lib/internal/Magento/Framework/Search/Test/Unit/Request/MapperTest.php index f440181d3d5..c01f9ce4b1e 100644 --- a/lib/internal/Magento/Framework/Search/Test/Unit/Request/MapperTest.php +++ b/lib/internal/Magento/Framework/Search/Test/Unit/Request/MapperTest.php @@ -30,7 +30,7 @@ class MapperTest extends \PHPUnit_Framework_TestCase private $queryMatch; /** - * @var \Magento\Framework\Search\Request\Query\Bool|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Search\Request\Query\BoolExpression|\PHPUnit_Framework_MockObject_MockObject */ private $queryBool; @@ -69,7 +69,7 @@ class MapperTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $this->queryBool = $this->getMockBuilder('Magento\Framework\Search\Request\Query\Bool') + $this->queryBool = $this->getMockBuilder('Magento\Framework\Search\Request\Query\BoolExpression') ->disableOriginalConstructor() ->getMock(); @@ -85,7 +85,7 @@ class MapperTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $this->filterBool = $this->getMockBuilder('Magento\Framework\Search\Request\Filter\Bool') + $this->filterBool = $this->getMockBuilder('Magento\Framework\Search\Request\Filter\BoolExpression') ->disableOriginalConstructor() ->getMock(); @@ -310,7 +310,7 @@ class MapperTest extends \PHPUnit_Framework_TestCase $query = $queries[self::ROOT_QUERY]; $this->objectManager->expects($this->at(1))->method('create') ->with( - $this->equalTo('Magento\Framework\Search\Request\Query\Bool'), + $this->equalTo('Magento\Framework\Search\Request\Query\BoolExpression'), $this->equalTo( [ 'name' => $query['name'], @@ -624,7 +624,7 @@ class MapperTest extends \PHPUnit_Framework_TestCase $filter = $filters['someFilter']; $this->objectManager->expects($this->at(1))->method('create') ->with( - $this->equalTo('Magento\Framework\Search\Request\Filter\Bool'), + $this->equalTo('Magento\Framework\Search\Request\Filter\BoolExpression'), $this->equalTo( [ 'name' => $filter['name'], diff --git a/lib/internal/Magento/Framework/Session/Config.php b/lib/internal/Magento/Framework/Session/Config.php index ff11331c7a9..f90ccb04301 100644 --- a/lib/internal/Magento/Framework/Session/Config.php +++ b/lib/internal/Magento/Framework/Session/Config.php @@ -72,7 +72,7 @@ class Config implements ConfigInterface protected $_scopeConfig; /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $_stringHelper; @@ -104,7 +104,7 @@ class Config implements ConfigInterface /** * @param \Magento\Framework\ValidatorFactory $validatorFactory * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - * @param \Magento\Framework\Stdlib\String $stringHelper + * @param \Magento\Framework\Stdlib\StringUtils $stringHelper * @param \Magento\Framework\App\RequestInterface $request * @param Filesystem $filesystem * @param DeploymentConfig $deploymentConfig @@ -115,7 +115,7 @@ class Config implements ConfigInterface public function __construct( \Magento\Framework\ValidatorFactory $validatorFactory, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, - \Magento\Framework\Stdlib\String $stringHelper, + \Magento\Framework\Stdlib\StringUtils $stringHelper, \Magento\Framework\App\RequestInterface $request, Filesystem $filesystem, DeploymentConfig $deploymentConfig, diff --git a/lib/internal/Magento/Framework/Session/SessionManager.php b/lib/internal/Magento/Framework/Session/SessionManager.php index c66672e87ca..08c4de978e3 100644 --- a/lib/internal/Magento/Framework/Session/SessionManager.php +++ b/lib/internal/Magento/Framework/Session/SessionManager.php @@ -469,7 +469,12 @@ class SessionManager implements SessionManagerInterface if (headers_sent()) { return $this; } - session_regenerate_id(true); + if ($this->isSessionExists()) { + session_regenerate_id(true); + } else { + session_start(); + } + $this->storage->init(isset($_SESSION) ? $_SESSION : []); if ($this->sessionConfig->getUseCookies()) { $this->clearSubDomainSessionCookie(); diff --git a/lib/internal/Magento/Framework/Session/Storage.php b/lib/internal/Magento/Framework/Session/Storage.php index 0beacd955fd..c55e7592709 100644 --- a/lib/internal/Magento/Framework/Session/Storage.php +++ b/lib/internal/Magento/Framework/Session/Storage.php @@ -7,7 +7,7 @@ */ namespace Magento\Framework\Session; -class Storage extends \Magento\Framework\Object implements StorageInterface +class Storage extends \Magento\Framework\DataObject implements StorageInterface { /** * Namespace of storage diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/ListsTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/ListsTest.php index 12636a427d7..323491d064c 100644 --- a/lib/internal/Magento/Framework/Setup/Test/Unit/ListsTest.php +++ b/lib/internal/Magento/Framework/Setup/Test/Unit/ListsTest.php @@ -68,12 +68,6 @@ class ListsTest extends \PHPUnit_Framework_TestCase $this->assertEquals($this->expectedTimezones, $timezones); } - public function testGetCurrencyList() - { - $currencies = array_intersect($this->expectedCurrencies, array_keys($this->lists->getCurrencyList())); - $this->assertEquals($this->expectedCurrencies, $currencies); - } - public function testGetLocaleList() { $locales = array_intersect($this->expectedLocales, array_keys($this->lists->getLocaleList())); diff --git a/lib/internal/Magento/Framework/Simplexml/Config/Cache/AbstractCache.php b/lib/internal/Magento/Framework/Simplexml/Config/Cache/AbstractCache.php index 4eb7447791f..e81afc4799f 100644 --- a/lib/internal/Magento/Framework/Simplexml/Config/Cache/AbstractCache.php +++ b/lib/internal/Magento/Framework/Simplexml/Config/Cache/AbstractCache.php @@ -12,7 +12,7 @@ namespace Magento\Framework\Simplexml\Config\Cache; * @method void setIsAllowedToSave(bool $isAllowedToSave) * @method array getComponents() */ -abstract class AbstractCache extends \Magento\Framework\Object +abstract class AbstractCache extends \Magento\Framework\DataObject { /** * Constructor diff --git a/lib/internal/Magento/Framework/Stdlib/ArrayUtils.php b/lib/internal/Magento/Framework/Stdlib/ArrayUtils.php index cde6db70a5b..dd9576b800a 100644 --- a/lib/internal/Magento/Framework/Stdlib/ArrayUtils.php +++ b/lib/internal/Magento/Framework/Stdlib/ArrayUtils.php @@ -47,7 +47,7 @@ class ArrayUtils * *_is_last - if the element is last * * The respective key/attribute will be set to element, depending on object it is or array. - * \Magento\Framework\Object is supported. + * \Magento\Framework\DataObject is supported. * * $forceSetAll true will cause to set all possible values for all elements. * When false (default), only non-empty values will be set. @@ -111,7 +111,7 @@ class ArrayUtils /** * Mark passed object with specified flag and appropriate value. * - * @param \Magento\Framework\Object $element + * @param \Magento\Framework\DataObject $element * @param string $key * @param bool $value * @param bool $isSkipped @@ -119,7 +119,7 @@ class ArrayUtils */ private function _decorateArrayObject($element, $key, $value, $isSkipped) { - if ($isSkipped && $element instanceof \Magento\Framework\Object) { + if ($isSkipped && $element instanceof \Magento\Framework\DataObject) { $element->setData($key, $value); } } diff --git a/lib/internal/Magento/Framework/Stdlib/String.php b/lib/internal/Magento/Framework/Stdlib/String.php deleted file mode 100644 index 82de30e85d6..00000000000 --- a/lib/internal/Magento/Framework/Stdlib/String.php +++ /dev/null @@ -1,215 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Stdlib; - -/** - * Magento methods to work with string - */ -class String -{ - /** - * Default charset - */ - const ICONV_CHARSET = 'UTF-8'; - - /** - * Capitalize first letters and convert separators if needed - * - * @param string $str - * @param string $sourceSeparator - * @param string $destinationSeparator - * @return string - */ - public function upperCaseWords($str, $sourceSeparator = '_', $destinationSeparator = '_') - { - return str_replace(' ', $destinationSeparator, ucwords(str_replace($sourceSeparator, ' ', $str))); - } - - /** - * Split string and appending $insert string after $needle - * - * @param string $str - * @param integer $length - * @param string $needle - * @param string $insert - * @return string - */ - public function splitInjection($str, $length = 50, $needle = '-', $insert = ' ') - { - $str = $this->split($str, $length); - $newStr = ''; - foreach ($str as $part) { - if ($this->strlen($part) >= $length) { - $lastDelimiter = $this->strpos($this->strrev($part), $needle); - $tmpNewStr = $this->substr($this->strrev($part), 0, $lastDelimiter) . $insert - . $this->substr($this->strrev($part), $lastDelimiter); - $newStr .= $this->strrev($tmpNewStr); - } else { - $newStr .= $part; - } - } - return $newStr; - } - - /** - * Binary-safe variant of strSplit() - * + option not to break words - * + option to trim spaces (between each word) - * + option to set character(s) (pcre pattern) to be considered as words separator - * - * @param string $value - * @param int $length - * @param bool $keepWords - * @param bool $trim - * @param string $wordSeparatorRegex - * @return string[] - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) - */ - public function split($value, $length = 1, $keepWords = false, $trim = false, $wordSeparatorRegex = '\s') - { - $result = []; - $strLen = $this->strlen($value); - if (!$strLen || !is_int($length) || $length <= 0) { - return $result; - } - if ($trim) { - $value = trim(preg_replace('/\s{2,}/siu', ' ', $value)); - } - // do a usual str_split, but safe for our encoding - if (!$keepWords || $length < 2) { - for ($offset = 0; $offset < $strLen; $offset += $length) { - $result[] = $this->substr($value, $offset, $length); - } - } else { - // split smartly, keeping words - $split = preg_split('/(' . $wordSeparatorRegex . '+)/siu', $value, null, PREG_SPLIT_DELIM_CAPTURE); - $index = 0; - $space = ''; - $spaceLen = 0; - foreach ($split as $key => $part) { - if ($trim) { - // ignore spaces (even keys) - if ($key % 2) { - continue; - } - $space = ' '; - $spaceLen = 1; - } - if (empty($result[$index])) { - $currentLength = 0; - $result[$index] = ''; - $space = ''; - $spaceLen = 0; - } else { - $currentLength = $this->strlen($result[$index]); - } - $partLength = $this->strlen($part); - // add part to current last element - if ($currentLength + $spaceLen + $partLength <= $length) { - $result[$index] .= $space . $part; - } elseif ($partLength <= $length) { - // add part to new element - $index++; - $result[$index] = $part; - } else { - // break too long part recursively - foreach ($this->split($part, $length, false, $trim, $wordSeparatorRegex) as $subPart) { - $index++; - $result[$index] = $subPart; - } - } - } - } - // remove last element, if empty - $count = count($result); - if ($count) { - if ($result[$count - 1] === '') { - unset($result[$count - 1]); - } - } - // remove first element, if empty - if (isset($result[0]) && $result[0] === '') { - array_shift($result); - } - return $result; - } - - /** - * Retrieve string length using default charset - * - * @param string $string - * @return int - */ - public function strlen($string) - { - return iconv_strlen($string, self::ICONV_CHARSET); - } - - /** - * Clean non UTF-8 characters - * - * @param string $string - * @return string - */ - public function cleanString($string) - { - if ('"libiconv"' == ICONV_IMPL) { - return iconv(self::ICONV_CHARSET, self::ICONV_CHARSET . '//IGNORE', $string); - } else { - return $string; - } - } - - /** - * Pass through to iconv_substr() - * - * @param string $string - * @param int $offset - * @param int $length - * @return string - */ - public function substr($string, $offset, $length = null) - { - $string = $this->cleanString($string); - if ($length === null) { - $length = $this->strlen($string) - $offset; - } - return iconv_substr($string, $offset, $length, self::ICONV_CHARSET); - } - - /** - * Binary-safe strrev() - * - * @param string $str - * @return string - */ - public function strrev($str) - { - $result = ''; - $strLen = $this->strlen($str); - if (!$strLen) { - return $result; - } - for ($i = $strLen - 1; $i >= 0; $i--) { - $result .= $this->substr($str, $i, 1); - } - return $result; - } - - /** - * Find position of first occurrence of a string - * - * @param string $haystack - * @param string $needle - * @param int $offset - * @return int|bool - */ - public function strpos($haystack, $needle, $offset = null) - { - return iconv_strpos($haystack, $needle, $offset, self::ICONV_CHARSET); - } -} diff --git a/lib/internal/Magento/Framework/Stdlib/Test/Unit/ArrayUtilsTest.php b/lib/internal/Magento/Framework/Stdlib/Test/Unit/ArrayUtilsTest.php index 70f895792c7..93da2f66a38 100644 --- a/lib/internal/Magento/Framework/Stdlib/Test/Unit/ArrayUtilsTest.php +++ b/lib/internal/Magento/Framework/Stdlib/Test/Unit/ArrayUtilsTest.php @@ -61,16 +61,16 @@ class ArrayUtilsTest extends \PHPUnit_Framework_TestCase // arrays $this->assertEquals($decorated, $this->_arrayUtils->decorateArray($original, '')); - // \Magento\Framework\Object + // \Magento\Framework\DataObject $sample = [ - new \Magento\Framework\Object($original[0]), - new \Magento\Framework\Object($original[1]), - new \Magento\Framework\Object($original[2]), + new \Magento\Framework\DataObject($original[0]), + new \Magento\Framework\DataObject($original[1]), + new \Magento\Framework\DataObject($original[2]), ]; $decoratedVo = [ - new \Magento\Framework\Object($decorated[0]), - new \Magento\Framework\Object($decorated[1]), - new \Magento\Framework\Object($decorated[2]), + new \Magento\Framework\DataObject($decorated[0]), + new \Magento\Framework\DataObject($decorated[1]), + new \Magento\Framework\DataObject($decorated[2]), ]; $this->assertEquals($decoratedVo, $this->_arrayUtils->decorateArray($sample, '')); } diff --git a/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/PublicCookieMetadataTest.php b/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/PublicCookieMetadataTest.php index d6691cb09f6..113daeefd9c 100644 --- a/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/PublicCookieMetadataTest.php +++ b/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/PublicCookieMetadataTest.php @@ -6,8 +6,8 @@ namespace Magento\Framework\Stdlib\Test\Unit\Cookie; -use \Magento\Framework\Stdlib\Cookie\PublicCookieMetadata; - +use Magento\Framework\Stdlib\Cookie\PublicCookieMetadata; +use Magento\Framework\Stdlib\StringUtils; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; /** @@ -28,9 +28,9 @@ class PublicCookieMetadataTest extends \PHPUnit_Framework_TestCase } /** - * @param String $setMethodName - * @param String $getMethodName - * @param String $expectedValue + * @param StringUtils $setMethodName + * @param StringUtils $getMethodName + * @param StringUtils $expectedValue * @dataProvider getMethodData */ diff --git a/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/SensitiveCookieMetadataTest.php b/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/SensitiveCookieMetadataTest.php index ca44e6d031a..57fb6f1bade 100644 --- a/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/SensitiveCookieMetadataTest.php +++ b/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/SensitiveCookieMetadataTest.php @@ -5,8 +5,8 @@ */ namespace Magento\Framework\Stdlib\Test\Unit\Cookie; -use \Magento\Framework\Stdlib\Cookie\SensitiveCookieMetadata; - +use Magento\Framework\Stdlib\Cookie\SensitiveCookieMetadata; +use Magento\Framework\Stdlib\StringUtils; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; /** @@ -208,9 +208,9 @@ class SensitiveCookieMetadataTest extends \PHPUnit_Framework_TestCase } /** - * @param String $setMethodName - * @param String $getMethodName - * @param String $expectedValue + * @param StringUtils $setMethodName + * @param StringUtils $getMethodName + * @param StringUtils $expectedValue * @dataProvider getMethodData */ diff --git a/lib/internal/Magento/Framework/Stdlib/Test/Unit/StringTest.php b/lib/internal/Magento/Framework/Stdlib/Test/Unit/StringTest.php deleted file mode 100644 index 0fef95cff1d..00000000000 --- a/lib/internal/Magento/Framework/Stdlib/Test/Unit/StringTest.php +++ /dev/null @@ -1,125 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Stdlib\Test\Unit; - -use \Magento\Framework\Stdlib\String; - -/** - * Magento\Framework\Stdlib\StringTest test case - */ -class StringTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Framework\Stdlib\String - */ - protected $_string; - - protected function setUp() - { - $this->_string = new String(); - } - - /** - * @covers \Magento\Framework\Stdlib\String::split - */ - public function testStrSplit() - { - $this->assertEquals([], $this->_string->split('')); - $this->assertEquals(['1', '2', '3', '4'], $this->_string->split('1234', 1)); - $this->assertEquals(['1', '2', ' ', '3', '4'], $this->_string->split('12 34', 1, false, true)); - $this->assertEquals( - ['12345', '123', '12345', '6789'], - $this->_string->split('12345 123 123456789', 5, true, true) - ); - $this->assertEquals( - ['1234', '5', '123', '1234', '5678', '9'], - $this->_string->split('12345 123 123456789', 4, true, true) - ); - } - - /** - * @covers \Magento\Framework\Stdlib\String::splitInjection - */ - public function testSplitInjection() - { - $string = '1234567890'; - $this->assertEquals('1234 5678 90', $this->_string->splitInjection($string, 4)); - } - - /** - * @covers \Magento\Framework\Stdlib\String::cleanString - */ - public function testCleanString() - { - $string = '12345'; - $this->assertEquals($string, $this->_string->cleanString($string)); - } - - public function testSubstr() - { - $this->assertSame('tring', $this->_string->substr('string', 1)); - } - - public function testStrrev() - { - $this->assertSame('0987654321', $this->_string->strrev('1234567890')); - $this->assertSame('', $this->_string->strrev('')); - } - - /** - * @covers \Magento\Framework\Stdlib\String::strpos - */ - public function testStrpos() - { - $this->assertEquals(1, $this->_string->strpos('123', 2)); - } - - /** - * @param string $testString - * @param string $expected - * - * @dataProvider upperCaseWordsDataProvider - */ - public function testUpperCaseWords($testString, $expected) - { - $actual = $this->_string->upperCaseWords($testString); - $this->assertEquals($expected, $actual); - } - - /** - * @return array - */ - public function upperCaseWordsDataProvider() - { - return [ - ['test test2', 'Test_Test2'], - ['test_test2', 'Test_Test2'], - ['test_test2 test3', 'Test_Test2_Test3'] - ]; - } - - /** - * @param string $testString - * @param string $sourceSeparator - * @param string $destinationSeparator - * @param string $expected - * - * @dataProvider upperCaseWordsWithSeparatorsDataProvider - */ - public function testUpperCaseWordsWithSeparators($testString, $sourceSeparator, $destinationSeparator, $expected) - { - $actual = $this->_string->upperCaseWords($testString, $sourceSeparator, $destinationSeparator); - $this->assertEquals($expected, $actual); - } - - /** - * @return array - */ - public function upperCaseWordsWithSeparatorsDataProvider() - { - return [['test test2_test3\test4|test5', '|', '\\', 'Test\Test2_test3\test4\Test5']]; - } -} diff --git a/lib/internal/Magento/Framework/Test/Unit/ObjectTest.php b/lib/internal/Magento/Framework/Test/Unit/ObjectTest.php index e276bd54407..0a531a9351f 100644 --- a/lib/internal/Magento/Framework/Test/Unit/ObjectTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/ObjectTest.php @@ -5,7 +5,7 @@ */ /** - * \Magento\Framework\Object test case. + * \Magento\Framework\DataObject test case. */ namespace Magento\Framework\Test\Unit; @@ -14,7 +14,7 @@ use PHPUnit_Framework_TestCase; class ObjectTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ private $_object; @@ -24,7 +24,7 @@ class ObjectTest extends \PHPUnit_Framework_TestCase protected function setUp() { parent::setUp(); - $this->_object = new \Magento\Framework\Object(); + $this->_object = new \Magento\Framework\DataObject(); } /** @@ -37,20 +37,20 @@ class ObjectTest extends \PHPUnit_Framework_TestCase } /** - * Tests \Magento\Framework\Object->__construct() + * Tests \Magento\Framework\DataObject->__construct() */ public function testConstruct() { - $object = new \Magento\Framework\Object(); + $object = new \Magento\Framework\DataObject(); $this->assertEquals([], $object->getData()); $data = ['test' => 'test']; - $object = new \Magento\Framework\Object($data); + $object = new \Magento\Framework\DataObject($data); $this->assertEquals($data, $object->getData()); } /** - * Tests \Magento\Framework\Object->addData() + * Tests \Magento\Framework\DataObject->addData() */ public function testAddData() { @@ -65,7 +65,7 @@ class ObjectTest extends \PHPUnit_Framework_TestCase } /** - * Tests \Magento\Framework\Object->setData() + * Tests \Magento\Framework\DataObject->setData() */ public function testSetData() { @@ -83,7 +83,7 @@ class ObjectTest extends \PHPUnit_Framework_TestCase } /** - * Tests \Magento\Framework\Object->unsetData() + * Tests \Magento\Framework\DataObject->unsetData() */ public function testUnsetData() { @@ -104,7 +104,7 @@ class ObjectTest extends \PHPUnit_Framework_TestCase } /** - * Tests \Magento\Framework\Object->getData() + * Tests \Magento\Framework\DataObject->getData() */ public function testGetData() { @@ -113,7 +113,7 @@ class ObjectTest extends \PHPUnit_Framework_TestCase 'key2' => [ 'subkey2.1' => 'value2.1', 'subkey2.2' => 'multiline'. PHP_EOL .'string', - 'subkey2.3' => new \Magento\Framework\Object(['test_key' => 'test_value']), + 'subkey2.3' => new \Magento\Framework\DataObject(['test_key' => 'test_value']), ], 'key3' => 5, ]; @@ -137,7 +137,7 @@ class ObjectTest extends \PHPUnit_Framework_TestCase 'subkey2.1' => 'value2.1', 'subkey2.2' => 'multiline string', - 'subkey2.3' => new \Magento\Framework\Object(['test_key' => 'test_value']), + 'subkey2.3' => new \Magento\Framework\DataObject(['test_key' => 'test_value']), ], ]; foreach ($data as $key => $value) { @@ -158,11 +158,11 @@ string', } /** - * Tests \Magento\Framework\Object->setDataUsingMethod() + * Tests \Magento\Framework\DataObject->setDataUsingMethod() */ public function testSetGetDataUsingMethod() { - $mock = $this->getMock('Magento\Framework\Object', ['setTestData', 'getTestData']); + $mock = $this->getMock('Magento\Framework\DataObject', ['setTestData', 'getTestData']); $mock->expects($this->once())->method('setTestData')->with($this->equalTo('data')); $mock->expects($this->once())->method('getTestData'); @@ -171,7 +171,7 @@ string', } /** - * Tests \Magento\Framework\Object->hasData() + * Tests \Magento\Framework\DataObject->hasData() */ public function testHasData() { @@ -182,7 +182,7 @@ string', } /** - * Tests \Magento\Framework\Object->toArray() + * Tests \Magento\Framework\DataObject->toArray() */ public function testToArray() { @@ -195,7 +195,7 @@ string', } /** - * Tests \Magento\Framework\Object->toXml() + * Tests \Magento\Framework\DataObject->toXml() */ public function testToXml() { @@ -244,7 +244,7 @@ string', } /** - * Tests \Magento\Framework\Object->toJson() + * Tests \Magento\Framework\DataObject->toJson() */ public function testToJson() { @@ -256,7 +256,7 @@ string', } /** - * Tests \Magento\Framework\Object->toString() + * Tests \Magento\Framework\DataObject->toString() */ public function testToString() { @@ -267,7 +267,7 @@ string', } /** - * Tests \Magento\Framework\Object->__call() + * Tests \Magento\Framework\DataObject->__call() * * @expectedException \Magento\Framework\Exception\LocalizedException */ @@ -287,7 +287,7 @@ string', } /** - * Tests \Magento\Framework\Object->__get() + * Tests \Magento\Framework\DataObject->__get() */ public function testGetSet() { @@ -299,7 +299,7 @@ string', } /** - * Tests \Magento\Framework\Object->isEmpty() + * Tests \Magento\Framework\DataObject->isEmpty() */ public function testIsEmpty() { @@ -309,7 +309,7 @@ string', } /** - * Tests \Magento\Framework\Object->serialize() + * Tests \Magento\Framework\DataObject->serialize() */ public function testSerialize() { @@ -323,7 +323,7 @@ string', } /** - * Tests \Magento\Framework\Object->debug() + * Tests \Magento\Framework\DataObject->debug() */ public function testDebug() { @@ -333,12 +333,12 @@ string', } $debug = $data; unset($debug['key3']); - $debug['key3 (Magento\Framework\Object)'] = '*** RECURSION ***'; + $debug['key3 (Magento\Framework\DataObject)'] = '*** RECURSION ***'; $this->assertEquals($debug, $this->_object->debug()); } /** - * Tests \Magento\Framework\Object->offsetSet() + * Tests \Magento\Framework\DataObject->offsetSet() */ public function testOffset() { diff --git a/lib/internal/Magento/Framework/Test/Unit/TranslateTest.php b/lib/internal/Magento/Framework/Test/Unit/TranslateTest.php index 2b5801c5313..a6eb38b152e 100644 --- a/lib/internal/Magento/Framework/Test/Unit/TranslateTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/TranslateTest.php @@ -271,8 +271,8 @@ class TranslateTest extends \PHPUnit_Framework_TestCase protected function expectsSetConfig($themeId, $localeCode = 'en_US') { $this->locale->expects($this->any())->method('getLocale')->will($this->returnValue($localeCode)); - $scope = new \Magento\Framework\Object(['code' => 'frontendCode', 'id' => 1]); - $scopeAdmin = new \Magento\Framework\Object(['code' => 'adminCode', 'id' => 0]); + $scope = new \Magento\Framework\DataObject(['code' => 'frontendCode', 'id' => 1]); + $scopeAdmin = new \Magento\Framework\DataObject(['code' => 'adminCode', 'id' => 0]); $this->scopeResolver->expects($this->any()) ->method('getScope') ->will( @@ -283,7 +283,7 @@ class TranslateTest extends \PHPUnit_Framework_TestCase ] ) ); - $designTheme = new \Magento\Framework\Object(['id' => $themeId]); + $designTheme = new \Magento\Framework\DataObject(['id' => $themeId]); $this->viewDesign->expects($this->any())->method('getDesignTheme')->will($this->returnValue($designTheme)); } } diff --git a/lib/internal/Magento/Framework/Test/Unit/ValidatorFactoryTest.php b/lib/internal/Magento/Framework/Test/Unit/ValidatorFactoryTest.php index be0c7f65f13..34c46d0326d 100644 --- a/lib/internal/Magento/Framework/Test/Unit/ValidatorFactoryTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/ValidatorFactoryTest.php @@ -31,7 +31,7 @@ class ValidatorFactoryTest extends \PHPUnit_Framework_TestCase public function testCreateWithInstanceName() { - $setName = 'Magento\Framework\Object'; + $setName = 'Magento\Framework\DataObject'; $returnMock = $this->getMock($setName); $this->objectManagerMock->expects($this->once())->method('create') ->willReturn($returnMock); diff --git a/lib/internal/Magento/Framework/Test/Unit/ValidatorTest.php b/lib/internal/Magento/Framework/Test/Unit/ValidatorTest.php index a015cbb66b2..6686dee9195 100644 --- a/lib/internal/Magento/Framework/Test/Unit/ValidatorTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/ValidatorTest.php @@ -131,7 +131,7 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase */ public function testAddValidator() { - $fooValidator = new \Magento\Framework\Validator\Test\Unit\Test\True(); + $fooValidator = new \Magento\Framework\Validator\Test\Unit\Test\IsTrue(); $classConstraint = new \Magento\Framework\Validator\Constraint($fooValidator, 'id'); $propertyValidator = new \Magento\Framework\Validator\Constraint\Property($classConstraint, 'name', 'id'); @@ -154,7 +154,7 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase */ public function testSetTranslator() { - $fooValidator = new \Magento\Framework\Validator\Test\Unit\Test\True(); + $fooValidator = new \Magento\Framework\Validator\Test\Unit\Test\IsTrue(); $this->_validator->addValidator($fooValidator); /** @var \Magento\Framework\Translate\AbstractAdapter $translator */ $translator = $this->getMockBuilder('Magento\Framework\Translate\AbstractAdapter')->getMockForAbstractClass(); diff --git a/lib/internal/Magento/Framework/Url.php b/lib/internal/Magento/Framework/Url.php index a300ebe01f4..1be0fd1b73a 100644 --- a/lib/internal/Magento/Framework/Url.php +++ b/lib/internal/Magento/Framework/Url.php @@ -58,7 +58,7 @@ namespace Magento\Framework; * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Url extends \Magento\Framework\Object implements \Magento\Framework\UrlInterface +class Url extends \Magento\Framework\DataObject implements \Magento\Framework\UrlInterface { /** * Configuration data cache diff --git a/lib/internal/Magento/Framework/Url/QueryParamsResolver.php b/lib/internal/Magento/Framework/Url/QueryParamsResolver.php index 2d19a027757..075ecfe0d4e 100644 --- a/lib/internal/Magento/Framework/Url/QueryParamsResolver.php +++ b/lib/internal/Magento/Framework/Url/QueryParamsResolver.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\Url; -class QueryParamsResolver extends \Magento\Framework\Object implements QueryParamsResolverInterface +class QueryParamsResolver extends \Magento\Framework\DataObject implements QueryParamsResolverInterface { /** * {@inheritdoc} diff --git a/lib/internal/Magento/Framework/Url/QueryParamsResolverInterface.php b/lib/internal/Magento/Framework/Url/QueryParamsResolverInterface.php index c1cd7b51348..9aa1b513e3c 100644 --- a/lib/internal/Magento/Framework/Url/QueryParamsResolverInterface.php +++ b/lib/internal/Magento/Framework/Url/QueryParamsResolverInterface.php @@ -64,7 +64,7 @@ interface QueryParamsResolverInterface * Unset data from the object. * * @param null|string|array $key - * @return \Magento\Framework\Object + * @return \Magento\Framework\DataObject */ public function unsetData($key = null); } diff --git a/lib/internal/Magento/Framework/Url/RouteParamsResolver.php b/lib/internal/Magento/Framework/Url/RouteParamsResolver.php index d5637d906e0..6e3a5158fab 100644 --- a/lib/internal/Magento/Framework/Url/RouteParamsResolver.php +++ b/lib/internal/Magento/Framework/Url/RouteParamsResolver.php @@ -19,7 +19,7 @@ use Magento\Framework\Url\RouteParamsResolverInterface; * @method $this setSecure(bool $isForced) * @method bool getSecure() */ -class RouteParamsResolver extends \Magento\Framework\Object implements RouteParamsResolverInterface +class RouteParamsResolver extends \Magento\Framework\DataObject implements RouteParamsResolverInterface { /** * @var \Magento\Framework\App\RequestInterface diff --git a/lib/internal/Magento/Framework/Url/Test/Unit/Helper/DataTest.php b/lib/internal/Magento/Framework/Url/Test/Unit/Helper/DataTest.php index 4c19f207018..035729b9328 100644 --- a/lib/internal/Magento/Framework/Url/Test/Unit/Helper/DataTest.php +++ b/lib/internal/Magento/Framework/Url/Test/Unit/Helper/DataTest.php @@ -126,7 +126,7 @@ class DataTest extends \PHPUnit_Framework_TestCase 'http://example.com?null&string=value&array[]=arrayVal1&array[]=arrayVal2&array[]=arrayVal3', ], 'object' => [ - ['object' => new \Magento\Framework\Object()], + ['object' => new \Magento\Framework\DataObject()], 'http://example.com', ] ]; diff --git a/lib/internal/Magento/Framework/Validator/Constraint.php b/lib/internal/Magento/Framework/Validator/Constraint.php index 53eee6b8972..72d4e770314 100644 --- a/lib/internal/Magento/Framework/Validator/Constraint.php +++ b/lib/internal/Magento/Framework/Validator/Constraint.php @@ -64,7 +64,7 @@ class Constraint extends \Magento\Framework\Validator\AbstractValidator protected function _getValidatorValue($value) { if (is_array($value)) { - $value = new \Magento\Framework\Object($value); + $value = new \Magento\Framework\DataObject($value); } return $value; } diff --git a/lib/internal/Magento/Framework/Validator/Constraint/Property.php b/lib/internal/Magento/Framework/Validator/Constraint/Property.php index 4bbce4c5da6..ecc27077ddb 100644 --- a/lib/internal/Magento/Framework/Validator/Constraint/Property.php +++ b/lib/internal/Magento/Framework/Validator/Constraint/Property.php @@ -33,7 +33,7 @@ class Property extends \Magento\Framework\Validator\Constraint } /** - * Get value that should be validated. Tries to extract value's property if \Magento\Framework\Object or \ArrayAccess or array + * Get value that should be validated. Tries to extract value's property if \Magento\Framework\DataObject or \ArrayAccess or array * is passed * * @param mixed $value @@ -43,7 +43,7 @@ class Property extends \Magento\Framework\Validator\Constraint { $result = null; - if ($value instanceof \Magento\Framework\Object) { + if ($value instanceof \Magento\Framework\DataObject) { $result = $value->getDataUsingMethod($this->_property); } elseif ((is_array($value) || $value instanceof \ArrayAccess) && isset($value[$this->_property])) { $result = $value[$this->_property]; diff --git a/lib/internal/Magento/Framework/Validator/Entity/Properties.php b/lib/internal/Magento/Framework/Validator/Entity/Properties.php index 0da61923427..3e915a097d1 100644 --- a/lib/internal/Magento/Framework/Validator/Entity/Properties.php +++ b/lib/internal/Magento/Framework/Validator/Entity/Properties.php @@ -1,13 +1,13 @@ <?php /** - * Validates properties of entity (\Magento\Framework\Object). + * Validates properties of entity (\Magento\Framework\DataObject). * * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Framework\Validator\Entity; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\Model\AbstractModel; class Properties extends \Magento\Framework\Validator\AbstractValidator @@ -35,7 +35,7 @@ class Properties extends \Magento\Framework\Validator\AbstractValidator * * @param AbstractModel $value * @return bool - * @throws \InvalidArgumentException when $value is not instanceof \Magento\Framework\Object + * @throws \InvalidArgumentException when $value is not instanceof \Magento\Framework\DataObject * @api */ public function isValid($value) diff --git a/lib/internal/Magento/Framework/Validator/Float.php b/lib/internal/Magento/Framework/Validator/Float.php deleted file mode 100644 index 8e2b3911410..00000000000 --- a/lib/internal/Magento/Framework/Validator/Float.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php -/** - * Float validator - * - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Validator; - -class Float extends \Zend_Validate_Float implements \Magento\Framework\Validator\ValidatorInterface -{ -} diff --git a/lib/internal/Magento/Framework/Validator/Int.php b/lib/internal/Magento/Framework/Validator/Int.php deleted file mode 100644 index 6ca3d953535..00000000000 --- a/lib/internal/Magento/Framework/Validator/Int.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php -/** - * Integer validator - * - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Validator; - -class Int extends \Zend_Validate_Int implements \Magento\Framework\Validator\ValidatorInterface -{ -} diff --git a/lib/internal/Magento/Framework/Validator/Object.php b/lib/internal/Magento/Framework/Validator/Object.php deleted file mode 100644 index 9593d6a2936..00000000000 --- a/lib/internal/Magento/Framework/Validator/Object.php +++ /dev/null @@ -1,84 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -/** - * Validator encapsulates multiple validation rules for \Magento\Framework\Object. - * Able to validate both individual fields and a whole object. - */ -namespace Magento\Framework\Validator; - -class Object implements \Zend_Validate_Interface -{ - /** - * Validation rules per scope (particular fields or entire entity) - * - * @var \Zend_Validate_Interface[] - */ - private $_rules = []; - - /** - * Validation error messages - * - * @var array - */ - private $_messages = []; - - /** - * Add rule to be applied to a validation scope - * - * @param \Zend_Validate_Interface $validator - * @param string $fieldName Field name to apply validation to, or empty value to validate entity as a whole - * @return \Magento\Framework\Validator\Object - * @api - */ - public function addRule(\Zend_Validate_Interface $validator, $fieldName = '') - { - if (!array_key_exists($fieldName, $this->_rules)) { - $this->_rules[$fieldName] = $validator; - } else { - $existingValidator = $this->_rules[$fieldName]; - if (!$existingValidator instanceof \Zend_Validate) { - $compositeValidator = new \Zend_Validate(); - $compositeValidator->addValidator($existingValidator); - $this->_rules[$fieldName] = $compositeValidator; - } - $this->_rules[$fieldName]->addValidator($validator); - } - return $this; - } - - /** - * Check whether the entity is valid according to defined validation rules - * - * @param \Magento\Framework\Object $entity - * @return bool - * - * @throws \Exception - * @api - */ - public function isValid($entity) - { - $this->_messages = []; - /** @var $validator \Zend_Validate_Interface */ - foreach ($this->_rules as $fieldName => $validator) { - $value = $fieldName ? $entity->getDataUsingMethod($fieldName) : $entity; - if (!$validator->isValid($value)) { - $this->_messages = array_merge($this->_messages, array_values($validator->getMessages())); - } - } - return empty($this->_messages); - } - - /** - * Return error messages (if any) after the last validation - * - * @return array - */ - public function getMessages() - { - return $this->_messages; - } -} diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/ConfigTest.php b/lib/internal/Magento/Framework/Validator/Test/Unit/ConfigTest.php index 5bc402bae8c..507a1c881d6 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/ConfigTest.php +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/ConfigTest.php @@ -150,13 +150,13 @@ class ConfigTest extends \PHPUnit_Framework_TestCase // Case 1. Pass check alnum and int properties are not empty and have valid value $entityName = 'test_entity_a'; $groupName = 'check_alnum_and_int_not_empty_and_have_valid_value'; - $value = new \Magento\Framework\Object(['int' => 1, 'alnum' => 'abc123']); + $value = new \Magento\Framework\DataObject(['int' => 1, 'alnum' => 'abc123']); $expectedResult = true; $expectedMessages = []; $result[] = [$entityName, $groupName, $value, $expectedResult, $expectedMessages]; // Case 2. Fail check alnum is not empty - $value = new \Magento\Framework\Object(['int' => 'abc123', 'alnum' => null]); + $value = new \Magento\Framework\DataObject(['int' => 'abc123', 'alnum' => null]); $expectedResult = false; $expectedMessages = [ 'alnum' => [ @@ -169,13 +169,13 @@ class ConfigTest extends \PHPUnit_Framework_TestCase // Case 3. Pass check alnum has valid value $groupName = 'check_alnum'; - $value = new \Magento\Framework\Object(['int' => 'abc123', 'alnum' => 'abc123']); + $value = new \Magento\Framework\DataObject(['int' => 'abc123', 'alnum' => 'abc123']); $expectedResult = true; $expectedMessages = []; $result[] = [$entityName, $groupName, $value, $expectedResult, $expectedMessages]; // Case 4. Fail check alnum has valid value - $value = new \Magento\Framework\Object(['int' => 'abc123', 'alnum' => '[abc123]']); + $value = new \Magento\Framework\DataObject(['int' => 'abc123', 'alnum' => '[abc123]']); $expectedResult = false; $expectedMessages = [ 'alnum' => ['notAlnum' => '\'[abc123]\' contains characters which are non alphabetic and no digits'], diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/Constraint/PropertyTest.php b/lib/internal/Magento/Framework/Validator/Test/Unit/Constraint/PropertyTest.php index d7eb0d023f4..c2cd87957d2 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/Constraint/PropertyTest.php +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/Constraint/PropertyTest.php @@ -104,7 +104,7 @@ class PropertyTest extends \PHPUnit_Framework_TestCase return [ [[self::PROPERTY_NAME => 'Property value', 'foo' => 'Foo value'], 'Property value', true], [ - new \Magento\Framework\Object([self::PROPERTY_NAME => 'Property value']), + new \Magento\Framework\DataObject([self::PROPERTY_NAME => 'Property value']), 'Property value', true ], diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/Entity/PropertiesTest.php b/lib/internal/Magento/Framework/Validator/Test/Unit/Entity/PropertiesTest.php index 62bc492e123..041ce5e2c0f 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/Entity/PropertiesTest.php +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/Entity/PropertiesTest.php @@ -12,7 +12,7 @@ namespace Magento\Framework\Validator\Test\Unit\Entity; class PropertiesTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $_object; diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/ObjectTest.php b/lib/internal/Magento/Framework/Validator/Test/Unit/ObjectTest.php index 99a52860ed3..b689c37c786 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/ObjectTest.php +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/ObjectTest.php @@ -8,13 +8,13 @@ namespace Magento\Framework\Validator\Test\Unit; class ObjectTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Framework\Validator\Object + * @var \Magento\Framework\Validator\DataObject */ protected $_model; protected function setUp() { - $this->_model = new \Magento\Framework\Validator\Object(); + $this->_model = new \Magento\Framework\Validator\DataObject(); $fieldOneExactValue = new \Zend_Validate_Identical('field_one_value'); $fieldOneExactValue->setMessage("'field_one' does not match expected value"); @@ -52,10 +52,10 @@ class ObjectTest extends \PHPUnit_Framework_TestCase /** * Entity validation routine to be used as a callback * - * @param \Magento\Framework\Object $entity + * @param \Magento\Framework\DataObject $entity * @return bool */ - public function isEntityValid(\Magento\Framework\Object $entity) + public function isEntityValid(\Magento\Framework\DataObject $entity) { return (bool)$entity->getData('is_valid'); } @@ -79,7 +79,7 @@ class ObjectTest extends \PHPUnit_Framework_TestCase */ public function testIsValid(array $inputEntityData, array $expectedErrors) { - $entity = new \Magento\Framework\Object($inputEntityData); + $entity = new \Magento\Framework\DataObject($inputEntityData); $isValid = $this->_model->isValid($entity); $this->assertFalse($isValid, 'Validation is expected to fail.'); diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/Test/Int.php b/lib/internal/Magento/Framework/Validator/Test/Unit/Test/Int.php deleted file mode 100644 index 2e939f178b0..00000000000 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/Test/Int.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Framework\Validator\Test\Unit\Test; - -/** - * Integer test validator - */ -class Int extends \Zend_Validate_Int implements \Magento\Framework\Validator\ValidatorInterface -{ -} diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/Test/True.php b/lib/internal/Magento/Framework/Validator/Test/Unit/Test/True.php deleted file mode 100644 index 369bbb828b9..00000000000 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/Test/True.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Framework\Validator\Test\Unit\Test; - -/** - * Test validator that always returns TRUE - */ -class True extends \Magento\Framework\Validator\AbstractValidator -{ - /** - * Validate value - * - * @param mixed $value - * @return bool - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function isValid($value) - { - return true; - } -} diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/positive/module_a/validation.xml b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/positive/module_a/validation.xml index 4f3124da232..9d8a8e0d0ee 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/positive/module_a/validation.xml +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/positive/module_a/validation.xml @@ -15,16 +15,16 @@ <constraint class="Magento\Framework\Validator\Test\Unit\Test\Alnum"/> </property> <property name="int"> - <constraint class="Magento\Framework\Validator\Test\Unit\Test\Int"/> + <constraint class="Magento\Framework\Validator\Test\Unit\Test\IsInt"/> </property> </property_constraints> <entity_constraints> - <constraint class="Magento\Framework\Validator\Test\Unit\Test\True"/> + <constraint class="Magento\Framework\Validator\Test\Unit\Test\IsTrue"/> </entity_constraints> </rule> <rule name="always_true"> <entity_constraints> - <constraint alias="alias" class="Magento\Framework\Validator\Test\Unit\Test\True"/> + <constraint alias="alias" class="Magento\Framework\Validator\Test\Unit\Test\IsTrue"/> </entity_constraints> </rule> </rules> diff --git a/lib/internal/Magento/Framework/View/Asset/Bundle.php b/lib/internal/Magento/Framework/View/Asset/Bundle.php index 10573664bc6..380d87d3115 100644 --- a/lib/internal/Magento/Framework/View/Asset/Bundle.php +++ b/lib/internal/Magento/Framework/View/Asset/Bundle.php @@ -233,7 +233,8 @@ class Bundle $bundlePath = ''; foreach ($types as $parts) { /** @var FallbackContext $context */ - $context = reset(reset($parts)['assets'])->getContext(); + $assetsParts = reset($parts); + $context = reset($assetsParts['assets'])->getContext(); $bundlePath = empty($bundlePath) ? $context->getPath() . Manager::BUNDLE_PATH : $bundlePath; $this->fillContent($parts, $context); } diff --git a/lib/internal/Magento/Framework/View/Design/Theme/Validator.php b/lib/internal/Magento/Framework/View/Design/Theme/Validator.php index 14112331a10..f5cfb0f9377 100644 --- a/lib/internal/Magento/Framework/View/Design/Theme/Validator.php +++ b/lib/internal/Magento/Framework/View/Design/Theme/Validator.php @@ -167,10 +167,10 @@ class Validator /** * Validate all data items * - * @param \Magento\Framework\Object $data + * @param \Magento\Framework\DataObject $data * @return bool */ - public function validate(\Magento\Framework\Object $data) + public function validate(\Magento\Framework\DataObject $data) { $this->_errorMessages = []; foreach ($this->_dataValidators as $dataKey => $validators) { diff --git a/lib/internal/Magento/Framework/View/Element/AbstractBlock.php b/lib/internal/Magento/Framework/View/Element/AbstractBlock.php index 71c3215b2a0..2fcdc3ae258 100644 --- a/lib/internal/Magento/Framework/View/Element/AbstractBlock.php +++ b/lib/internal/Magento/Framework/View/Element/AbstractBlock.php @@ -17,7 +17,7 @@ namespace Magento\Framework\View\Element; * @SuppressWarnings(PHPMD.TooManyFields) * @SuppressWarnings(PHPMD.NumberOfChildren) */ -abstract class AbstractBlock extends \Magento\Framework\Object implements BlockInterface +abstract class AbstractBlock extends \Magento\Framework\DataObject implements BlockInterface { /** * Cache group Tag diff --git a/lib/internal/Magento/Framework/View/Element/Messages.php b/lib/internal/Magento/Framework/View/Element/Messages.php index 790a614c6a8..612f340a11e 100644 --- a/lib/internal/Magento/Framework/View/Element/Messages.php +++ b/lib/internal/Magento/Framework/View/Element/Messages.php @@ -237,12 +237,12 @@ class Messages extends Template /** * Dispatch render after event * - * @param null|string|array|\Magento\Framework\Object &$html + * @param null|string|array|\Magento\Framework\DataObject &$html * @return void */ protected function _dispatchRenderGroupedAfterEvent(&$html) { - $transport = new \Magento\Framework\Object(['output' => $html]); + $transport = new \Magento\Framework\DataObject(['output' => $html]); $params = [ 'element_name' => $this->getNameInLayout(), 'layout' => $this->getLayout(), diff --git a/lib/internal/Magento/Framework/View/Element/Template.php b/lib/internal/Magento/Framework/View/Element/Template.php index a9928ab157b..b7c9738a92c 100644 --- a/lib/internal/Magento/Framework/View/Element/Template.php +++ b/lib/internal/Magento/Framework/View/Element/Template.php @@ -291,11 +291,11 @@ class Template extends AbstractBlock /** * Get data from specified object * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @param string $key * @return mixed */ - public function getObjectData(\Magento\Framework\Object $object, $key) + public function getObjectData(\Magento\Framework\DataObject $object, $key) { return $object->getDataUsingMethod((string)$key); } diff --git a/lib/internal/Magento/Framework/View/Element/UiComponent/ContentType/Xml.php b/lib/internal/Magento/Framework/View/Element/UiComponent/ContentType/Xml.php index 9715e8d6ea5..b22a234f0b4 100644 --- a/lib/internal/Magento/Framework/View/Element/UiComponent/ContentType/Xml.php +++ b/lib/internal/Magento/Framework/View/Element/UiComponent/ContentType/Xml.php @@ -98,10 +98,10 @@ class Xml extends AbstractContentType /** * Convert object to xml format * - * @param \Magento\Framework\Object $object + * @param \Magento\Framework\DataObject $object * @return string */ - protected function objectToXml(\Magento\Framework\Object $object) + protected function objectToXml(\Magento\Framework\DataObject $object) { return (string)$object; } diff --git a/lib/internal/Magento/Framework/View/Element/UiComponentFactory.php b/lib/internal/Magento/Framework/View/Element/UiComponentFactory.php index 0c7c723f667..92c30661108 100644 --- a/lib/internal/Magento/Framework/View/Element/UiComponentFactory.php +++ b/lib/internal/Magento/Framework/View/Element/UiComponentFactory.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\View\Element; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\ObjectManagerInterface; use Magento\Framework\Data\Argument\InterpreterInterface; @@ -16,7 +16,7 @@ use Magento\Framework\View\Element\UiComponent\ContextFactory; /** * Class UiComponentFactory */ -class UiComponentFactory extends Object +class UiComponentFactory extends DataObject { /** * Object manager diff --git a/lib/internal/Magento/Framework/View/Layout.php b/lib/internal/Magento/Framework/View/Layout.php index 265a7abd8bd..cc6253c795d 100644 --- a/lib/internal/Magento/Framework/View/Layout.php +++ b/lib/internal/Magento/Framework/View/Layout.php @@ -63,7 +63,7 @@ class Layout extends \Magento\Framework\Simplexml\Config implements \Magento\Fra /** * A variable for transporting output into observer during rendering * - * @var \Magento\Framework\Object + * @var \Magento\Framework\DataObject */ protected $_renderingOutput; @@ -196,7 +196,7 @@ class Layout extends \Magento\Framework\Simplexml\Config implements \Magento\Fra $cacheable = true ) { $this->_elementClass = 'Magento\Framework\View\Layout\Element'; - $this->_renderingOutput = new \Magento\Framework\Object(); + $this->_renderingOutput = new \Magento\Framework\DataObject(); $this->_processorFactory = $processorFactory; $this->_eventManager = $eventManager; diff --git a/lib/internal/Magento/Framework/View/Layout/Argument/Interpreter/Object.php b/lib/internal/Magento/Framework/View/Layout/Argument/Interpreter/Object.php deleted file mode 100644 index c7ca69c6994..00000000000 --- a/lib/internal/Magento/Framework/View/Layout/Argument/Interpreter/Object.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\View\Layout\Argument\Interpreter; - -use Magento\Framework\Data\Argument\InterpreterInterface; -use Magento\Framework\ObjectManagerInterface; - -/** - * Interpreter that instantiates object by a class name - */ -class Object implements InterpreterInterface -{ - /** - * @var ObjectManagerInterface - */ - private $objectManager; - - /** - * @var string|null - */ - private $expectedClass; - - /** - * @param ObjectManagerInterface $objectManager - * @param string|null $expectedClass - */ - public function __construct(ObjectManagerInterface $objectManager, $expectedClass = null) - { - $this->objectManager = $objectManager; - $this->expectedClass = $expectedClass; - } - - /** - * {@inheritdoc} - * @return object - * @throws \InvalidArgumentException - * @throws \UnexpectedValueException - */ - public function evaluate(array $data) - { - if (!isset($data['value'])) { - throw new \InvalidArgumentException('Object class name is missing.'); - } - $className = $data['value']; - $result = $this->objectManager->create($className); - if ($this->expectedClass && !$result instanceof $this->expectedClass) { - throw new \UnexpectedValueException( - sprintf("Instance of %s is expected, got %s instead.", $this->expectedClass, get_class($result)) - ); - } - return $result; - } -} diff --git a/lib/internal/Magento/Framework/View/Layout/PageType/Config.php b/lib/internal/Magento/Framework/View/Layout/PageType/Config.php index cce01dc8b27..c1707150cb5 100644 --- a/lib/internal/Magento/Framework/View/Layout/PageType/Config.php +++ b/lib/internal/Magento/Framework/View/Layout/PageType/Config.php @@ -44,7 +44,7 @@ class Config $this->_pageTypes = []; foreach ($this->_dataStorage->get(null) as $pageTypeId => $pageTypeConfig) { $pageTypeConfig['label'] = (string)new \Magento\Framework\Phrase($pageTypeConfig['label']); - $this->_pageTypes[$pageTypeId] = new \Magento\Framework\Object($pageTypeConfig); + $this->_pageTypes[$pageTypeId] = new \Magento\Framework\DataObject($pageTypeConfig); } } return $this; @@ -53,7 +53,7 @@ class Config /** * Retrieve available page types * - * @return \Magento\Framework\Object[] + * @return \Magento\Framework\DataObject[] */ public function getPageTypes() { diff --git a/lib/internal/Magento/Framework/View/Page/Config/Renderer.php b/lib/internal/Magento/Framework/View/Page/Config/Renderer.php index 590ad0369e2..660d1d9c5aa 100644 --- a/lib/internal/Magento/Framework/View/Page/Config/Renderer.php +++ b/lib/internal/Magento/Framework/View/Page/Config/Renderer.php @@ -36,7 +36,7 @@ class Renderer implements RendererInterface protected $escaper; /** - * @var \Magento\Framework\Stdlib\String + * @var \Magento\Framework\Stdlib\StringUtils */ protected $string; @@ -55,7 +55,7 @@ class Renderer implements RendererInterface * @param \Magento\Framework\View\Asset\MergeService $assetMergeService * @param \Magento\Framework\UrlInterface $urlBuilder * @param \Magento\Framework\Escaper $escaper - * @param \Magento\Framework\Stdlib\String $string + * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Psr\Log\LoggerInterface $logger */ public function __construct( @@ -63,7 +63,7 @@ class Renderer implements RendererInterface \Magento\Framework\View\Asset\MergeService $assetMergeService, \Magento\Framework\UrlInterface $urlBuilder, \Magento\Framework\Escaper $escaper, - \Magento\Framework\Stdlib\String $string, + \Magento\Framework\Stdlib\StringUtils $string, \Psr\Log\LoggerInterface $logger ) { $this->pageConfig = $pageConfig; diff --git a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler.php b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler.php index 609c924dc3f..ac349e9dc08 100644 --- a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler.php +++ b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\View\TemplateEngine\Xhtml; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\View\TemplateEngine\Xhtml\Compiler\TextInterface; use Magento\Framework\View\TemplateEngine\Xhtml\Compiler\CdataInterface; use Magento\Framework\View\TemplateEngine\Xhtml\Compiler\CommentInterface; @@ -76,11 +76,11 @@ class Compiler implements CompilerInterface * The compilation of the template and filling in the data * * @param \DOMNode $node - * @param Object $processedObject - * @param Object $context + * @param DataObject $processedObject + * @param DataObject $context * @return void */ - public function compile(\DOMNode $node, Object $processedObject, Object $context) + public function compile(\DOMNode $node, DataObject $processedObject, DataObject $context) { switch ($node->nodeType) { case XML_TEXT_NODE: diff --git a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Attribute.php b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Attribute.php index 2e19d778dff..4102ce890fa 100644 --- a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Attribute.php +++ b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Attribute.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\View\TemplateEngine\Xhtml\Compiler; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\View\TemplateEngine\Xhtml\Compiler\Directive\DirectiveInterface; /** @@ -32,10 +32,10 @@ class Attribute implements AttributeInterface * Compiles the Element node * * @param \DOMAttr $node - * @param Object $processedObject + * @param DataObject $processedObject * @return void */ - public function compile(\DOMAttr $node, Object $processedObject) + public function compile(\DOMAttr $node, DataObject $processedObject) { foreach ($this->directivePool as $directive) { $node->value = preg_replace_callback( diff --git a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/AttributeInterface.php b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/AttributeInterface.php index e21ddea348c..7435c67c19f 100644 --- a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/AttributeInterface.php +++ b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/AttributeInterface.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\View\TemplateEngine\Xhtml\Compiler; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Interface AttributeInterface @@ -16,8 +16,8 @@ interface AttributeInterface * Compiles the Element node * * @param \DOMAttr $node - * @param Object $processedObject + * @param DataObject $processedObject * @return void */ - public function compile(\DOMAttr $node, Object $processedObject); + public function compile(\DOMAttr $node, DataObject $processedObject); } diff --git a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Cdata.php b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Cdata.php index 4d965b1d50a..12d736b0b72 100644 --- a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Cdata.php +++ b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Cdata.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\View\TemplateEngine\Xhtml\Compiler; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Class Cdata @@ -16,10 +16,10 @@ class Cdata implements CdataInterface * Compiles the CData Section node * * @param \DOMCdataSection $node - * @param Object $processedObject + * @param DataObject $processedObject * @return void */ - public function compile(\DOMCdataSection $node, Object $processedObject) + public function compile(\DOMCdataSection $node, DataObject $processedObject) { // } diff --git a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/CdataInterface.php b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/CdataInterface.php index 621303fecb5..fabc6fd6fa5 100644 --- a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/CdataInterface.php +++ b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/CdataInterface.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\View\TemplateEngine\Xhtml\Compiler; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Interface CdataInterface @@ -16,8 +16,8 @@ interface CdataInterface * Compiles the CData Section node * * @param \DOMCdataSection $node - * @param Object $processedObject + * @param DataObject $processedObject * @return void */ - public function compile(\DOMCdataSection $node, Object $processedObject); + public function compile(\DOMCdataSection $node, DataObject $processedObject); } diff --git a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Comment.php b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Comment.php index 1f14b7315c0..cb68dc71e71 100644 --- a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Comment.php +++ b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Comment.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\View\TemplateEngine\Xhtml\Compiler; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Class Comment @@ -16,10 +16,10 @@ class Comment implements CommentInterface * Compiles the Comment node * * @param \DOMComment $node - * @param Object $processedObject + * @param DataObject $processedObject * @return void */ - public function compile(\DOMComment $node, Object $processedObject) + public function compile(\DOMComment $node, DataObject $processedObject) { // } diff --git a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/CommentInterface.php b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/CommentInterface.php index 464e5fb062f..08ef25c3247 100644 --- a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/CommentInterface.php +++ b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/CommentInterface.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\View\TemplateEngine\Xhtml\Compiler; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Interface CommentInterface @@ -16,8 +16,8 @@ interface CommentInterface * Compiles the Comment node * * @param \DOMComment $node - * @param Object $processedObject + * @param DataObject $processedObject * @return void */ - public function compile(\DOMComment $node, Object $processedObject); + public function compile(\DOMComment $node, DataObject $processedObject); } diff --git a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Directive/CallableMethod.php b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Directive/CallableMethod.php index 105ffafd7f5..e40798c3dec 100644 --- a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Directive/CallableMethod.php +++ b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Directive/CallableMethod.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\View\TemplateEngine\Xhtml\Compiler\Directive; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Class CallableMethod @@ -16,10 +16,10 @@ class CallableMethod implements DirectiveInterface * Execute directive * * @param array $directive - * @param Object $processedObject + * @param DataObject $processedObject * @return string */ - public function execute($directive, Object $processedObject) + public function execute($directive, DataObject $processedObject) { $object = $processedObject; $result = ''; diff --git a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Directive/DirectiveInterface.php b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Directive/DirectiveInterface.php index 6687801ba0f..38c14801bc3 100644 --- a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Directive/DirectiveInterface.php +++ b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Directive/DirectiveInterface.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\View\TemplateEngine\Xhtml\Compiler\Directive; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Interface DirectiveInterface @@ -16,10 +16,10 @@ interface DirectiveInterface * Execute directive * * @param array $directive - * @param Object $processedObject + * @param DataObject $processedObject * @return string */ - public function execute($directive, Object $processedObject); + public function execute($directive, DataObject $processedObject); /** * Get regexp search pattern diff --git a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Directive/Variable.php b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Directive/Variable.php index ef3a8bfa5df..74332de4d74 100644 --- a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Directive/Variable.php +++ b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Directive/Variable.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\View\TemplateEngine\Xhtml\Compiler\Directive; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Class Variable @@ -16,10 +16,10 @@ class Variable implements DirectiveInterface * Execute directive * * @param array $directive - * @param Object $processedObject + * @param DataObject $processedObject * @return string */ - public function execute($directive, Object $processedObject) + public function execute($directive, DataObject $processedObject) { return $processedObject->getData($directive[1]); } diff --git a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Element/ElementInterface.php b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Element/ElementInterface.php index eec42c573ff..27dd62a633c 100644 --- a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Element/ElementInterface.php +++ b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Element/ElementInterface.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\View\TemplateEngine\Xhtml\Compiler\Element; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\View\TemplateEngine\Xhtml\CompilerInterface; /** @@ -18,9 +18,14 @@ interface ElementInterface * * @param CompilerInterface $compiler * @param \DOMElement $node - * @param Object $processedObject - * @param Object $context + * @param DataObject $processedObject + * @param DataObject $context * @return void */ - public function compile(CompilerInterface $compiler, \DOMElement $node, Object $processedObject, Object $context); + public function compile( + CompilerInterface $compiler, + \DOMElement $node, + DataObject $processedObject, + DataObject $context + ); } diff --git a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Text.php b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Text.php index 3d6b9750107..9a875574e10 100644 --- a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Text.php +++ b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/Text.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\View\TemplateEngine\Xhtml\Compiler; -use Magento\Framework\Object; +use Magento\Framework\DataObject; use Magento\Framework\View\TemplateEngine\Xhtml\Compiler\Directive\DirectiveInterface; /** @@ -32,10 +32,10 @@ class Text implements TextInterface * Compiles the Element node * * @param \DOMText $node - * @param Object $processedObject + * @param DataObject $processedObject * @return void */ - public function compile(\DOMText $node, Object $processedObject) + public function compile(\DOMText $node, DataObject $processedObject) { $result = ''; foreach ($this->directivePool as $directive) { diff --git a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/TextInterface.php b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/TextInterface.php index 19170aa95bd..6f5654cb2e3 100644 --- a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/TextInterface.php +++ b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler/TextInterface.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\View\TemplateEngine\Xhtml\Compiler; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Interface TextInterface @@ -16,8 +16,8 @@ interface TextInterface * Compiles the Element node * * @param \DOMText $node - * @param Object $processedObject + * @param DataObject $processedObject * @return void */ - public function compile(\DOMText $node, Object $processedObject); + public function compile(\DOMText $node, DataObject $processedObject); } diff --git a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/CompilerInterface.php b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/CompilerInterface.php index 6bbaead2574..2ad63ca8da4 100644 --- a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/CompilerInterface.php +++ b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/CompilerInterface.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\View\TemplateEngine\Xhtml; -use Magento\Framework\Object; +use Magento\Framework\DataObject; /** * Interface CompilerInterface @@ -22,7 +22,7 @@ interface CompilerInterface * @param Object $context * @return void */ - public function compile(\DOMNode $node, Object $dataObject, Object $context); + public function compile(\DOMNode $node, DataObject $dataObject, DataObject $context); /** * Run postprocessing contents diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Element/TemplateTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Element/TemplateTest.php index 33bba78c623..ff74bfe6f47 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Element/TemplateTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Element/TemplateTest.php @@ -132,7 +132,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase public function testSetTemplateContext() { $template = 'themedir/template.phtml'; - $context = new \Magento\Framework\Object(); + $context = new \Magento\Framework\DataObject(); $this->_validator->expects($this->once()) ->method('isValid') ->with($template) diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Layout/Argument/Interpreter/ObjectTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Layout/Argument/Interpreter/ObjectTest.php index e50cb5fcab0..9c56c9c9144 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Layout/Argument/Interpreter/ObjectTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Layout/Argument/Interpreter/ObjectTest.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\View\Test\Unit\Layout\Argument\Interpreter; -use \Magento\Framework\View\Layout\Argument\Interpreter\Object; +use \Magento\Framework\View\Layout\Argument\Interpreter\DataObject; class ObjectTest extends \PHPUnit_Framework_TestCase { @@ -22,14 +22,14 @@ class ObjectTest extends \PHPUnit_Framework_TestCase protected $_interpreter; /** - * @var Object + * @var DataObject */ protected $_model; protected function setUp() { $this->_objectManager = $this->getMock('Magento\Framework\ObjectManagerInterface'); - $this->_model = new Object($this->_objectManager, self::EXPECTED_CLASS); + $this->_model = new DataObject($this->_objectManager, self::EXPECTED_CLASS); } public function testEvaluate() diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/FactoryTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/FactoryTest.php index b41892dd0db..c977fd2c0e9 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/FactoryTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/FactoryTest.php @@ -6,6 +6,8 @@ namespace Magento\Framework\View\Test\Unit\Layout\Reader; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; + class FactoryTest extends \PHPUnit_Framework_TestCase { public function testCreateInvalidArgument() @@ -13,7 +15,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase $className = 'class_name'; $data = ['data']; - $object = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this))->getObject('Magento\Framework\Object'); + $object = (new ObjectManager($this))->getObject('Magento\Framework\DataObject'); /** @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject $objectManager */ $objectManager = $this->getMock('Magento\Framework\ObjectManagerInterface'); diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/RendererTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/RendererTest.php index cd938b2bce9..62c52b45cc8 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/RendererTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/RendererTest.php @@ -49,7 +49,7 @@ class RendererTest extends \PHPUnit_Framework_TestCase protected $escaperMock; /** - * @var \Magento\Framework\Stdlib\String|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Stdlib\StringUtils|\PHPUnit_Framework_MockObject_MockObject */ protected $stringMock; @@ -92,7 +92,7 @@ class RendererTest extends \PHPUnit_Framework_TestCase ->method('escapeHtml') ->willReturnArgument(0); - $this->stringMock = $this->getMockBuilder('Magento\Framework\Stdlib\String') + $this->stringMock = $this->getMockBuilder('Magento\Framework\Stdlib\StringUtils') ->disableOriginalConstructor() ->getMock(); diff --git a/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/PhpTest.php b/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/PhpTest.php index ab17c14b9b3..608eb11c72b 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/PhpTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/PhpTest.php @@ -74,7 +74,7 @@ class PhpTest extends \PHPUnit_Framework_TestCase */ public function testHelperWithInvalidClass() { - $class = 'Magento\Framework\Object'; + $class = 'Magento\Framework\DataObject'; $object = $this->getMock($class, [], [], '', false); $this->_helperFactoryMock->expects( $this->once() diff --git a/lib/internal/Magento/Framework/Webapi/Rest/Request.php b/lib/internal/Magento/Framework/Webapi/Rest/Request.php index 49989a9a099..757f1a27294 100644 --- a/lib/internal/Magento/Framework/Webapi/Rest/Request.php +++ b/lib/internal/Magento/Framework/Webapi/Rest/Request.php @@ -123,7 +123,12 @@ class Request extends \Magento\Framework\Webapi\Request public function getBodyParams() { if (null == $this->_bodyParams) { - $this->_bodyParams = (array)$this->_getDeserializer()->deserialize((string)$this->getContent()); + $this->_bodyParams = []; + //avoid JSON decoding with empty string + if ($this->getContent()) { + $this->_bodyParams = (array)$this->_getDeserializer()->deserialize((string)$this->getContent()); + } + } return $this->_bodyParams; } diff --git a/lib/internal/Magento/Framework/Webapi/Rest/Response/Renderer/Xml.php b/lib/internal/Magento/Framework/Webapi/Rest/Response/Renderer/Xml.php index 806bfcefca1..9162989969b 100644 --- a/lib/internal/Magento/Framework/Webapi/Rest/Response/Renderer/Xml.php +++ b/lib/internal/Magento/Framework/Webapi/Rest/Response/Renderer/Xml.php @@ -67,7 +67,7 @@ class Xml implements \Magento\Framework\Webapi\Rest\Response\RendererInterface * * This method is recursive. * - * @param array|\Magento\Framework\Object $data + * @param array|\Magento\Framework\DataObject $data * @param bool $isRoot * @return array * @throws \InvalidArgumentException @@ -78,7 +78,7 @@ class Xml implements \Magento\Framework\Webapi\Rest\Response\RendererInterface if ($isRoot) { return $this->_formatValue($data); } - } elseif ($data instanceof \Magento\Framework\Object) { + } elseif ($data instanceof \Magento\Framework\DataObject) { $data = $data->toArray(); } else { $data = (array)$data; diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/Rest/RequestTest.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/Rest/RequestTest.php index 3f73a3adb87..fd3ab91301b 100644 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/Rest/RequestTest.php +++ b/lib/internal/Magento/Framework/Webapi/Test/Unit/Rest/RequestTest.php @@ -93,7 +93,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase protected function _prepareSutForGetBodyParamsTest($params) { $content = 'rawBody'; - $this->_request->expects($this->once())->method('getContent')->will($this->returnValue($content)); + $this->_request->expects($this->exactly(2))->method('getContent')->will($this->returnValue($content)); $contentType = 'contentType'; $this->_request->expects( $this->once() diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/Rest/Response/Renderer/XmlTest.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/Rest/Response/Renderer/XmlTest.php index 7f1db27b260..b6a59383b06 100644 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/Rest/Response/Renderer/XmlTest.php +++ b/lib/internal/Magento/Framework/Webapi/Test/Unit/Rest/Response/Renderer/XmlTest.php @@ -97,9 +97,9 @@ class XmlTest extends \PHPUnit_Framework_TestCase 'Invalid XML render with simple data.' ], [ - new \Magento\Framework\Object(['key' => 'value']), + new \Magento\Framework\DataObject(['key' => 'value']), '<?xml version="1.0"?><response><key>value</key></response>', - 'Invalid XML render with \Magento\Framework\Object data.' + 'Invalid XML render with \Magento\Framework\DataObject data.' ] ]; } diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/Rest/Response/RendererFactoryTest.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/Rest/Response/RendererFactoryTest.php index 506419d1bbf..b350c887125 100644 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/Rest/Response/RendererFactoryTest.php +++ b/lib/internal/Magento/Framework/Webapi/Test/Unit/Rest/Response/RendererFactoryTest.php @@ -97,7 +97,7 @@ class RendererFactoryTest extends \PHPUnit_Framework_TestCase $acceptTypes = ['application/json']; /** Mock request getAcceptTypes method to return specified value. */ $this->_requestMock->expects($this->once())->method('getAcceptTypes')->will($this->returnValue($acceptTypes)); - /** Mock object to return \Magento\Framework\Object */ + /** Mock object to return \Magento\Framework\DataObject */ $this->_objectManagerMock->expects( $this->once() )->method( @@ -105,7 +105,7 @@ class RendererFactoryTest extends \PHPUnit_Framework_TestCase )->with( 'Magento\Framework\Webapi\Rest\Response\Renderer\Json' )->will( - $this->returnValue(new \Magento\Framework\Object()) + $this->returnValue(new \Magento\Framework\DataObject()) ); $this->setExpectedException( diff --git a/lib/internal/phpseclib/Crypt/AES.php b/lib/internal/phpseclib/Crypt/AES.php deleted file mode 100644 index 3beffa9f7b2..00000000000 --- a/lib/internal/phpseclib/Crypt/AES.php +++ /dev/null @@ -1,479 +0,0 @@ -<?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * Pure-PHP implementation of AES. - * - * Uses mcrypt, if available, and an internal implementation, otherwise. - * - * PHP versions 4 and 5 - * - * If {@link Crypt_AES::setKeyLength() setKeyLength()} isn't called, it'll be calculated from - * {@link Crypt_AES::setKey() setKey()}. ie. if the key is 128-bits, the key length will be 128-bits. If it's 136-bits - * it'll be null-padded to 160-bits and 160 bits will be the key length until {@link Crypt_Rijndael::setKey() setKey()} - * is called, again, at which point, it'll be recalculated. - * - * Since Crypt_AES extends Crypt_Rijndael, some functions are available to be called that, in the context of AES, don't - * make a whole lot of sense. {@link Crypt_AES::setBlockLength() setBlockLength()}, for instance. Calling that function, - * however possible, won't do anything (AES has a fixed block length whereas Rijndael has a variable one). - * - * Here's a short example of how to use this library: - * <code> - * <?php - * include('Crypt/AES.php'); - * - * $aes = new Crypt_AES(); - * - * $aes->setKey('abcdefghijklmnop'); - * - * $size = 10 * 1024; - * $plaintext = ''; - * for ($i = 0; $i < $size; $i++) { - * $plaintext.= 'a'; - * } - * - * echo $aes->decrypt($aes->encrypt($plaintext)); - * ?> - * </code> - * - * LICENSE: This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - * @category Crypt - * @package Crypt_AES - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMVIII Jim Wigginton - * @license http://www.gnu.org/licenses/lgpl.txt - * @version $Id: AES.php,v 1.7 2010/02/09 06:10:25 terrafrost Exp $ - * @link http://phpseclib.sourceforge.net - */ - -/** - * Include Crypt_Rijndael - */ -require_once 'Rijndael.php'; - -/**#@+ - * @access public - * @see Crypt_AES::encrypt() - * @see Crypt_AES::decrypt() - */ -/** - * Encrypt / decrypt using the Counter mode. - * - * Set to -1 since that's what Crypt/Random.php uses to index the CTR mode. - * - * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29 - */ -define('CRYPT_AES_MODE_CTR', -1); -/** - * Encrypt / decrypt using the Electronic Code Book mode. - * - * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29 - */ -define('CRYPT_AES_MODE_ECB', 1); -/** - * Encrypt / decrypt using the Code Book Chaining mode. - * - * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29 - */ -define('CRYPT_AES_MODE_CBC', 2); -/**#@-*/ - -/**#@+ - * @access private - * @see Crypt_AES::Crypt_AES() - */ -/** - * Toggles the internal implementation - */ -define('CRYPT_AES_MODE_INTERNAL', 1); -/** - * Toggles the mcrypt implementation - */ -define('CRYPT_AES_MODE_MCRYPT', 2); -/**#@-*/ - -/** - * Pure-PHP implementation of AES. - * - * @author Jim Wigginton <terrafrost@php.net> - * @version 0.1.0 - * @access public - * @package Crypt_AES - */ -class Crypt_AES extends Crypt_Rijndael { - /** - * mcrypt resource for encryption - * - * The mcrypt resource can be recreated every time something needs to be created or it can be created just once. - * Since mcrypt operates in continuous mode, by default, it'll need to be recreated when in non-continuous mode. - * - * @see Crypt_AES::encrypt() - * @var String - * @access private - */ - var $enmcrypt; - - /** - * mcrypt resource for decryption - * - * The mcrypt resource can be recreated every time something needs to be created or it can be created just once. - * Since mcrypt operates in continuous mode, by default, it'll need to be recreated when in non-continuous mode. - * - * @see Crypt_AES::decrypt() - * @var String - * @access private - */ - var $demcrypt; - - /** - * Default Constructor. - * - * Determines whether or not the mcrypt extension should be used. $mode should only, at present, be - * CRYPT_AES_MODE_ECB or CRYPT_AES_MODE_CBC. If not explictly set, CRYPT_AES_MODE_CBC will be used. - * - * @param optional Integer $mode - * @return Crypt_AES - * @access public - */ - function Crypt_AES($mode = CRYPT_AES_MODE_CBC) - { - if ( !defined('CRYPT_AES_MODE') ) { - switch (true) { - case extension_loaded('mcrypt'): - // i'd check to see if aes was supported, by doing in_array('des', mcrypt_list_algorithms('')), - // but since that can be changed after the object has been created, there doesn't seem to be - // a lot of point... - define('CRYPT_AES_MODE', CRYPT_AES_MODE_MCRYPT); - break; - default: - define('CRYPT_AES_MODE', CRYPT_AES_MODE_INTERNAL); - } - } - - switch ( CRYPT_AES_MODE ) { - case CRYPT_AES_MODE_MCRYPT: - switch ($mode) { - case CRYPT_AES_MODE_ECB: - $this->mode = MCRYPT_MODE_ECB; - break; - case CRYPT_AES_MODE_CTR: - // ctr doesn't have a constant associated with it even though it appears to be fairly widely - // supported. in lieu of knowing just how widely supported it is, i've, for now, opted not to - // include a compatibility layer. the layer has been implemented but, for now, is commented out. - $this->mode = 'ctr'; - //$this->mode = in_array('ctr', mcrypt_list_modes()) ? 'ctr' : CRYPT_AES_MODE_CTR; - break; - case CRYPT_AES_MODE_CBC: - default: - $this->mode = MCRYPT_MODE_CBC; - } - - break; - default: - switch ($mode) { - case CRYPT_AES_MODE_ECB: - $this->mode = CRYPT_RIJNDAEL_MODE_ECB; - break; - case CRYPT_AES_MODE_CTR: - $this->mode = CRYPT_RIJNDAEL_MODE_CTR; - break; - case CRYPT_AES_MODE_CBC: - default: - $this->mode = CRYPT_RIJNDAEL_MODE_CBC; - } - } - - if (CRYPT_AES_MODE == CRYPT_AES_MODE_INTERNAL) { - parent::Crypt_Rijndael($this->mode); - } - } - - /** - * Dummy function - * - * Since Crypt_AES extends Crypt_Rijndael, this function is, technically, available, but it doesn't do anything. - * - * @access public - * @param Integer $length - */ - function setBlockLength($length) - { - return; - } - - /** - * Encrypts a message. - * - * $plaintext will be padded with up to 16 additional bytes. Other AES implementations may or may not pad in the - * same manner. Other common approaches to padding and the reasons why it's necessary are discussed in the following - * URL: - * - * {@link http://www.di-mgt.com.au/cryptopad.html http://www.di-mgt.com.au/cryptopad.html} - * - * An alternative to padding is to, separately, send the length of the file. This is what SSH, in fact, does. - * strlen($plaintext) will still need to be a multiple of 16, however, arbitrary values can be added to make it that - * length. - * - * @see Crypt_AES::decrypt() - * @access public - * @param String $plaintext - */ - function encrypt($plaintext) - { - if ( CRYPT_AES_MODE == CRYPT_AES_MODE_MCRYPT ) { - $this->_mcryptSetup(); - /* - if ($this->mode == CRYPT_AES_MODE_CTR) { - $iv = $this->encryptIV; - $xor = mcrypt_generic($this->enmcrypt, $this->_generate_xor(strlen($plaintext), $iv)); - $ciphertext = $plaintext ^ $xor; - if ($this->continuousBuffer) { - $this->encryptIV = $iv; - } - return $ciphertext; - } - */ - - if ($this->mode != 'ctr') { - $plaintext = $this->_pad($plaintext); - } - - $ciphertext = mcrypt_generic($this->enmcrypt, $plaintext); - - if (!$this->continuousBuffer) { - mcrypt_generic_init($this->enmcrypt, $this->key, $this->iv); - } - - return $ciphertext; - } - - return parent::encrypt($plaintext); - } - - /** - * Decrypts a message. - * - * If strlen($ciphertext) is not a multiple of 16, null bytes will be added to the end of the string until it is. - * - * @see Crypt_AES::encrypt() - * @access public - * @param String $ciphertext - */ - function decrypt($ciphertext) - { - if ( CRYPT_AES_MODE == CRYPT_AES_MODE_MCRYPT ) { - $this->_mcryptSetup(); - /* - if ($this->mode == CRYPT_AES_MODE_CTR) { - $iv = $this->decryptIV; - $xor = mcrypt_generic($this->enmcrypt, $this->_generate_xor(strlen($ciphertext), $iv)); - $plaintext = $ciphertext ^ $xor; - if ($this->continuousBuffer) { - $this->decryptIV = $iv; - } - return $plaintext; - } - */ - - if ($this->mode != 'ctr') { - // we pad with chr(0) since that's what mcrypt_generic does. to quote from http://php.net/function.mcrypt-generic : - // "The data is padded with "\0" to make sure the length of the data is n * blocksize." - $ciphertext = str_pad($ciphertext, (strlen($ciphertext) + 15) & 0xFFFFFFF0, chr(0)); - } - - $plaintext = mdecrypt_generic($this->demcrypt, $ciphertext); - - if (!$this->continuousBuffer) { - mcrypt_generic_init($this->demcrypt, $this->key, $this->iv); - } - - return $this->mode != 'ctr' ? $this->_unpad($plaintext) : $plaintext; - } - - return parent::decrypt($ciphertext); - } - - /** - * Setup mcrypt - * - * Validates all the variables. - * - * @access private - */ - function _mcryptSetup() - { - if (!$this->changed) { - return; - } - - if (!$this->explicit_key_length) { - // this just copied from Crypt_Rijndael::_setup() - $length = strlen($this->key) >> 2; - if ($length > 8) { - $length = 8; - } else if ($length < 4) { - $length = 4; - } - $this->Nk = $length; - $this->key_size = $length << 2; - } - - switch ($this->Nk) { - case 4: // 128 - $this->key_size = 16; - break; - case 5: // 160 - case 6: // 192 - $this->key_size = 24; - break; - case 7: // 224 - case 8: // 256 - $this->key_size = 32; - } - - $this->key = substr($this->key, 0, $this->key_size); - $this->encryptIV = $this->decryptIV = $this->iv = str_pad(substr($this->iv, 0, 16), 16, chr(0)); - - if (!isset($this->enmcrypt)) { - $mode = $this->mode; - //$mode = $this->mode == CRYPT_AES_MODE_CTR ? MCRYPT_MODE_ECB : $this->mode; - - $this->demcrypt = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', $mode, ''); - $this->enmcrypt = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', $mode, ''); - } // else should mcrypt_generic_deinit be called? - - mcrypt_generic_init($this->demcrypt, $this->key, $this->iv); - mcrypt_generic_init($this->enmcrypt, $this->key, $this->iv); - - $this->changed = false; - } - - /** - * Encrypts a block - * - * Optimized over Crypt_Rijndael's implementation by means of loop unrolling. - * - * @see Crypt_Rijndael::_encryptBlock() - * @access private - * @param String $in - * @return String - */ - function _encryptBlock($in) - { - $state = unpack('N*word', $in); - - $Nr = $this->Nr; - $w = $this->w; - $t0 = $this->t0; - $t1 = $this->t1; - $t2 = $this->t2; - $t3 = $this->t3; - - // addRoundKey and reindex $state - $state = array( - $state['word1'] ^ $w[0][0], - $state['word2'] ^ $w[0][1], - $state['word3'] ^ $w[0][2], - $state['word4'] ^ $w[0][3] - ); - - // shiftRows + subWord + mixColumns + addRoundKey - // we could loop unroll this and use if statements to do more rounds as necessary, but, in my tests, that yields - // only a marginal improvement. since that also, imho, hinders the readability of the code, i've opted not to do it. - for ($round = 1; $round < $this->Nr; $round++) { - $state = array( - $t0[$state[0] & 0xFF000000] ^ $t1[$state[1] & 0x00FF0000] ^ $t2[$state[2] & 0x0000FF00] ^ $t3[$state[3] & 0x000000FF] ^ $w[$round][0], - $t0[$state[1] & 0xFF000000] ^ $t1[$state[2] & 0x00FF0000] ^ $t2[$state[3] & 0x0000FF00] ^ $t3[$state[0] & 0x000000FF] ^ $w[$round][1], - $t0[$state[2] & 0xFF000000] ^ $t1[$state[3] & 0x00FF0000] ^ $t2[$state[0] & 0x0000FF00] ^ $t3[$state[1] & 0x000000FF] ^ $w[$round][2], - $t0[$state[3] & 0xFF000000] ^ $t1[$state[0] & 0x00FF0000] ^ $t2[$state[1] & 0x0000FF00] ^ $t3[$state[2] & 0x000000FF] ^ $w[$round][3] - ); - - } - - // subWord - $state = array( - $this->_subWord($state[0]), - $this->_subWord($state[1]), - $this->_subWord($state[2]), - $this->_subWord($state[3]) - ); - - // shiftRows + addRoundKey - $state = array( - ($state[0] & 0xFF000000) ^ ($state[1] & 0x00FF0000) ^ ($state[2] & 0x0000FF00) ^ ($state[3] & 0x000000FF) ^ $this->w[$this->Nr][0], - ($state[1] & 0xFF000000) ^ ($state[2] & 0x00FF0000) ^ ($state[3] & 0x0000FF00) ^ ($state[0] & 0x000000FF) ^ $this->w[$this->Nr][1], - ($state[2] & 0xFF000000) ^ ($state[3] & 0x00FF0000) ^ ($state[0] & 0x0000FF00) ^ ($state[1] & 0x000000FF) ^ $this->w[$this->Nr][2], - ($state[3] & 0xFF000000) ^ ($state[0] & 0x00FF0000) ^ ($state[1] & 0x0000FF00) ^ ($state[2] & 0x000000FF) ^ $this->w[$this->Nr][3] - ); - - return pack('N*', $state[0], $state[1], $state[2], $state[3]); - } - - /** - * Decrypts a block - * - * Optimized over Crypt_Rijndael's implementation by means of loop unrolling. - * - * @see Crypt_Rijndael::_decryptBlock() - * @access private - * @param String $in - * @return String - */ - function _decryptBlock($in) - { - $state = unpack('N*word', $in); - - $Nr = $this->Nr; - $dw = $this->dw; - $dt0 = $this->dt0; - $dt1 = $this->dt1; - $dt2 = $this->dt2; - $dt3 = $this->dt3; - - // addRoundKey and reindex $state - $state = array( - $state['word1'] ^ $dw[$this->Nr][0], - $state['word2'] ^ $dw[$this->Nr][1], - $state['word3'] ^ $dw[$this->Nr][2], - $state['word4'] ^ $dw[$this->Nr][3] - ); - - - // invShiftRows + invSubBytes + invMixColumns + addRoundKey - for ($round = $this->Nr - 1; $round > 0; $round--) { - $state = array( - $dt0[$state[0] & 0xFF000000] ^ $dt1[$state[3] & 0x00FF0000] ^ $dt2[$state[2] & 0x0000FF00] ^ $dt3[$state[1] & 0x000000FF] ^ $dw[$round][0], - $dt0[$state[1] & 0xFF000000] ^ $dt1[$state[0] & 0x00FF0000] ^ $dt2[$state[3] & 0x0000FF00] ^ $dt3[$state[2] & 0x000000FF] ^ $dw[$round][1], - $dt0[$state[2] & 0xFF000000] ^ $dt1[$state[1] & 0x00FF0000] ^ $dt2[$state[0] & 0x0000FF00] ^ $dt3[$state[3] & 0x000000FF] ^ $dw[$round][2], - $dt0[$state[3] & 0xFF000000] ^ $dt1[$state[2] & 0x00FF0000] ^ $dt2[$state[1] & 0x0000FF00] ^ $dt3[$state[0] & 0x000000FF] ^ $dw[$round][3] - ); - } - - // invShiftRows + invSubWord + addRoundKey - $state = array( - $this->_invSubWord(($state[0] & 0xFF000000) ^ ($state[3] & 0x00FF0000) ^ ($state[2] & 0x0000FF00) ^ ($state[1] & 0x000000FF)) ^ $dw[0][0], - $this->_invSubWord(($state[1] & 0xFF000000) ^ ($state[0] & 0x00FF0000) ^ ($state[3] & 0x0000FF00) ^ ($state[2] & 0x000000FF)) ^ $dw[0][1], - $this->_invSubWord(($state[2] & 0xFF000000) ^ ($state[1] & 0x00FF0000) ^ ($state[0] & 0x0000FF00) ^ ($state[3] & 0x000000FF)) ^ $dw[0][2], - $this->_invSubWord(($state[3] & 0xFF000000) ^ ($state[2] & 0x00FF0000) ^ ($state[1] & 0x0000FF00) ^ ($state[0] & 0x000000FF)) ^ $dw[0][3] - ); - - return pack('N*', $state[0], $state[1], $state[2], $state[3]); - } -} - -// vim: ts=4:sw=4:et: -// vim6: fdl=1: diff --git a/lib/internal/phpseclib/Crypt/DES.php b/lib/internal/phpseclib/Crypt/DES.php deleted file mode 100644 index fe31df8932e..00000000000 --- a/lib/internal/phpseclib/Crypt/DES.php +++ /dev/null @@ -1,945 +0,0 @@ -<?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * Pure-PHP implementation of DES. - * - * Uses mcrypt, if available, and an internal implementation, otherwise. - * - * PHP versions 4 and 5 - * - * Useful resources are as follows: - * - * - {@link http://en.wikipedia.org/wiki/DES_supplementary_material Wikipedia: DES supplementary material} - * - {@link http://www.itl.nist.gov/fipspubs/fip46-2.htm FIPS 46-2 - (DES), Data Encryption Standard} - * - {@link http://www.cs.eku.edu/faculty/styer/460/Encrypt/JS-DES.html JavaScript DES Example} - * - * Here's a short example of how to use this library: - * <code> - * <?php - * include('Crypt/DES.php'); - * - * $des = new Crypt_DES(); - * - * $des->setKey('abcdefgh'); - * - * $size = 10 * 1024; - * $plaintext = ''; - * for ($i = 0; $i < $size; $i++) { - * $plaintext.= 'a'; - * } - * - * echo $des->decrypt($des->encrypt($plaintext)); - * ?> - * </code> - * - * LICENSE: This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - * @category Crypt - * @package Crypt_DES - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMVII Jim Wigginton - * @license http://www.gnu.org/licenses/lgpl.txt - * @version $Id: DES.php,v 1.12 2010/02/09 06:10:26 terrafrost Exp $ - * @link http://phpseclib.sourceforge.net - */ - -/**#@+ - * @access private - * @see Crypt_DES::_prepareKey() - * @see Crypt_DES::_processBlock() - */ -/** - * Contains array_reverse($keys[CRYPT_DES_DECRYPT]) - */ -define('CRYPT_DES_ENCRYPT', 0); -/** - * Contains array_reverse($keys[CRYPT_DES_ENCRYPT]) - */ -define('CRYPT_DES_DECRYPT', 1); -/**#@-*/ - -/**#@+ - * @access public - * @see Crypt_DES::encrypt() - * @see Crypt_DES::decrypt() - */ -/** - * Encrypt / decrypt using the Counter mode. - * - * Set to -1 since that's what Crypt/Random.php uses to index the CTR mode. - * - * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29 - */ -define('CRYPT_DES_MODE_CTR', -1); -/** - * Encrypt / decrypt using the Electronic Code Book mode. - * - * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29 - */ -define('CRYPT_DES_MODE_ECB', 1); -/** - * Encrypt / decrypt using the Code Book Chaining mode. - * - * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29 - */ -define('CRYPT_DES_MODE_CBC', 2); -/**#@-*/ - -/**#@+ - * @access private - * @see Crypt_DES::Crypt_DES() - */ -/** - * Toggles the internal implementation - */ -define('CRYPT_DES_MODE_INTERNAL', 1); -/** - * Toggles the mcrypt implementation - */ -define('CRYPT_DES_MODE_MCRYPT', 2); -/**#@-*/ - -/** - * Pure-PHP implementation of DES. - * - * @author Jim Wigginton <terrafrost@php.net> - * @version 0.1.0 - * @access public - * @package Crypt_DES - */ -class Crypt_DES { - /** - * The Key Schedule - * - * @see Crypt_DES::setKey() - * @var Array - * @access private - */ - var $keys = "\0\0\0\0\0\0\0\0"; - - /** - * The Encryption Mode - * - * @see Crypt_DES::Crypt_DES() - * @var Integer - * @access private - */ - var $mode; - - /** - * Continuous Buffer status - * - * @see Crypt_DES::enableContinuousBuffer() - * @var Boolean - * @access private - */ - var $continuousBuffer = false; - - /** - * Padding status - * - * @see Crypt_DES::enablePadding() - * @var Boolean - * @access private - */ - var $padding = true; - - /** - * The Initialization Vector - * - * @see Crypt_DES::setIV() - * @var String - * @access private - */ - var $iv = "\0\0\0\0\0\0\0\0"; - - /** - * A "sliding" Initialization Vector - * - * @see Crypt_DES::enableContinuousBuffer() - * @var String - * @access private - */ - var $encryptIV = "\0\0\0\0\0\0\0\0"; - - /** - * A "sliding" Initialization Vector - * - * @see Crypt_DES::enableContinuousBuffer() - * @var String - * @access private - */ - var $decryptIV = "\0\0\0\0\0\0\0\0"; - - /** - * mcrypt resource for encryption - * - * The mcrypt resource can be recreated every time something needs to be created or it can be created just once. - * Since mcrypt operates in continuous mode, by default, it'll need to be recreated when in non-continuous mode. - * - * @see Crypt_AES::encrypt() - * @var String - * @access private - */ - var $enmcrypt; - - /** - * mcrypt resource for decryption - * - * The mcrypt resource can be recreated every time something needs to be created or it can be created just once. - * Since mcrypt operates in continuous mode, by default, it'll need to be recreated when in non-continuous mode. - * - * @see Crypt_AES::decrypt() - * @var String - * @access private - */ - var $demcrypt; - - /** - * Does the (en|de)mcrypt resource need to be (re)initialized? - * - * @see setKey() - * @see setIV() - * @var Boolean - * @access private - */ - var $changed = true; - - /** - * Default Constructor. - * - * Determines whether or not the mcrypt extension should be used. $mode should only, at present, be - * CRYPT_DES_MODE_ECB or CRYPT_DES_MODE_CBC. If not explictly set, CRYPT_DES_MODE_CBC will be used. - * - * @param optional Integer $mode - * @return Crypt_DES - * @access public - */ - function Crypt_DES($mode = CRYPT_MODE_DES_CBC) - { - if ( !defined('CRYPT_DES_MODE') ) { - switch (true) { - case extension_loaded('mcrypt'): - // i'd check to see if des was supported, by doing in_array('des', mcrypt_list_algorithms('')), - // but since that can be changed after the object has been created, there doesn't seem to be - // a lot of point... - define('CRYPT_DES_MODE', CRYPT_DES_MODE_MCRYPT); - break; - default: - define('CRYPT_DES_MODE', CRYPT_DES_MODE_INTERNAL); - } - } - - switch ( CRYPT_DES_MODE ) { - case CRYPT_DES_MODE_MCRYPT: - switch ($mode) { - case CRYPT_DES_MODE_ECB: - $this->mode = MCRYPT_MODE_ECB; - break; - case CRYPT_DES_MODE_CTR: - $this->mode = 'ctr'; - //$this->mode = in_array('ctr', mcrypt_list_modes()) ? 'ctr' : CRYPT_DES_MODE_CTR; - break; - case CRYPT_DES_MODE_CBC: - default: - $this->mode = MCRYPT_MODE_CBC; - } - - break; - default: - switch ($mode) { - case CRYPT_DES_MODE_ECB: - case CRYPT_DES_MODE_CTR: - case CRYPT_DES_MODE_CBC: - $this->mode = $mode; - break; - default: - $this->mode = CRYPT_DES_MODE_CBC; - } - } - } - - /** - * Sets the key. - * - * Keys can be of any length. DES, itself, uses 64-bit keys (eg. strlen($key) == 8), however, we - * only use the first eight, if $key has more then eight characters in it, and pad $key with the - * null byte if it is less then eight characters long. - * - * DES also requires that every eighth bit be a parity bit, however, we'll ignore that. - * - * If the key is not explicitly set, it'll be assumed to be all zero's. - * - * @access public - * @param String $key - */ - function setKey($key) - { - $this->keys = ( CRYPT_DES_MODE == CRYPT_DES_MODE_MCRYPT ) ? substr($key, 0, 8) : $this->_prepareKey($key); - $this->changed = true; - } - - /** - * Sets the initialization vector. (optional) - * - * SetIV is not required when CRYPT_DES_MODE_ECB is being used. If not explictly set, it'll be assumed - * to be all zero's. - * - * @access public - * @param String $iv - */ - function setIV($iv) - { - $this->encryptIV = $this->decryptIV = $this->iv = str_pad(substr($iv, 0, 8), 8, chr(0)); - $this->changed = true; - } - - /** - * Generate CTR XOR encryption key - * - * Encrypt the output of this and XOR it against the ciphertext / plaintext to get the - * plaintext / ciphertext in CTR mode. - * - * @see Crypt_DES::decrypt() - * @see Crypt_DES::encrypt() - * @access public - * @param Integer $length - * @param String $iv - */ - function _generate_xor($length, &$iv) - { - $xor = ''; - $num_blocks = ($length + 7) >> 3; - for ($i = 0; $i < $num_blocks; $i++) { - $xor.= $iv; - for ($j = 4; $j <= 8; $j+=4) { - $temp = substr($iv, -$j, 4); - switch ($temp) { - case "\xFF\xFF\xFF\xFF": - $iv = substr_replace($iv, "\x00\x00\x00\x00", -$j, 4); - break; - case "\x7F\xFF\xFF\xFF": - $iv = substr_replace($iv, "\x80\x00\x00\x00", -$j, 4); - break 2; - default: - extract(unpack('Ncount', $temp)); - $iv = substr_replace($iv, pack('N', $count + 1), -$j, 4); - break 2; - } - } - } - - return $xor; - } - - /** - * Encrypts a message. - * - * $plaintext will be padded with up to 8 additional bytes. Other DES implementations may or may not pad in the - * same manner. Other common approaches to padding and the reasons why it's necessary are discussed in the following - * URL: - * - * {@link http://www.di-mgt.com.au/cryptopad.html http://www.di-mgt.com.au/cryptopad.html} - * - * An alternative to padding is to, separately, send the length of the file. This is what SSH, in fact, does. - * strlen($plaintext) will still need to be a multiple of 8, however, arbitrary values can be added to make it that - * length. - * - * @see Crypt_DES::decrypt() - * @access public - * @param String $plaintext - */ - function encrypt($plaintext) - { - if ($this->mode != CRYPT_DES_MODE_CTR && $this->mode != 'ctr') { - $plaintext = $this->_pad($plaintext); - } - - if ( CRYPT_DES_MODE == CRYPT_DES_MODE_MCRYPT ) { - if ($this->changed) { - if (!isset($this->enmcrypt)) { - $this->enmcrypt = mcrypt_module_open(MCRYPT_DES, '', $this->mode, ''); - } - mcrypt_generic_init($this->enmcrypt, $this->keys, $this->encryptIV); - $this->changed = false; - } - - $ciphertext = mcrypt_generic($this->enmcrypt, $plaintext); - - if (!$this->continuousBuffer) { - mcrypt_generic_init($this->enmcrypt, $this->keys, $this->encryptIV); - } - - return $ciphertext; - } - - if (!is_array($this->keys)) { - $this->keys = $this->_prepareKey("\0\0\0\0\0\0\0\0"); - } - - $ciphertext = ''; - switch ($this->mode) { - case CRYPT_DES_MODE_ECB: - for ($i = 0; $i < strlen($plaintext); $i+=8) { - $ciphertext.= $this->_processBlock(substr($plaintext, $i, 8), CRYPT_DES_ENCRYPT); - } - break; - case CRYPT_DES_MODE_CBC: - $xor = $this->encryptIV; - for ($i = 0; $i < strlen($plaintext); $i+=8) { - $block = substr($plaintext, $i, 8); - $block = $this->_processBlock($block ^ $xor, CRYPT_DES_ENCRYPT); - $xor = $block; - $ciphertext.= $block; - } - if ($this->continuousBuffer) { - $this->encryptIV = $xor; - } - break; - case CRYPT_DES_MODE_CTR: - $xor = $this->encryptIV; - for ($i = 0; $i < strlen($plaintext); $i+=8) { - $block = substr($plaintext, $i, 8); - $key = $this->_processBlock($this->_generate_xor(8, $xor), CRYPT_DES_ENCRYPT); - $ciphertext.= $block ^ $key; - } - if ($this->continuousBuffer) { - $this->encryptIV = $xor; - } - } - - return $ciphertext; - } - - /** - * Decrypts a message. - * - * If strlen($ciphertext) is not a multiple of 8, null bytes will be added to the end of the string until it is. - * - * @see Crypt_DES::encrypt() - * @access public - * @param String $ciphertext - */ - function decrypt($ciphertext) - { - if ($this->mode != CRYPT_DES_MODE_CTR && $this->mode != 'ctr') { - // we pad with chr(0) since that's what mcrypt_generic does. to quote from http://php.net/function.mcrypt-generic : - // "The data is padded with "\0" to make sure the length of the data is n * blocksize." - $ciphertext = str_pad($ciphertext, (strlen($ciphertext) + 7) & 0xFFFFFFF8, chr(0)); - } - - if ( CRYPT_DES_MODE == CRYPT_DES_MODE_MCRYPT ) { - if ($this->changed) { - if (!isset($this->demcrypt)) { - $this->demcrypt = mcrypt_module_open(MCRYPT_DES, '', $this->mode, ''); - } - mcrypt_generic_init($this->demcrypt, $this->keys, $this->decryptIV); - $this->changed = false; - } - - $plaintext = mdecrypt_generic($this->demcrypt, $ciphertext); - - if (!$this->continuousBuffer) { - mcrypt_generic_init($this->demcrypt, $this->keys, $this->decryptIV); - } - - return $this->mode != 'ctr' ? $this->_unpad($plaintext) : $plaintext; - } - - if (!is_array($this->keys)) { - $this->keys = $this->_prepareKey("\0\0\0\0\0\0\0\0"); - } - - $plaintext = ''; - switch ($this->mode) { - case CRYPT_DES_MODE_ECB: - for ($i = 0; $i < strlen($ciphertext); $i+=8) { - $plaintext.= $this->_processBlock(substr($ciphertext, $i, 8), CRYPT_DES_DECRYPT); - } - break; - case CRYPT_DES_MODE_CBC: - $xor = $this->decryptIV; - for ($i = 0; $i < strlen($ciphertext); $i+=8) { - $block = substr($ciphertext, $i, 8); - $plaintext.= $this->_processBlock($block, CRYPT_DES_DECRYPT) ^ $xor; - $xor = $block; - } - if ($this->continuousBuffer) { - $this->decryptIV = $xor; - } - break; - case CRYPT_DES_MODE_CTR: - $xor = $this->decryptIV; - for ($i = 0; $i < strlen($ciphertext); $i+=8) { - $block = substr($ciphertext, $i, 8); - $key = $this->_processBlock($this->_generate_xor(8, $xor), CRYPT_DES_ENCRYPT); - $plaintext.= $block ^ $key; - } - if ($this->continuousBuffer) { - $this->decryptIV = $xor; - } - } - - return $this->mode != CRYPT_DES_MODE_CTR ? $this->_unpad($plaintext) : $plaintext; - } - - /** - * Treat consecutive "packets" as if they are a continuous buffer. - * - * Say you have a 16-byte plaintext $plaintext. Using the default behavior, the two following code snippets - * will yield different outputs: - * - * <code> - * echo $des->encrypt(substr($plaintext, 0, 8)); - * echo $des->encrypt(substr($plaintext, 8, 8)); - * </code> - * <code> - * echo $des->encrypt($plaintext); - * </code> - * - * The solution is to enable the continuous buffer. Although this will resolve the above discrepancy, it creates - * another, as demonstrated with the following: - * - * <code> - * $des->encrypt(substr($plaintext, 0, 8)); - * echo $des->decrypt($des->encrypt(substr($plaintext, 8, 8))); - * </code> - * <code> - * echo $des->decrypt($des->encrypt(substr($plaintext, 8, 8))); - * </code> - * - * With the continuous buffer disabled, these would yield the same output. With it enabled, they yield different - * outputs. The reason is due to the fact that the initialization vector's change after every encryption / - * decryption round when the continuous buffer is enabled. When it's disabled, they remain constant. - * - * Put another way, when the continuous buffer is enabled, the state of the Crypt_DES() object changes after each - * encryption / decryption round, whereas otherwise, it'd remain constant. For this reason, it's recommended that - * continuous buffers not be used. They do offer better security and are, in fact, sometimes required (SSH uses them), - * however, they are also less intuitive and more likely to cause you problems. - * - * @see Crypt_DES::disableContinuousBuffer() - * @access public - */ - function enableContinuousBuffer() - { - $this->continuousBuffer = true; - } - - /** - * Treat consecutive packets as if they are a discontinuous buffer. - * - * The default behavior. - * - * @see Crypt_DES::enableContinuousBuffer() - * @access public - */ - function disableContinuousBuffer() - { - $this->continuousBuffer = false; - $this->encryptIV = $this->iv; - $this->decryptIV = $this->iv; - } - - /** - * Pad "packets". - * - * DES works by encrypting eight bytes at a time. If you ever need to encrypt or decrypt something that's not - * a multiple of eight, it becomes necessary to pad the input so that it's length is a multiple of eight. - * - * Padding is enabled by default. Sometimes, however, it is undesirable to pad strings. Such is the case in SSH1, - * where "packets" are padded with random bytes before being encrypted. Unpad these packets and you risk stripping - * away characters that shouldn't be stripped away. (SSH knows how many bytes are added because the length is - * transmitted separately) - * - * @see Crypt_DES::disablePadding() - * @access public - */ - function enablePadding() - { - $this->padding = true; - } - - /** - * Do not pad packets. - * - * @see Crypt_DES::enablePadding() - * @access public - */ - function disablePadding() - { - $this->padding = false; - } - - /** - * Pads a string - * - * Pads a string using the RSA PKCS padding standards so that its length is a multiple of the blocksize (8). - * 8 - (strlen($text) & 7) bytes are added, each of which is equal to chr(8 - (strlen($text) & 7) - * - * If padding is disabled and $text is not a multiple of the blocksize, the string will be padded regardless - * and padding will, hence forth, be enabled. - * - * @see Crypt_DES::_unpad() - * @access private - */ - function _pad($text) - { - $length = strlen($text); - - if (!$this->padding) { - if (($length & 7) == 0) { - return $text; - } else { - user_error("The plaintext's length ($length) is not a multiple of the block size (8)", E_USER_NOTICE); - $this->padding = true; - } - } - - $pad = 8 - ($length & 7); - return str_pad($text, $length + $pad, chr($pad)); - } - - /** - * Unpads a string - * - * If padding is enabled and the reported padding length is invalid the encryption key will be assumed to be wrong - * and false will be returned. - * - * @see Crypt_DES::_pad() - * @access private - */ - function _unpad($text) - { - if (!$this->padding) { - return $text; - } - - $length = ord($text[strlen($text) - 1]); - - if (!$length || $length > 8) { - return false; - } - - return substr($text, 0, -$length); - } - - /** - * Encrypts or decrypts a 64-bit block - * - * $mode should be either CRYPT_DES_ENCRYPT or CRYPT_DES_DECRYPT. See - * {@link http://en.wikipedia.org/wiki/Image:Feistel.png Feistel.png} to get a general - * idea of what this function does. - * - * @access private - * @param String $block - * @param Integer $mode - * @return String - */ - function _processBlock($block, $mode) - { - // s-boxes. in the official DES docs, they're described as being matrices that - // one accesses by using the first and last bits to determine the row and the - // middle four bits to determine the column. in this implementation, they've - // been converted to vectors - static $sbox = array( - array( - 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1, - 3, 10 ,10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8, - 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7, - 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13 - ), - array( - 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14, - 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5, - 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2, - 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9 - ), - array( - 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10, - 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1, - 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7, - 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12 - ), - array( - 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3, - 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9, - 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8, - 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14 - ), - array( - 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1, - 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6, - 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13, - 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3 - ), - array( - 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5, - 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8, - 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10, - 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13 - ), - array( - 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10, - 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6, - 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7, - 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12 - ), - array( - 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4, - 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2, - 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13, - 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11 - ) - ); - - $keys = $this->keys; - - $temp = unpack('Na/Nb', $block); - $block = array($temp['a'], $temp['b']); - - // because php does arithmetic right shifts, if the most significant bits are set, right - // shifting those into the correct position will add 1's - not 0's. this will intefere - // with the | operation unless a second & is done. so we isolate these bits and left shift - // them into place. we then & each block with 0x7FFFFFFF to prevennt 1's from being added - // for any other shifts. - $msb = array( - ($block[0] >> 31) & 1, - ($block[1] >> 31) & 1 - ); - $block[0] &= 0x7FFFFFFF; - $block[1] &= 0x7FFFFFFF; - - // we isolate the appropriate bit in the appropriate integer and shift as appropriate. in - // some cases, there are going to be multiple bits in the same integer that need to be shifted - // in the same way. we combine those into one shift operation. - $block = array( - (($block[1] & 0x00000040) << 25) | (($block[1] & 0x00004000) << 16) | - (($block[1] & 0x00400001) << 7) | (($block[1] & 0x40000100) >> 2) | - (($block[0] & 0x00000040) << 21) | (($block[0] & 0x00004000) << 12) | - (($block[0] & 0x00400001) << 3) | (($block[0] & 0x40000100) >> 6) | - (($block[1] & 0x00000010) << 19) | (($block[1] & 0x00001000) << 10) | - (($block[1] & 0x00100000) << 1) | (($block[1] & 0x10000000) >> 8) | - (($block[0] & 0x00000010) << 15) | (($block[0] & 0x00001000) << 6) | - (($block[0] & 0x00100000) >> 3) | (($block[0] & 0x10000000) >> 12) | - (($block[1] & 0x00000004) << 13) | (($block[1] & 0x00000400) << 4) | - (($block[1] & 0x00040000) >> 5) | (($block[1] & 0x04000000) >> 14) | - (($block[0] & 0x00000004) << 9) | ( $block[0] & 0x00000400 ) | - (($block[0] & 0x00040000) >> 9) | (($block[0] & 0x04000000) >> 18) | - (($block[1] & 0x00010000) >> 11) | (($block[1] & 0x01000000) >> 20) | - (($block[0] & 0x00010000) >> 15) | (($block[0] & 0x01000000) >> 24) - , - (($block[1] & 0x00000080) << 24) | (($block[1] & 0x00008000) << 15) | - (($block[1] & 0x00800002) << 6) | (($block[0] & 0x00000080) << 20) | - (($block[0] & 0x00008000) << 11) | (($block[0] & 0x00800002) << 2) | - (($block[1] & 0x00000020) << 18) | (($block[1] & 0x00002000) << 9) | - ( $block[1] & 0x00200000 ) | (($block[1] & 0x20000000) >> 9) | - (($block[0] & 0x00000020) << 14) | (($block[0] & 0x00002000) << 5) | - (($block[0] & 0x00200000) >> 4) | (($block[0] & 0x20000000) >> 13) | - (($block[1] & 0x00000008) << 12) | (($block[1] & 0x00000800) << 3) | - (($block[1] & 0x00080000) >> 6) | (($block[1] & 0x08000000) >> 15) | - (($block[0] & 0x00000008) << 8) | (($block[0] & 0x00000800) >> 1) | - (($block[0] & 0x00080000) >> 10) | (($block[0] & 0x08000000) >> 19) | - (($block[1] & 0x00000200) >> 3) | (($block[0] & 0x00000200) >> 7) | - (($block[1] & 0x00020000) >> 12) | (($block[1] & 0x02000000) >> 21) | - (($block[0] & 0x00020000) >> 16) | (($block[0] & 0x02000000) >> 25) | - ($msb[1] << 28) | ($msb[0] << 24) - ); - - for ($i = 0; $i < 16; $i++) { - // start of "the Feistel (F) function" - see the following URL: - // http://en.wikipedia.org/wiki/Image:Data_Encryption_Standard_InfoBox_Diagram.png - $temp = (($sbox[0][((($block[1] >> 27) & 0x1F) | (($block[1] & 1) << 5)) ^ $keys[$mode][$i][0]]) << 28) - | (($sbox[1][(($block[1] & 0x1F800000) >> 23) ^ $keys[$mode][$i][1]]) << 24) - | (($sbox[2][(($block[1] & 0x01F80000) >> 19) ^ $keys[$mode][$i][2]]) << 20) - | (($sbox[3][(($block[1] & 0x001F8000) >> 15) ^ $keys[$mode][$i][3]]) << 16) - | (($sbox[4][(($block[1] & 0x0001F800) >> 11) ^ $keys[$mode][$i][4]]) << 12) - | (($sbox[5][(($block[1] & 0x00001F80) >> 7) ^ $keys[$mode][$i][5]]) << 8) - | (($sbox[6][(($block[1] & 0x000001F8) >> 3) ^ $keys[$mode][$i][6]]) << 4) - | ( $sbox[7][((($block[1] & 0x1F) << 1) | (($block[1] >> 31) & 1)) ^ $keys[$mode][$i][7]]); - - $msb = ($temp >> 31) & 1; - $temp &= 0x7FFFFFFF; - $newBlock = (($temp & 0x00010000) << 15) | (($temp & 0x02020120) << 5) - | (($temp & 0x00001800) << 17) | (($temp & 0x01000000) >> 10) - | (($temp & 0x00000008) << 24) | (($temp & 0x00100000) << 6) - | (($temp & 0x00000010) << 21) | (($temp & 0x00008000) << 9) - | (($temp & 0x00000200) << 12) | (($temp & 0x10000000) >> 27) - | (($temp & 0x00000040) << 14) | (($temp & 0x08000000) >> 8) - | (($temp & 0x00004000) << 4) | (($temp & 0x00000002) << 16) - | (($temp & 0x00442000) >> 6) | (($temp & 0x40800000) >> 15) - | (($temp & 0x00000001) << 11) | (($temp & 0x20000000) >> 20) - | (($temp & 0x00080000) >> 13) | (($temp & 0x00000004) << 3) - | (($temp & 0x04000000) >> 22) | (($temp & 0x00000480) >> 7) - | (($temp & 0x00200000) >> 19) | ($msb << 23); - // end of "the Feistel (F) function" - $newBlock is F's output - - $temp = $block[1]; - $block[1] = $block[0] ^ $newBlock; - $block[0] = $temp; - } - - $msb = array( - ($block[0] >> 31) & 1, - ($block[1] >> 31) & 1 - ); - $block[0] &= 0x7FFFFFFF; - $block[1] &= 0x7FFFFFFF; - - $block = array( - (($block[0] & 0x01000004) << 7) | (($block[1] & 0x01000004) << 6) | - (($block[0] & 0x00010000) << 13) | (($block[1] & 0x00010000) << 12) | - (($block[0] & 0x00000100) << 19) | (($block[1] & 0x00000100) << 18) | - (($block[0] & 0x00000001) << 25) | (($block[1] & 0x00000001) << 24) | - (($block[0] & 0x02000008) >> 2) | (($block[1] & 0x02000008) >> 3) | - (($block[0] & 0x00020000) << 4) | (($block[1] & 0x00020000) << 3) | - (($block[0] & 0x00000200) << 10) | (($block[1] & 0x00000200) << 9) | - (($block[0] & 0x00000002) << 16) | (($block[1] & 0x00000002) << 15) | - (($block[0] & 0x04000000) >> 11) | (($block[1] & 0x04000000) >> 12) | - (($block[0] & 0x00040000) >> 5) | (($block[1] & 0x00040000) >> 6) | - (($block[0] & 0x00000400) << 1) | ( $block[1] & 0x00000400 ) | - (($block[0] & 0x08000000) >> 20) | (($block[1] & 0x08000000) >> 21) | - (($block[0] & 0x00080000) >> 14) | (($block[1] & 0x00080000) >> 15) | - (($block[0] & 0x00000800) >> 8) | (($block[1] & 0x00000800) >> 9) - , - (($block[0] & 0x10000040) << 3) | (($block[1] & 0x10000040) << 2) | - (($block[0] & 0x00100000) << 9) | (($block[1] & 0x00100000) << 8) | - (($block[0] & 0x00001000) << 15) | (($block[1] & 0x00001000) << 14) | - (($block[0] & 0x00000010) << 21) | (($block[1] & 0x00000010) << 20) | - (($block[0] & 0x20000080) >> 6) | (($block[1] & 0x20000080) >> 7) | - ( $block[0] & 0x00200000 ) | (($block[1] & 0x00200000) >> 1) | - (($block[0] & 0x00002000) << 6) | (($block[1] & 0x00002000) << 5) | - (($block[0] & 0x00000020) << 12) | (($block[1] & 0x00000020) << 11) | - (($block[0] & 0x40000000) >> 15) | (($block[1] & 0x40000000) >> 16) | - (($block[0] & 0x00400000) >> 9) | (($block[1] & 0x00400000) >> 10) | - (($block[0] & 0x00004000) >> 3) | (($block[1] & 0x00004000) >> 4) | - (($block[0] & 0x00800000) >> 18) | (($block[1] & 0x00800000) >> 19) | - (($block[0] & 0x00008000) >> 12) | (($block[1] & 0x00008000) >> 13) | - ($msb[0] << 7) | ($msb[1] << 6) - ); - - return pack('NN', $block[0], $block[1]); - } - - /** - * Creates the key schedule. - * - * @access private - * @param String $key - * @return Array - */ - function _prepareKey($key) - { - static $shifts = array( // number of key bits shifted per round - 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1 - ); - - // pad the key and remove extra characters as appropriate. - $key = str_pad(substr($key, 0, 8), 8, chr(0)); - - $temp = unpack('Na/Nb', $key); - $key = array($temp['a'], $temp['b']); - $msb = array( - ($key[0] >> 31) & 1, - ($key[1] >> 31) & 1 - ); - $key[0] &= 0x7FFFFFFF; - $key[1] &= 0x7FFFFFFF; - - $key = array( - (($key[1] & 0x00000002) << 26) | (($key[1] & 0x00000204) << 17) | - (($key[1] & 0x00020408) << 8) | (($key[1] & 0x02040800) >> 1) | - (($key[0] & 0x00000002) << 22) | (($key[0] & 0x00000204) << 13) | - (($key[0] & 0x00020408) << 4) | (($key[0] & 0x02040800) >> 5) | - (($key[1] & 0x04080000) >> 10) | (($key[0] & 0x04080000) >> 14) | - (($key[1] & 0x08000000) >> 19) | (($key[0] & 0x08000000) >> 23) | - (($key[0] & 0x00000010) >> 1) | (($key[0] & 0x00001000) >> 10) | - (($key[0] & 0x00100000) >> 19) | (($key[0] & 0x10000000) >> 28) - , - (($key[1] & 0x00000080) << 20) | (($key[1] & 0x00008000) << 11) | - (($key[1] & 0x00800000) << 2) | (($key[0] & 0x00000080) << 16) | - (($key[0] & 0x00008000) << 7) | (($key[0] & 0x00800000) >> 2) | - (($key[1] & 0x00000040) << 13) | (($key[1] & 0x00004000) << 4) | - (($key[1] & 0x00400000) >> 5) | (($key[1] & 0x40000000) >> 14) | - (($key[0] & 0x00000040) << 9) | ( $key[0] & 0x00004000 ) | - (($key[0] & 0x00400000) >> 9) | (($key[0] & 0x40000000) >> 18) | - (($key[1] & 0x00000020) << 6) | (($key[1] & 0x00002000) >> 3) | - (($key[1] & 0x00200000) >> 12) | (($key[1] & 0x20000000) >> 21) | - (($key[0] & 0x00000020) << 2) | (($key[0] & 0x00002000) >> 7) | - (($key[0] & 0x00200000) >> 16) | (($key[0] & 0x20000000) >> 25) | - (($key[1] & 0x00000010) >> 1) | (($key[1] & 0x00001000) >> 10) | - (($key[1] & 0x00100000) >> 19) | (($key[1] & 0x10000000) >> 28) | - ($msb[1] << 24) | ($msb[0] << 20) - ); - - $keys = array(); - for ($i = 0; $i < 16; $i++) { - $key[0] <<= $shifts[$i]; - $temp = ($key[0] & 0xF0000000) >> 28; - $key[0] = ($key[0] | $temp) & 0x0FFFFFFF; - - $key[1] <<= $shifts[$i]; - $temp = ($key[1] & 0xF0000000) >> 28; - $key[1] = ($key[1] | $temp) & 0x0FFFFFFF; - - $temp = array( - (($key[1] & 0x00004000) >> 9) | (($key[1] & 0x00000800) >> 7) | - (($key[1] & 0x00020000) >> 14) | (($key[1] & 0x00000010) >> 2) | - (($key[1] & 0x08000000) >> 26) | (($key[1] & 0x00800000) >> 23) - , - (($key[1] & 0x02400000) >> 20) | (($key[1] & 0x00000001) << 4) | - (($key[1] & 0x00002000) >> 10) | (($key[1] & 0x00040000) >> 18) | - (($key[1] & 0x00000080) >> 6) - , - ( $key[1] & 0x00000020 ) | (($key[1] & 0x00000200) >> 5) | - (($key[1] & 0x00010000) >> 13) | (($key[1] & 0x01000000) >> 22) | - (($key[1] & 0x00000004) >> 1) | (($key[1] & 0x00100000) >> 20) - , - (($key[1] & 0x00001000) >> 7) | (($key[1] & 0x00200000) >> 17) | - (($key[1] & 0x00000002) << 2) | (($key[1] & 0x00000100) >> 6) | - (($key[1] & 0x00008000) >> 14) | (($key[1] & 0x04000000) >> 26) - , - (($key[0] & 0x00008000) >> 10) | ( $key[0] & 0x00000010 ) | - (($key[0] & 0x02000000) >> 22) | (($key[0] & 0x00080000) >> 17) | - (($key[0] & 0x00000200) >> 8) | (($key[0] & 0x00000002) >> 1) - , - (($key[0] & 0x04000000) >> 21) | (($key[0] & 0x00010000) >> 12) | - (($key[0] & 0x00000020) >> 2) | (($key[0] & 0x00000800) >> 9) | - (($key[0] & 0x00800000) >> 22) | (($key[0] & 0x00000100) >> 8) - , - (($key[0] & 0x00001000) >> 7) | (($key[0] & 0x00000088) >> 3) | - (($key[0] & 0x00020000) >> 14) | (($key[0] & 0x00000001) << 2) | - (($key[0] & 0x00400000) >> 21) - , - (($key[0] & 0x00000400) >> 5) | (($key[0] & 0x00004000) >> 10) | - (($key[0] & 0x00000040) >> 3) | (($key[0] & 0x00100000) >> 18) | - (($key[0] & 0x08000000) >> 26) | (($key[0] & 0x01000000) >> 24) - ); - - $keys[] = $temp; - } - - $temp = array( - CRYPT_DES_ENCRYPT => $keys, - CRYPT_DES_DECRYPT => array_reverse($keys) - ); - - return $temp; - } -} - -// vim: ts=4:sw=4:et: -// vim6: fdl=1: diff --git a/lib/internal/phpseclib/Crypt/Hash.php b/lib/internal/phpseclib/Crypt/Hash.php deleted file mode 100644 index 1a878e28ac7..00000000000 --- a/lib/internal/phpseclib/Crypt/Hash.php +++ /dev/null @@ -1,816 +0,0 @@ -<?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * Pure-PHP implementations of keyed-hash message authentication codes (HMACs) and various cryptographic hashing functions. - * - * Uses hash() or mhash() if available and an internal implementation, otherwise. Currently supports the following: - * - * md2, md5, md5-96, sha1, sha1-96, sha256, sha384, and sha512 - * - * If {@link Crypt_Hash::setKey() setKey()} is called, {@link Crypt_Hash::hash() hash()} will return the HMAC as opposed to - * the hash. If no valid algorithm is provided, sha1 will be used. - * - * PHP versions 4 and 5 - * - * {@internal The variable names are the same as those in - * {@link http://tools.ietf.org/html/rfc2104#section-2 RFC2104}.}} - * - * Here's a short example of how to use this library: - * <code> - * <?php - * include('Crypt/Hash.php'); - * - * $hash = new Crypt_Hash('sha1'); - * - * $hash->setKey('abcdefg'); - * - * echo base64_encode($hash->hash('abcdefg')); - * ?> - * </code> - * - * LICENSE: This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - * @category Crypt - * @package Crypt_Hash - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMVII Jim Wigginton - * @license http://www.gnu.org/licenses/lgpl.txt - * @version $Id: Hash.php,v 1.6 2009/11/23 23:37:07 terrafrost Exp $ - * @link http://phpseclib.sourceforge.net - */ - -/**#@+ - * @access private - * @see Crypt_Hash::Crypt_Hash() - */ -/** - * Toggles the internal implementation - */ -define('CRYPT_HASH_MODE_INTERNAL', 1); -/** - * Toggles the mhash() implementation, which has been deprecated on PHP 5.3.0+. - */ -define('CRYPT_HASH_MODE_MHASH', 2); -/** - * Toggles the hash() implementation, which works on PHP 5.1.2+. - */ -define('CRYPT_HASH_MODE_HASH', 3); -/**#@-*/ - -/** - * Pure-PHP implementations of keyed-hash message authentication codes (HMACs) and various cryptographic hashing functions. - * - * @author Jim Wigginton <terrafrost@php.net> - * @version 0.1.0 - * @access public - * @package Crypt_Hash - */ -class Crypt_Hash { - /** - * Byte-length of compression blocks / key (Internal HMAC) - * - * @see Crypt_Hash::setAlgorithm() - * @var Integer - * @access private - */ - var $b; - - /** - * Byte-length of hash output (Internal HMAC) - * - * @see Crypt_Hash::setHash() - * @var Integer - * @access private - */ - var $l = false; - - /** - * Hash Algorithm - * - * @see Crypt_Hash::setHash() - * @var String - * @access private - */ - var $hash; - - /** - * Key - * - * @see Crypt_Hash::setKey() - * @var String - * @access private - */ - var $key = ''; - - /** - * Outer XOR (Internal HMAC) - * - * @see Crypt_Hash::setKey() - * @var String - * @access private - */ - var $opad; - - /** - * Inner XOR (Internal HMAC) - * - * @see Crypt_Hash::setKey() - * @var String - * @access private - */ - var $ipad; - - /** - * Default Constructor. - * - * @param optional String $hash - * @return Crypt_Hash - * @access public - */ - function Crypt_Hash($hash = 'sha1') - { - if ( !defined('CRYPT_HASH_MODE') ) { - switch (true) { - case extension_loaded('hash'): - define('CRYPT_HASH_MODE', CRYPT_HASH_MODE_HASH); - break; - case extension_loaded('mhash'): - define('CRYPT_HASH_MODE', CRYPT_HASH_MODE_MHASH); - break; - default: - define('CRYPT_HASH_MODE', CRYPT_HASH_MODE_INTERNAL); - } - } - - $this->setHash($hash); - } - - /** - * Sets the key for HMACs - * - * Keys can be of any length. - * - * @access public - * @param String $key - */ - function setKey($key) - { - $this->key = $key; - } - - /** - * Sets the hash function. - * - * @access public - * @param String $hash - */ - function setHash($hash) - { - switch ($hash) { - case 'md5-96': - case 'sha1-96': - $this->l = 12; // 96 / 8 = 12 - break; - case 'md2': - case 'md5': - $this->l = 16; - break; - case 'sha1': - $this->l = 20; - break; - case 'sha256': - $this->l = 32; - break; - case 'sha384': - $this->l = 48; - break; - case 'sha512': - $this->l = 64; - } - - switch ($hash) { - case 'md2': - $mode = CRYPT_HASH_MODE_INTERNAL; - break; - case 'sha384': - case 'sha512': - $mode = CRYPT_HASH_MODE == CRYPT_HASH_MODE_MHASH ? CRYPT_HASH_MODE_INTERNAL : CRYPT_HASH_MODE; - break; - default: - $mode = CRYPT_HASH_MODE; - } - - switch ( $mode ) { - case CRYPT_HASH_MODE_MHASH: - switch ($hash) { - case 'md5': - case 'md5-96': - $this->hash = MHASH_MD5; - break; - case 'sha256': - $this->hash = MHASH_SHA256; - break; - case 'sha1': - case 'sha1-96': - default: - $this->hash = MHASH_SHA1; - } - return; - case CRYPT_HASH_MODE_HASH: - switch ($hash) { - case 'md5': - case 'md5-96': - $this->hash = 'md5'; - return; - case 'sha256': - case 'sha384': - case 'sha512': - $this->hash = $hash; - return; - case 'sha1': - case 'sha1-96': - default: - $this->hash = 'sha1'; - } - return; - } - - switch ($hash) { - case 'md2': - $this->b = 16; - $this->hash = array($this, '_md2'); - break; - case 'md5': - case 'md5-96': - $this->b = 64; - $this->hash = array($this, '_md5'); - break; - case 'sha256': - $this->b = 64; - $this->hash = array($this, '_sha256'); - break; - case 'sha384': - case 'sha512': - $this->b = 128; - $this->hash = array($this, '_sha512'); - break; - case 'sha1': - case 'sha1-96': - default: - $this->b = 64; - $this->hash = array($this, '_sha1'); - } - - $this->ipad = str_repeat(chr(0x36), $this->b); - $this->opad = str_repeat(chr(0x5C), $this->b); - } - - /** - * Compute the HMAC. - * - * @access public - * @param String $text - * @return String - */ - function hash($text) - { - $mode = is_array($this->hash) ? CRYPT_HASH_MODE_INTERNAL : CRYPT_HASH_MODE; - - if (!empty($this->key)) { - switch ( $mode ) { - case CRYPT_HASH_MODE_MHASH: - $output = mhash($this->hash, $text, $this->key); - break; - case CRYPT_HASH_MODE_HASH: - $output = hash_hmac($this->hash, $text, $this->key, true); - break; - case CRYPT_HASH_MODE_INTERNAL: - /* "Applications that use keys longer than B bytes will first hash the key using H and then use the - resultant L byte string as the actual key to HMAC." - - -- http://tools.ietf.org/html/rfc2104#section-2 */ - $key = strlen($this->key) > $this->b ? call_user_func($this->$hash, $this->key) : $this->key; - - $key = str_pad($key, $this->b, chr(0)); // step 1 - $temp = $this->ipad ^ $key; // step 2 - $temp .= $text; // step 3 - $temp = call_user_func($this->hash, $temp); // step 4 - $output = $this->opad ^ $key; // step 5 - $output.= $temp; // step 6 - $output = call_user_func($this->hash, $output); // step 7 - } - } else { - switch ( $mode ) { - case CRYPT_HASH_MODE_MHASH: - $output = mhash($this->hash, $text); - break; - case CRYPT_HASH_MODE_HASH: - $output = hash($this->hash, $text, true); - break; - case CRYPT_HASH_MODE_INTERNAL: - $output = call_user_func($this->hash, $text); - } - } - - return substr($output, 0, $this->l); - } - - /** - * Returns the hash length (in bytes) - * - * @access private - * @return Integer - */ - function getLength() - { - return $this->l; - } - - /** - * Wrapper for MD5 - * - * @access private - * @param String $text - */ - function _md5($m) - { - return pack('H*', md5($m)); - } - - /** - * Wrapper for SHA1 - * - * @access private - * @param String $text - */ - function _sha1($m) - { - return pack('H*', sha1($m)); - } - - /** - * Pure-PHP implementation of MD2 - * - * See {@link http://tools.ietf.org/html/rfc1319 RFC1319}. - * - * @access private - * @param String $text - */ - function _md2($m) - { - static $s = array( - 41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, - 19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, - 76, 130, 202, 30, 155, 87, 60, 253, 212, 224, 22, 103, 66, 111, 24, - 138, 23, 229, 18, 190, 78, 196, 214, 218, 158, 222, 73, 160, 251, - 245, 142, 187, 47, 238, 122, 169, 104, 121, 145, 21, 178, 7, 63, - 148, 194, 16, 137, 11, 34, 95, 33, 128, 127, 93, 154, 90, 144, 50, - 39, 53, 62, 204, 231, 191, 247, 151, 3, 255, 25, 48, 179, 72, 165, - 181, 209, 215, 94, 146, 42, 172, 86, 170, 198, 79, 184, 56, 210, - 150, 164, 125, 182, 118, 252, 107, 226, 156, 116, 4, 241, 69, 157, - 112, 89, 100, 113, 135, 32, 134, 91, 207, 101, 230, 45, 168, 2, 27, - 96, 37, 173, 174, 176, 185, 246, 28, 70, 97, 105, 52, 64, 126, 15, - 85, 71, 163, 35, 221, 81, 175, 58, 195, 92, 249, 206, 186, 197, - 234, 38, 44, 83, 13, 110, 133, 40, 132, 9, 211, 223, 205, 244, 65, - 129, 77, 82, 106, 220, 55, 200, 108, 193, 171, 250, 36, 225, 123, - 8, 12, 189, 177, 74, 120, 136, 149, 139, 227, 99, 232, 109, 233, - 203, 213, 254, 59, 0, 29, 57, 242, 239, 183, 14, 102, 88, 208, 228, - 166, 119, 114, 248, 235, 117, 75, 10, 49, 68, 80, 180, 143, 237, - 31, 26, 219, 153, 141, 51, 159, 17, 131, 20 - ); - - // Step 1. Append Padding Bytes - $pad = 16 - (strlen($m) & 0xF); - $m.= str_repeat(chr($pad), $pad); - - $length = strlen($m); - - // Step 2. Append Checksum - $c = str_repeat(chr(0), 16); - $l = chr(0); - for ($i = 0; $i < $length; $i+= 16) { - for ($j = 0; $j < 16; $j++) { - $c[$j] = chr($s[ord($m[$i + $j] ^ $l)]); - $l = $c[$j]; - } - } - $m.= $c; - - $length+= 16; - - // Step 3. Initialize MD Buffer - $x = str_repeat(chr(0), 48); - - // Step 4. Process Message in 16-Byte Blocks - for ($i = 0; $i < $length; $i+= 16) { - for ($j = 0; $j < 16; $j++) { - $x[$j + 16] = $m[$i + $j]; - $x[$j + 32] = $x[$j + 16] ^ $x[$j]; - } - $t = chr(0); - for ($j = 0; $j < 18; $j++) { - for ($k = 0; $k < 48; $k++) { - $x[$k] = $t = $x[$k] ^ chr($s[ord($t)]); - //$t = $x[$k] = $x[$k] ^ chr($s[ord($t)]); - } - $t = chr(ord($t) + $j); - } - } - - // Step 5. Output - return substr($x, 0, 16); - } - - /** - * Pure-PHP implementation of SHA256 - * - * See {@link http://en.wikipedia.org/wiki/SHA_hash_functions#SHA-256_.28a_SHA-2_variant.29_pseudocode SHA-256 (a SHA-2 variant) pseudocode - Wikipedia}. - * - * @access private - * @param String $text - */ - function _sha256($m) - { - if (extension_loaded('suhosin')) { - return pack('H*', sha256($m)); - } - - // Initialize variables - $hash = array( - 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 - ); - // Initialize table of round constants - // (first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311) - static $k = array( - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 - ); - - // Pre-processing - $length = strlen($m); - // to round to nearest 56 mod 64, we'll add 64 - (length + (64 - 56)) % 64 - $m.= str_repeat(chr(0), 64 - (($length + 8) & 0x3F)); - $m[$length] = chr(0x80); - // we don't support hashing strings 512MB long - $m.= pack('N2', 0, $length << 3); - - // Process the message in successive 512-bit chunks - $chunks = str_split($m, 64); - foreach ($chunks as $chunk) { - $w = array(); - for ($i = 0; $i < 16; $i++) { - extract(unpack('Ntemp', $this->_string_shift($chunk, 4))); - $w[] = $temp; - } - - // Extend the sixteen 32-bit words into sixty-four 32-bit words - for ($i = 16; $i < 64; $i++) { - $s0 = $this->_rightRotate($w[$i - 15], 7) ^ - $this->_rightRotate($w[$i - 15], 18) ^ - $this->_rightShift( $w[$i - 15], 3); - $s1 = $this->_rightRotate($w[$i - 2], 17) ^ - $this->_rightRotate($w[$i - 2], 19) ^ - $this->_rightShift( $w[$i - 2], 10); - $w[$i] = $this->_add($w[$i - 16], $s0, $w[$i - 7], $s1); - - } - - // Initialize hash value for this chunk - list($a, $b, $c, $d, $e, $f, $g, $h) = $hash; - - // Main loop - for ($i = 0; $i < 64; $i++) { - $s0 = $this->_rightRotate($a, 2) ^ - $this->_rightRotate($a, 13) ^ - $this->_rightRotate($a, 22); - $maj = ($a & $b) ^ - ($a & $c) ^ - ($b & $c); - $t2 = $this->_add($s0, $maj); - - $s1 = $this->_rightRotate($e, 6) ^ - $this->_rightRotate($e, 11) ^ - $this->_rightRotate($e, 25); - $ch = ($e & $f) ^ - ($this->_not($e) & $g); - $t1 = $this->_add($h, $s1, $ch, $k[$i], $w[$i]); - - $h = $g; - $g = $f; - $f = $e; - $e = $this->_add($d, $t1); - $d = $c; - $c = $b; - $b = $a; - $a = $this->_add($t1, $t2); - } - - // Add this chunk's hash to result so far - $hash = array( - $this->_add($hash[0], $a), - $this->_add($hash[1], $b), - $this->_add($hash[2], $c), - $this->_add($hash[3], $d), - $this->_add($hash[4], $e), - $this->_add($hash[5], $f), - $this->_add($hash[6], $g), - $this->_add($hash[7], $h) - ); - } - - // Produce the final hash value (big-endian) - return pack('N8', $hash[0], $hash[1], $hash[2], $hash[3], $hash[4], $hash[5], $hash[6], $hash[7]); - } - - /** - * Pure-PHP implementation of SHA384 and SHA512 - * - * @access private - * @param String $text - */ - function _sha512($m) - { - if (!class_exists('Math_BigInteger')) { - require_once('Math/BigInteger.php'); - } - - static $init384, $init512, $k; - - if (!isset($k)) { - // Initialize variables - $init384 = array( // initial values for SHA384 - 'cbbb9d5dc1059ed8', '629a292a367cd507', '9159015a3070dd17', '152fecd8f70e5939', - '67332667ffc00b31', '8eb44a8768581511', 'db0c2e0d64f98fa7', '47b5481dbefa4fa4' - ); - $init512 = array( // initial values for SHA512 - '6a09e667f3bcc908', 'bb67ae8584caa73b', '3c6ef372fe94f82b', 'a54ff53a5f1d36f1', - '510e527fade682d1', '9b05688c2b3e6c1f', '1f83d9abfb41bd6b', '5be0cd19137e2179' - ); - - for ($i = 0; $i < 8; $i++) { - $init384[$i] = new Math_BigInteger($init384[$i], 16); - $init384[$i]->setPrecision(64); - $init512[$i] = new Math_BigInteger($init512[$i], 16); - $init512[$i]->setPrecision(64); - } - - // Initialize table of round constants - // (first 64 bits of the fractional parts of the cube roots of the first 80 primes 2..409) - $k = array( - '428a2f98d728ae22', '7137449123ef65cd', 'b5c0fbcfec4d3b2f', 'e9b5dba58189dbbc', - '3956c25bf348b538', '59f111f1b605d019', '923f82a4af194f9b', 'ab1c5ed5da6d8118', - 'd807aa98a3030242', '12835b0145706fbe', '243185be4ee4b28c', '550c7dc3d5ffb4e2', - '72be5d74f27b896f', '80deb1fe3b1696b1', '9bdc06a725c71235', 'c19bf174cf692694', - 'e49b69c19ef14ad2', 'efbe4786384f25e3', '0fc19dc68b8cd5b5', '240ca1cc77ac9c65', - '2de92c6f592b0275', '4a7484aa6ea6e483', '5cb0a9dcbd41fbd4', '76f988da831153b5', - '983e5152ee66dfab', 'a831c66d2db43210', 'b00327c898fb213f', 'bf597fc7beef0ee4', - 'c6e00bf33da88fc2', 'd5a79147930aa725', '06ca6351e003826f', '142929670a0e6e70', - '27b70a8546d22ffc', '2e1b21385c26c926', '4d2c6dfc5ac42aed', '53380d139d95b3df', - '650a73548baf63de', '766a0abb3c77b2a8', '81c2c92e47edaee6', '92722c851482353b', - 'a2bfe8a14cf10364', 'a81a664bbc423001', 'c24b8b70d0f89791', 'c76c51a30654be30', - 'd192e819d6ef5218', 'd69906245565a910', 'f40e35855771202a', '106aa07032bbd1b8', - '19a4c116b8d2d0c8', '1e376c085141ab53', '2748774cdf8eeb99', '34b0bcb5e19b48a8', - '391c0cb3c5c95a63', '4ed8aa4ae3418acb', '5b9cca4f7763e373', '682e6ff3d6b2b8a3', - '748f82ee5defb2fc', '78a5636f43172f60', '84c87814a1f0ab72', '8cc702081a6439ec', - '90befffa23631e28', 'a4506cebde82bde9', 'bef9a3f7b2c67915', 'c67178f2e372532b', - 'ca273eceea26619c', 'd186b8c721c0c207', 'eada7dd6cde0eb1e', 'f57d4f7fee6ed178', - '06f067aa72176fba', '0a637dc5a2c898a6', '113f9804bef90dae', '1b710b35131c471b', - '28db77f523047d84', '32caab7b40c72493', '3c9ebe0a15c9bebc', '431d67c49c100d4c', - '4cc5d4becb3e42b6', '597f299cfc657e2a', '5fcb6fab3ad6faec', '6c44198c4a475817' - ); - - for ($i = 0; $i < 80; $i++) { - $k[$i] = new Math_BigInteger($k[$i], 16); - } - } - - $hash = $this->l == 48 ? $init384 : $init512; - - // Pre-processing - $length = strlen($m); - // to round to nearest 112 mod 128, we'll add 128 - (length + (128 - 112)) % 128 - $m.= str_repeat(chr(0), 128 - (($length + 16) & 0x7F)); - $m[$length] = chr(0x80); - // we don't support hashing strings 512MB long - $m.= pack('N4', 0, 0, 0, $length << 3); - - // Process the message in successive 1024-bit chunks - $chunks = str_split($m, 128); - foreach ($chunks as $chunk) { - $w = array(); - for ($i = 0; $i < 16; $i++) { - $temp = new Math_BigInteger($this->_string_shift($chunk, 8), 256); - $temp->setPrecision(64); - $w[] = $temp; - } - - // Extend the sixteen 32-bit words into eighty 32-bit words - for ($i = 16; $i < 80; $i++) { - $temp = array( - $w[$i - 15]->bitwise_rightRotate(1), - $w[$i - 15]->bitwise_rightRotate(8), - $w[$i - 15]->bitwise_rightShift(7) - ); - $s0 = $temp[0]->bitwise_xor($temp[1]); - $s0 = $s0->bitwise_xor($temp[2]); - $temp = array( - $w[$i - 2]->bitwise_rightRotate(19), - $w[$i - 2]->bitwise_rightRotate(61), - $w[$i - 2]->bitwise_rightShift(6) - ); - $s1 = $temp[0]->bitwise_xor($temp[1]); - $s1 = $s1->bitwise_xor($temp[2]); - $w[$i] = $w[$i - 16]->copy(); - $w[$i] = $w[$i]->add($s0); - $w[$i] = $w[$i]->add($w[$i - 7]); - $w[$i] = $w[$i]->add($s1); - } - - // Initialize hash value for this chunk - $a = $hash[0]->copy(); - $b = $hash[1]->copy(); - $c = $hash[2]->copy(); - $d = $hash[3]->copy(); - $e = $hash[4]->copy(); - $f = $hash[5]->copy(); - $g = $hash[6]->copy(); - $h = $hash[7]->copy(); - - // Main loop - for ($i = 0; $i < 80; $i++) { - $temp = array( - $a->bitwise_rightRotate(28), - $a->bitwise_rightRotate(34), - $a->bitwise_rightRotate(39) - ); - $s0 = $temp[0]->bitwise_xor($temp[1]); - $s0 = $s0->bitwise_xor($temp[2]); - $temp = array( - $a->bitwise_and($b), - $a->bitwise_and($c), - $b->bitwise_and($c) - ); - $maj = $temp[0]->bitwise_xor($temp[1]); - $maj = $maj->bitwise_xor($temp[2]); - $t2 = $s0->add($maj); - - $temp = array( - $e->bitwise_rightRotate(14), - $e->bitwise_rightRotate(18), - $e->bitwise_rightRotate(41) - ); - $s1 = $temp[0]->bitwise_xor($temp[1]); - $s1 = $s1->bitwise_xor($temp[2]); - $temp = array( - $e->bitwise_and($f), - $g->bitwise_and($e->bitwise_not()) - ); - $ch = $temp[0]->bitwise_xor($temp[1]); - $t1 = $h->add($s1); - $t1 = $t1->add($ch); - $t1 = $t1->add($k[$i]); - $t1 = $t1->add($w[$i]); - - $h = $g->copy(); - $g = $f->copy(); - $f = $e->copy(); - $e = $d->add($t1); - $d = $c->copy(); - $c = $b->copy(); - $b = $a->copy(); - $a = $t1->add($t2); - } - - // Add this chunk's hash to result so far - $hash = array( - $hash[0]->add($a), - $hash[1]->add($b), - $hash[2]->add($c), - $hash[3]->add($d), - $hash[4]->add($e), - $hash[5]->add($f), - $hash[6]->add($g), - $hash[7]->add($h) - ); - } - - // Produce the final hash value (big-endian) - // (Crypt_Hash::hash() trims the output for hashes but not for HMACs. as such, we trim the output here) - $temp = $hash[0]->toBytes() . $hash[1]->toBytes() . $hash[2]->toBytes() . $hash[3]->toBytes() . - $hash[4]->toBytes() . $hash[5]->toBytes(); - if ($this->l != 48) { - $temp.= $hash[6]->toBytes() . $hash[7]->toBytes(); - } - - return $temp; - } - - /** - * Right Rotate - * - * @access private - * @param Integer $int - * @param Integer $amt - * @see _sha256() - * @return Integer - */ - function _rightRotate($int, $amt) - { - $invamt = 32 - $amt; - $mask = (1 << $invamt) - 1; - return (($int << $invamt) & 0xFFFFFFFF) | (($int >> $amt) & $mask); - } - - /** - * Right Shift - * - * @access private - * @param Integer $int - * @param Integer $amt - * @see _sha256() - * @return Integer - */ - function _rightShift($int, $amt) - { - $mask = (1 << (32 - $amt)) - 1; - return ($int >> $amt) & $mask; - } - - /** - * Not - * - * @access private - * @param Integer $int - * @see _sha256() - * @return Integer - */ - function _not($int) - { - return ~$int & 0xFFFFFFFF; - } - - /** - * Add - * - * _sha256() adds multiple unsigned 32-bit integers. Since PHP doesn't support unsigned integers and since the - * possibility of overflow exists, care has to be taken. Math_BigInteger() could be used but this should be faster. - * - * @param String $string - * @param optional Integer $index - * @return String - * @see _sha256() - * @access private - */ - function _add() - { - static $mod; - if (!isset($mod)) { - $mod = pow(2, 32); - } - - $result = 0; - $arguments = func_get_args(); - foreach ($arguments as $argument) { - $result+= $argument < 0 ? ($argument & 0x7FFFFFFF) + 0x80000000 : $argument; - } - - return fmod($result, $mod); - } - - /** - * String Shift - * - * Inspired by array_shift - * - * @param String $string - * @param optional Integer $index - * @return String - * @access private - */ - function _string_shift(&$string, $index = 1) - { - $substr = substr($string, 0, $index); - $string = substr($string, $index); - return $substr; - } -} diff --git a/lib/internal/phpseclib/Crypt/RC4.php b/lib/internal/phpseclib/Crypt/RC4.php deleted file mode 100644 index c67cb963cd0..00000000000 --- a/lib/internal/phpseclib/Crypt/RC4.php +++ /dev/null @@ -1,493 +0,0 @@ -<?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * Pure-PHP implementation of RC4. - * - * Uses mcrypt, if available, and an internal implementation, otherwise. - * - * PHP versions 4 and 5 - * - * Useful resources are as follows: - * - * - {@link http://www.mozilla.org/projects/security/pki/nss/draft-kaukonen-cipher-arcfour-03.txt ARCFOUR Algorithm} - * - {@link http://en.wikipedia.org/wiki/RC4 - Wikipedia: RC4} - * - * RC4 is also known as ARCFOUR or ARC4. The reason is elaborated upon at Wikipedia. This class is named RC4 and not - * ARCFOUR or ARC4 because RC4 is how it is refered to in the SSH1 specification. - * - * Here's a short example of how to use this library: - * <code> - * <?php - * include('Crypt/RC4.php'); - * - * $rc4 = new Crypt_RC4(); - * - * $rc4->setKey('abcdefgh'); - * - * $size = 10 * 1024; - * $plaintext = ''; - * for ($i = 0; $i < $size; $i++) { - * $plaintext.= 'a'; - * } - * - * echo $rc4->decrypt($rc4->encrypt($plaintext)); - * ?> - * </code> - * - * LICENSE: This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - * @category Crypt - * @package Crypt_RC4 - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMVII Jim Wigginton - * @license http://www.gnu.org/licenses/lgpl.txt - * @version $Id: RC4.php,v 1.8 2009/06/09 04:00:38 terrafrost Exp $ - * @link http://phpseclib.sourceforge.net - */ - -/**#@+ - * @access private - * @see Crypt_RC4::Crypt_RC4() - */ -/** - * Toggles the internal implementation - */ -define('CRYPT_RC4_MODE_INTERNAL', 1); -/** - * Toggles the mcrypt implementation - */ -define('CRYPT_RC4_MODE_MCRYPT', 2); -/**#@-*/ - -/**#@+ - * @access private - * @see Crypt_RC4::_crypt() - */ -define('CRYPT_RC4_ENCRYPT', 0); -define('CRYPT_RC4_DECRYPT', 1); -/**#@-*/ - -/** - * Pure-PHP implementation of RC4. - * - * @author Jim Wigginton <terrafrost@php.net> - * @version 0.1.0 - * @access public - * @package Crypt_RC4 - */ -class Crypt_RC4 { - /** - * The Key - * - * @see Crypt_RC4::setKey() - * @var String - * @access private - */ - var $key = "\0"; - - /** - * The Key Stream for encryption - * - * If CRYPT_RC4_MODE == CRYPT_RC4_MODE_MCRYPT, this will be equal to the mcrypt object - * - * @see Crypt_RC4::setKey() - * @var Array - * @access private - */ - var $encryptStream = false; - - /** - * The Key Stream for decryption - * - * If CRYPT_RC4_MODE == CRYPT_RC4_MODE_MCRYPT, this will be equal to the mcrypt object - * - * @see Crypt_RC4::setKey() - * @var Array - * @access private - */ - var $decryptStream = false; - - /** - * The $i and $j indexes for encryption - * - * @see Crypt_RC4::_crypt() - * @var Integer - * @access private - */ - var $encryptIndex = 0; - - /** - * The $i and $j indexes for decryption - * - * @see Crypt_RC4::_crypt() - * @var Integer - * @access private - */ - var $decryptIndex = 0; - - /** - * MCrypt parameters - * - * @see Crypt_RC4::setMCrypt() - * @var Array - * @access private - */ - var $mcrypt = array('', ''); - - /** - * The Encryption Algorithm - * - * Only used if CRYPT_RC4_MODE == CRYPT_RC4_MODE_MCRYPT. Only possible values are MCRYPT_RC4 or MCRYPT_ARCFOUR. - * - * @see Crypt_RC4::Crypt_RC4() - * @var Integer - * @access private - */ - var $mode; - - /** - * Default Constructor. - * - * Determines whether or not the mcrypt extension should be used. - * - * @param optional Integer $mode - * @return Crypt_RC4 - * @access public - */ - function Crypt_RC4() - { - if ( !defined('CRYPT_RC4_MODE') ) { - switch (true) { - case extension_loaded('mcrypt') && (defined('MCRYPT_ARCFOUR') || defined('MCRYPT_RC4')): - // i'd check to see if rc4 was supported, by doing in_array('arcfour', mcrypt_list_algorithms('')), - // but since that can be changed after the object has been created, there doesn't seem to be - // a lot of point... - define('CRYPT_RC4_MODE', CRYPT_RC4_MODE_MCRYPT); - break; - default: - define('CRYPT_RC4_MODE', CRYPT_RC4_MODE_INTERNAL); - } - } - - switch ( CRYPT_RC4_MODE ) { - case CRYPT_RC4_MODE_MCRYPT: - switch (true) { - case defined('MCRYPT_ARCFOUR'): - $this->mode = MCRYPT_ARCFOUR; - break; - case defined('MCRYPT_RC4'); - $this->mode = MCRYPT_RC4; - } - } - } - - /** - * Sets the key. - * - * Keys can be between 1 and 256 bytes long. If they are longer then 256 bytes, the first 256 bytes will - * be used. If no key is explicitly set, it'll be assumed to be a single null byte. - * - * @access public - * @param String $key - */ - function setKey($key) - { - $this->key = $key; - - if ( CRYPT_RC4_MODE == CRYPT_RC4_MODE_MCRYPT ) { - return; - } - - $keyLength = strlen($key); - $keyStream = array(); - for ($i = 0; $i < 256; $i++) { - $keyStream[$i] = $i; - } - $j = 0; - for ($i = 0; $i < 256; $i++) { - $j = ($j + $keyStream[$i] + ord($key[$i % $keyLength])) & 255; - $temp = $keyStream[$i]; - $keyStream[$i] = $keyStream[$j]; - $keyStream[$j] = $temp; - } - - $this->encryptIndex = $this->decryptIndex = array(0, 0); - $this->encryptStream = $this->decryptStream = $keyStream; - } - - /** - * Dummy function. - * - * Some protocols, such as WEP, prepend an "initialization vector" to the key, effectively creating a new key [1]. - * If you need to use an initialization vector in this manner, feel free to prepend it to the key, yourself, before - * calling setKey(). - * - * [1] WEP's initialization vectors (IV's) are used in a somewhat insecure way. Since, in that protocol, - * the IV's are relatively easy to predict, an attack described by - * {@link http://www.drizzle.com/~aboba/IEEE/rc4_ksaproc.pdf Scott Fluhrer, Itsik Mantin, and Adi Shamir} - * can be used to quickly guess at the rest of the key. The following links elaborate: - * - * {@link http://www.rsa.com/rsalabs/node.asp?id=2009 http://www.rsa.com/rsalabs/node.asp?id=2009} - * {@link http://en.wikipedia.org/wiki/Related_key_attack http://en.wikipedia.org/wiki/Related_key_attack} - * - * @param String $iv - * @see Crypt_RC4::setKey() - * @access public - */ - function setIV($iv) - { - } - - /** - * Sets MCrypt parameters. (optional) - * - * If MCrypt is being used, empty strings will be used, unless otherwise specified. - * - * @link http://php.net/function.mcrypt-module-open#function.mcrypt-module-open - * @access public - * @param optional Integer $algorithm_directory - * @param optional Integer $mode_directory - */ - function setMCrypt($algorithm_directory = '', $mode_directory = '') - { - if ( CRYPT_RC4_MODE == CRYPT_RC4_MODE_MCRYPT ) { - $this->mcrypt = array($algorithm_directory, $mode_directory); - $this->_closeMCrypt(); - } - } - - /** - * Encrypts a message. - * - * @see Crypt_RC4::_crypt() - * @access public - * @param String $plaintext - */ - function encrypt($plaintext) - { - return $this->_crypt($plaintext, CRYPT_RC4_ENCRYPT); - } - - /** - * Decrypts a message. - * - * $this->decrypt($this->encrypt($plaintext)) == $this->encrypt($this->encrypt($plaintext)). - * Atleast if the continuous buffer is disabled. - * - * @see Crypt_RC4::_crypt() - * @access public - * @param String $ciphertext - */ - function decrypt($ciphertext) - { - return $this->_crypt($ciphertext, CRYPT_RC4_DECRYPT); - } - - /** - * Encrypts or decrypts a message. - * - * @see Crypt_RC4::encrypt() - * @see Crypt_RC4::decrypt() - * @access private - * @param String $text - * @param Integer $mode - */ - function _crypt($text, $mode) - { - if ( CRYPT_RC4_MODE == CRYPT_RC4_MODE_MCRYPT ) { - $keyStream = $mode == CRYPT_RC4_ENCRYPT ? 'encryptStream' : 'decryptStream'; - - if ($this->$keyStream === false) { - $this->$keyStream = mcrypt_module_open($this->mode, $this->mcrypt[0], MCRYPT_MODE_STREAM, $this->mcrypt[1]); - mcrypt_generic_init($this->$keyStream, $this->key, ''); - } else if (!$this->continuousBuffer) { - mcrypt_generic_init($this->$keyStream, $this->key, ''); - } - $newText = mcrypt_generic($this->$keyStream, $text); - if (!$this->continuousBuffer) { - mcrypt_generic_deinit($this->$keyStream); - } - - return $newText; - } - - if ($this->encryptStream === false) { - $this->setKey($this->key); - } - - switch ($mode) { - case CRYPT_RC4_ENCRYPT: - $keyStream = $this->encryptStream; - list($i, $j) = $this->encryptIndex; - break; - case CRYPT_RC4_DECRYPT: - $keyStream = $this->decryptStream; - list($i, $j) = $this->decryptIndex; - } - - $newText = ''; - for ($k = 0; $k < strlen($text); $k++) { - $i = ($i + 1) & 255; - $j = ($j + $keyStream[$i]) & 255; - $temp = $keyStream[$i]; - $keyStream[$i] = $keyStream[$j]; - $keyStream[$j] = $temp; - $temp = $keyStream[($keyStream[$i] + $keyStream[$j]) & 255]; - $newText.= chr(ord($text[$k]) ^ $temp); - } - - if ($this->continuousBuffer) { - switch ($mode) { - case CRYPT_RC4_ENCRYPT: - $this->encryptStream = $keyStream; - $this->encryptIndex = array($i, $j); - break; - case CRYPT_RC4_DECRYPT: - $this->decryptStream = $keyStream; - $this->decryptIndex = array($i, $j); - } - } - - return $newText; - } - - /** - * Treat consecutive "packets" as if they are a continuous buffer. - * - * Say you have a 16-byte plaintext $plaintext. Using the default behavior, the two following code snippets - * will yield different outputs: - * - * <code> - * echo $rc4->encrypt(substr($plaintext, 0, 8)); - * echo $rc4->encrypt(substr($plaintext, 8, 8)); - * </code> - * <code> - * echo $rc4->encrypt($plaintext); - * </code> - * - * The solution is to enable the continuous buffer. Although this will resolve the above discrepancy, it creates - * another, as demonstrated with the following: - * - * <code> - * $rc4->encrypt(substr($plaintext, 0, 8)); - * echo $rc4->decrypt($des->encrypt(substr($plaintext, 8, 8))); - * </code> - * <code> - * echo $rc4->decrypt($des->encrypt(substr($plaintext, 8, 8))); - * </code> - * - * With the continuous buffer disabled, these would yield the same output. With it enabled, they yield different - * outputs. The reason is due to the fact that the initialization vector's change after every encryption / - * decryption round when the continuous buffer is enabled. When it's disabled, they remain constant. - * - * Put another way, when the continuous buffer is enabled, the state of the Crypt_DES() object changes after each - * encryption / decryption round, whereas otherwise, it'd remain constant. For this reason, it's recommended that - * continuous buffers not be used. They do offer better security and are, in fact, sometimes required (SSH uses them), - * however, they are also less intuitive and more likely to cause you problems. - * - * @see Crypt_RC4::disableContinuousBuffer() - * @access public - */ - function enableContinuousBuffer() - { - $this->continuousBuffer = true; - } - - /** - * Treat consecutive packets as if they are a discontinuous buffer. - * - * The default behavior. - * - * @see Crypt_RC4::enableContinuousBuffer() - * @access public - */ - function disableContinuousBuffer() - { - if ( CRYPT_RC4_MODE == CRYPT_RC4_MODE_INTERNAL ) { - $this->encryptIndex = $this->decryptIndex = array(0, 0); - $this->setKey($this->key); - } - - $this->continuousBuffer = false; - } - - /** - * Dummy function. - * - * Since RC4 is a stream cipher and not a block cipher, no padding is necessary. The only reason this function is - * included is so that you can switch between a block cipher and a stream cipher transparently. - * - * @see Crypt_RC4::disablePadding() - * @access public - */ - function enablePadding() - { - } - - /** - * Dummy function. - * - * @see Crypt_RC4::enablePadding() - * @access public - */ - function disablePadding() - { - } - - /** - * Class destructor. - * - * Will be called, automatically, if you're using PHP5. If you're using PHP4, call it yourself. Only really - * needs to be called if mcrypt is being used. - * - * @access public - */ - function __destruct() - { - if ( CRYPT_RC4_MODE == CRYPT_RC4_MODE_MCRYPT ) { - $this->_closeMCrypt(); - } - } - - /** - * Properly close the MCrypt objects. - * - * @access prviate - */ - function _closeMCrypt() - { - if ( $this->encryptStream !== false ) { - if ( $this->continuousBuffer ) { - mcrypt_generic_deinit($this->encryptStream); - } - - mcrypt_module_close($this->encryptStream); - - $this->encryptStream = false; - } - - if ( $this->decryptStream !== false ) { - if ( $this->continuousBuffer ) { - mcrypt_generic_deinit($this->decryptStream); - } - - mcrypt_module_close($this->decryptStream); - - $this->decryptStream = false; - } - } -} diff --git a/lib/internal/phpseclib/Crypt/RSA.php b/lib/internal/phpseclib/Crypt/RSA.php deleted file mode 100644 index 4d352cad3bd..00000000000 --- a/lib/internal/phpseclib/Crypt/RSA.php +++ /dev/null @@ -1,2119 +0,0 @@ -<?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * Pure-PHP PKCS#1 (v2.1) compliant implementation of RSA. - * - * PHP versions 4 and 5 - * - * Here's an example of how to encrypt and decrypt text with this library: - * <code> - * <?php - * include('Crypt/RSA.php'); - * - * $rsa = new Crypt_RSA(); - * extract($rsa->createKey()); - * - * $plaintext = 'terrafrost'; - * - * $rsa->loadKey($privatekey); - * $ciphertext = $rsa->encrypt($plaintext); - * - * $rsa->loadKey($publickey); - * echo $rsa->decrypt($ciphertext); - * ?> - * </code> - * - * Here's an example of how to create signatures and verify signatures with this library: - * <code> - * <?php - * include('Crypt/RSA.php'); - * - * $rsa = new Crypt_RSA(); - * extract($rsa->createKey()); - * - * $plaintext = 'terrafrost'; - * - * $rsa->loadKey($privatekey); - * $signature = $rsa->sign($plaintext); - * - * $rsa->loadKey($publickey); - * echo $rsa->verify($plaintext, $signature) ? 'verified' : 'unverified'; - * ?> - * </code> - * - * LICENSE: This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - * @category Crypt - * @package Crypt_RSA - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMIX Jim Wigginton - * @license http://www.gnu.org/licenses/lgpl.txt - * @version $Id: RSA.php,v 1.15 2010/04/10 15:57:02 terrafrost Exp $ - * @link http://phpseclib.sourceforge.net - */ - -/** - * Include Math_BigInteger - */ -require_once('Math/BigInteger.php'); - -/** - * Include Crypt_Random - */ -require_once('Crypt/Random.php'); - -/** - * Include Crypt_Hash - */ -require_once('Crypt/Hash.php'); - -/**#@+ - * @access public - * @see Crypt_RSA::encrypt() - * @see Crypt_RSA::decrypt() - */ -/** - * Use {@link http://en.wikipedia.org/wiki/Optimal_Asymmetric_Encryption_Padding Optimal Asymmetric Encryption Padding} - * (OAEP) for encryption / decryption. - * - * Uses sha1 by default. - * - * @see Crypt_RSA::setHash() - * @see Crypt_RSA::setMGFHash() - */ -define('CRYPT_RSA_ENCRYPTION_OAEP', 1); -/** - * Use PKCS#1 padding. - * - * Although CRYPT_RSA_ENCRYPTION_OAEP offers more security, including PKCS#1 padding is necessary for purposes of backwards - * compatability with protocols (like SSH-1) written before OAEP's introduction. - */ -define('CRYPT_RSA_ENCRYPTION_PKCS1', 2); -/**#@-*/ - -/**#@+ - * @access public - * @see Crypt_RSA::sign() - * @see Crypt_RSA::verify() - * @see Crypt_RSA::setHash() - */ -/** - * Use the Probabilistic Signature Scheme for signing - * - * Uses sha1 by default. - * - * @see Crypt_RSA::setSaltLength() - * @see Crypt_RSA::setMGFHash() - */ -define('CRYPT_RSA_SIGNATURE_PSS', 1); -/** - * Use the PKCS#1 scheme by default. - * - * Although CRYPT_RSA_SIGNATURE_PSS offers more security, including PKCS#1 signing is necessary for purposes of backwards - * compatability with protocols (like SSH-2) written before PSS's introduction. - */ -define('CRYPT_RSA_SIGNATURE_PKCS1', 2); -/**#@-*/ - -/**#@+ - * @access private - * @see Crypt_RSA::createKey() - */ -/** - * ASN1 Integer - */ -define('CRYPT_RSA_ASN1_INTEGER', 2); -/** - * ASN1 Sequence (with the constucted bit set) - */ -define('CRYPT_RSA_ASN1_SEQUENCE', 48); -/**#@-*/ - -/**#@+ - * @access private - * @see Crypt_RSA::Crypt_RSA() - */ -/** - * To use the pure-PHP implementation - */ -define('CRYPT_RSA_MODE_INTERNAL', 1); -/** - * To use the OpenSSL library - * - * (if enabled; otherwise, the internal implementation will be used) - */ -define('CRYPT_RSA_MODE_OPENSSL', 2); -/**#@-*/ - -/**#@+ - * @access public - * @see Crypt_RSA::createKey() - * @see Crypt_RSA::setPrivateKeyFormat() - */ -/** - * PKCS#1 formatted private key - * - * Used by OpenSSH - */ -define('CRYPT_RSA_PRIVATE_FORMAT_PKCS1', 0); -/**#@-*/ - -/**#@+ - * @access public - * @see Crypt_RSA::createKey() - * @see Crypt_RSA::setPublicKeyFormat() - */ -/** - * Raw public key - * - * An array containing two Math_BigInteger objects. - * - * The exponent can be indexed with any of the following: - * - * 0, e, exponent, publicExponent - * - * The modulus can be indexed with any of the following: - * - * 1, n, modulo, modulus - */ -define('CRYPT_RSA_PUBLIC_FORMAT_RAW', 1); -/** - * PKCS#1 formatted public key - */ -define('CRYPT_RSA_PUBLIC_FORMAT_PKCS1', 2); -/** - * OpenSSH formatted public key - * - * Place in $HOME/.ssh/authorized_keys - */ -define('CRYPT_RSA_PUBLIC_FORMAT_OPENSSH', 3); -/**#@-*/ - -/** - * Pure-PHP PKCS#1 compliant implementation of RSA. - * - * @author Jim Wigginton <terrafrost@php.net> - * @version 0.1.0 - * @access public - * @package Crypt_RSA - */ -class Crypt_RSA { - /** - * Precomputed Zero - * - * @var Array - * @access private - */ - var $zero; - - /** - * Precomputed One - * - * @var Array - * @access private - */ - var $one; - - /** - * Private Key Format - * - * @var Integer - * @access private - */ - var $privateKeyFormat = CRYPT_RSA_PRIVATE_FORMAT_PKCS1; - - /** - * Public Key Format - * - * @var Integer - * @access public - */ - var $publicKeyFormat = CRYPT_RSA_PUBLIC_FORMAT_PKCS1; - - /** - * Modulus (ie. n) - * - * @var Math_BigInteger - * @access private - */ - var $modulus; - - /** - * Modulus length - * - * @var Math_BigInteger - * @access private - */ - var $k; - - /** - * Exponent (ie. e or d) - * - * @var Math_BigInteger - * @access private - */ - var $exponent; - - /** - * Primes for Chinese Remainder Theorem (ie. p and q) - * - * @var Array - * @access private - */ - var $primes; - - /** - * Exponents for Chinese Remainder Theorem (ie. dP and dQ) - * - * @var Array - * @access private - */ - var $exponents; - - /** - * Coefficients for Chinese Remainder Theorem (ie. qInv) - * - * @var Array - * @access private - */ - var $coefficients; - - /** - * Hash name - * - * @var String - * @access private - */ - var $hashName; - - /** - * Hash function - * - * @var Crypt_Hash - * @access private - */ - var $hash; - - /** - * Length of hash function output - * - * @var Integer - * @access private - */ - var $hLen; - - /** - * Length of salt - * - * @var Integer - * @access private - */ - var $sLen; - - /** - * Hash function for the Mask Generation Function - * - * @var Crypt_Hash - * @access private - */ - var $mgfHash; - - /** - * Length of MGF hash function output - * - * @var Integer - * @access private - */ - var $mgfHLen; - - /** - * Encryption mode - * - * @var Integer - * @access private - */ - var $encryptionMode = CRYPT_RSA_ENCRYPTION_OAEP; - - /** - * Signature mode - * - * @var Integer - * @access private - */ - var $signatureMode = CRYPT_RSA_SIGNATURE_PSS; - - /** - * Public Exponent - * - * @var Mixed - * @access private - */ - var $publicExponent = false; - - /** - * Password - * - * @var String - * @access private - */ - var $password = ''; - - /** - * The constructor - * - * If you want to make use of the openssl extension, you'll need to set the mode manually, yourself. The reason - * Crypt_RSA doesn't do it is because OpenSSL doesn't fail gracefully. openssl_pkey_new(), in particular, requires - * openssl.cnf be present somewhere and, unfortunately, the only real way to find out is too late. - * - * @return Crypt_RSA - * @access public - */ - function Crypt_RSA() - { - if ( !defined('CRYPT_RSA_MODE') ) { - switch (true) { - //case extension_loaded('openssl') && version_compare(PHP_VERSION, '4.2.0', '>='): - // define('CRYPT_RSA_MODE', CRYPT_RSA_MODE_OPENSSL); - // break; - default: - define('CRYPT_RSA_MODE', CRYPT_RSA_MODE_INTERNAL); - } - } - - $this->zero = new Math_BigInteger(); - $this->one = new Math_BigInteger(1); - - $this->hash = new Crypt_Hash('sha1'); - $this->hLen = $this->hash->getLength(); - $this->hashName = 'sha1'; - $this->mgfHash = new Crypt_Hash('sha1'); - $this->mgfHLen = $this->mgfHash->getLength(); - } - - /** - * Create public / private key pair - * - * Returns an array with the following three elements: - * - 'privatekey': The private key. - * - 'publickey': The public key. - * - 'partialkey': A partially computed key (if the execution time exceeded $timeout). - * Will need to be passed back to Crypt_RSA::createKey() as the third parameter for further processing. - * - * @access public - * @param optional Integer $bits - * @param optional Integer $timeout - * @param optional Math_BigInteger $p - */ - function createKey($bits = 1024, $timeout = false, $partial = array()) - { - if ( CRYPT_RSA_MODE == CRYPT_RSA_MODE_OPENSSL ) { - $rsa = openssl_pkey_new(array('private_key_bits' => $bits)); - openssl_pkey_export($rsa, $privatekey); - $publickey = openssl_pkey_get_details($rsa); - $publickey = $publickey['key']; - - if ($this->privateKeyFormat != CRYPT_RSA_PRIVATE_FORMAT_PKCS1) { - $privatekey = call_user_func_array(array($this, '_convertPrivateKey'), array_values($this->_parseKey($privatekey, CRYPT_RSA_PRIVATE_FORMAT_PKCS1))); - $publickey = call_user_func_array(array($this, '_convertPublicKey'), array_values($this->_parseKey($publickey, CRYPT_RSA_PUBLIC_FORMAT_PKCS1))); - } - - return array( - 'privatekey' => $privatekey, - 'publickey' => $publickey, - 'partialkey' => false - ); - } - - static $e; - if (!isset($e)) { - if (!defined('CRYPT_RSA_EXPONENT')) { - // http://en.wikipedia.org/wiki/65537_%28number%29 - define('CRYPT_RSA_EXPONENT', '65537'); - } - if (!defined('CRYPT_RSA_COMMENT')) { - define('CRYPT_RSA_COMMENT', 'phpseclib-generated-key'); - } - // per <http://cseweb.ucsd.edu/~hovav/dist/survey.pdf#page=5>, this number ought not result in primes smaller - // than 256 bits. - if (!defined('CRYPT_RSA_SMALLEST_PRIME')) { - define('CRYPT_RSA_SMALLEST_PRIME', 4096); - } - - $e = new Math_BigInteger(CRYPT_RSA_EXPONENT); - } - - extract($this->_generateMinMax($bits)); - $absoluteMin = $min; - $temp = $bits >> 1; - if ($temp > CRYPT_RSA_SMALLEST_PRIME) { - $num_primes = floor($bits / CRYPT_RSA_SMALLEST_PRIME); - $temp = CRYPT_RSA_SMALLEST_PRIME; - } else { - $num_primes = 2; - } - extract($this->_generateMinMax($temp + $bits % $temp)); - $finalMax = $max; - extract($this->_generateMinMax($temp)); - - $generator = new Math_BigInteger(); - $generator->setRandomGenerator('crypt_random'); - - $n = $this->one->copy(); - if (!empty($partial)) { - extract(unserialize($partial)); - } else { - $exponents = $coefficients = $primes = array(); - $lcm = array( - 'top' => $this->one->copy(), - 'bottom' => false - ); - } - - $start = time(); - $i0 = count($primes) + 1; - - do { - for ($i = $i0; $i <= $num_primes; $i++) { - if ($timeout !== false) { - $timeout-= time() - $start; - $start = time(); - if ($timeout <= 0) { - return serialize(array( - 'privatekey' => '', - 'publickey' => '', - 'partialkey' => array( - 'primes' => $primes, - 'coefficients' => $coefficients, - 'lcm' => $lcm, - 'exponents' => $exponents - ) - )); - } - } - - if ($i == $num_primes) { - list($min, $temp) = $absoluteMin->divide($n); - if (!$temp->equals($this->zero)) { - $min = $min->add($this->one); // ie. ceil() - } - $primes[$i] = $generator->randomPrime($min, $finalMax, $timeout); - } else { - $primes[$i] = $generator->randomPrime($min, $max, $timeout); - } - - if ($primes[$i] === false) { // if we've reached the timeout - return array( - 'privatekey' => '', - 'publickey' => '', - 'partialkey' => empty($primes) ? '' : serialize(array( - 'primes' => array_slice($primes, 0, $i - 1), - 'coefficients' => $coefficients, - 'lcm' => $lcm, - 'exponents' => $exponents - )) - ); - } - - // the first coefficient is calculated differently from the rest - // ie. instead of being $primes[1]->modInverse($primes[2]), it's $primes[2]->modInverse($primes[1]) - if ($i > 2) { - $coefficients[$i] = $n->modInverse($primes[$i]); - } - - $n = $n->multiply($primes[$i]); - - $temp = $primes[$i]->subtract($this->one); - - // textbook RSA implementations use Euler's totient function instead of the least common multiple. - // see http://en.wikipedia.org/wiki/Euler%27s_totient_function - $lcm['top'] = $lcm['top']->multiply($temp); - $lcm['bottom'] = $lcm['bottom'] === false ? $temp : $lcm['bottom']->gcd($temp); - - $exponents[$i] = $e->modInverse($temp); - } - - list($lcm) = $lcm['top']->divide($lcm['bottom']); - $gcd = $lcm->gcd($e); - $i0 = 1; - } while (!$gcd->equals($this->one)); - - $d = $e->modInverse($lcm); - - $coefficients[2] = $primes[2]->modInverse($primes[1]); - - // from <http://tools.ietf.org/html/rfc3447#appendix-A.1.2>: - // RSAPrivateKey ::= SEQUENCE { - // version Version, - // modulus INTEGER, -- n - // publicExponent INTEGER, -- e - // privateExponent INTEGER, -- d - // prime1 INTEGER, -- p - // prime2 INTEGER, -- q - // exponent1 INTEGER, -- d mod (p-1) - // exponent2 INTEGER, -- d mod (q-1) - // coefficient INTEGER, -- (inverse of q) mod p - // otherPrimeInfos OtherPrimeInfos OPTIONAL - // } - - return array( - 'privatekey' => $this->_convertPrivateKey($n, $e, $d, $primes, $exponents, $coefficients), - 'publickey' => $this->_convertPublicKey($n, $e), - 'partialkey' => false - ); - } - - /** - * Convert a private key to the appropriate format. - * - * @access private - * @see setPrivateKeyFormat() - * @param String $RSAPrivateKey - * @return String - */ - function _convertPrivateKey($n, $e, $d, $primes, $exponents, $coefficients) - { - $num_primes = count($primes); - $raw = array( - 'version' => $num_primes == 2 ? chr(0) : chr(1), // two-prime vs. multi - 'modulus' => $n->toBytes(true), - 'publicExponent' => $e->toBytes(true), - 'privateExponent' => $d->toBytes(true), - 'prime1' => $primes[1]->toBytes(true), - 'prime2' => $primes[2]->toBytes(true), - 'exponent1' => $exponents[1]->toBytes(true), - 'exponent2' => $exponents[2]->toBytes(true), - 'coefficient' => $coefficients[2]->toBytes(true) - ); - - // if the format in question does not support multi-prime rsa and multi-prime rsa was used, - // call _convertPublicKey() instead. - switch ($this->privateKeyFormat) { - default: // eg. CRYPT_RSA_PRIVATE_FORMAT_PKCS1 - $components = array(); - foreach ($raw as $name => $value) { - $components[$name] = pack('Ca*a*', CRYPT_RSA_ASN1_INTEGER, $this->_encodeLength(strlen($value)), $value); - } - - $RSAPrivateKey = implode('', $components); - - if ($num_primes > 2) { - $OtherPrimeInfos = ''; - for ($i = 3; $i <= $num_primes; $i++) { - // OtherPrimeInfos ::= SEQUENCE SIZE(1..MAX) OF OtherPrimeInfo - // - // OtherPrimeInfo ::= SEQUENCE { - // prime INTEGER, -- ri - // exponent INTEGER, -- di - // coefficient INTEGER -- ti - // } - $OtherPrimeInfo = pack('Ca*a*', CRYPT_RSA_ASN1_INTEGER, $this->_encodeLength(strlen($primes[$i]->toBytes(true))), $primes[$i]->toBytes(true)); - $OtherPrimeInfo.= pack('Ca*a*', CRYPT_RSA_ASN1_INTEGER, $this->_encodeLength(strlen($exponents[$i]->toBytes(true))), $exponents[$i]->toBytes(true)); - $OtherPrimeInfo.= pack('Ca*a*', CRYPT_RSA_ASN1_INTEGER, $this->_encodeLength(strlen($coefficients[$i]->toBytes(true))), $coefficients[$i]->toBytes(true)); - $OtherPrimeInfos.= pack('Ca*a*', CRYPT_RSA_ASN1_SEQUENCE, $this->_encodeLength(strlen($OtherPrimeInfo)), $OtherPrimeInfo); - } - $RSAPrivateKey.= pack('Ca*a*', CRYPT_RSA_ASN1_SEQUENCE, $this->_encodeLength(strlen($OtherPrimeInfos)), $OtherPrimeInfos); - } - - $RSAPrivateKey = pack('Ca*a*', CRYPT_RSA_ASN1_SEQUENCE, $this->_encodeLength(strlen($RSAPrivateKey)), $RSAPrivateKey); - - if (!empty($this->password)) { - $iv = $this->_random(8); - $symkey = pack('H*', md5($this->password . $iv)); // symkey is short for symmetric key - $symkey.= substr(pack('H*', md5($symkey . $this->password . $iv)), 0, 8); - if (!class_exists('Crypt_TripleDES')) { - require_once('Crypt/TripleDES.php'); - } - $des = new Crypt_TripleDES(); - $des->setKey($symkey); - $des->setIV($iv); - $iv = strtoupper(bin2hex($iv)); - $RSAPrivateKey = "-----BEGIN RSA PRIVATE KEY-----\r\n" . - "Proc-Type: 4,ENCRYPTED\r\n" . - "DEK-Info: DES-EDE3-CBC,$iv\r\n" . - "\r\n" . - chunk_split(base64_encode($des->encrypt($RSAPrivateKey))) . - '-----END RSA PRIVATE KEY-----'; - } else { - $RSAPrivateKey = "-----BEGIN RSA PRIVATE KEY-----\r\n" . - chunk_split(base64_encode($RSAPrivateKey)) . - '-----END RSA PRIVATE KEY-----'; - } - - return $RSAPrivateKey; - } - } - - /** - * Convert a public key to the appropriate format - * - * @access private - * @see setPublicKeyFormat() - * @param String $RSAPrivateKey - * @return String - */ - function _convertPublicKey($n, $e) - { - $modulus = $n->toBytes(true); - $publicExponent = $e->toBytes(true); - - switch ($this->publicKeyFormat) { - case CRYPT_RSA_PUBLIC_FORMAT_RAW: - return array('e' => $e->copy(), 'n' => $n->copy()); - case CRYPT_RSA_PUBLIC_FORMAT_OPENSSH: - // from <http://tools.ietf.org/html/rfc4253#page-15>: - // string "ssh-rsa" - // mpint e - // mpint n - $RSAPublicKey = pack('Na*Na*Na*', strlen('ssh-rsa'), 'ssh-rsa', strlen($publicExponent), $publicExponent, strlen($modulus), $modulus); - $RSAPublicKey = 'ssh-rsa ' . base64_encode($RSAPublicKey) . ' ' . CRYPT_RSA_COMMENT; - - return $RSAPublicKey; - default: // eg. CRYPT_RSA_PUBLIC_FORMAT_PKCS1 - // from <http://tools.ietf.org/html/rfc3447#appendix-A.1.1>: - // RSAPublicKey ::= SEQUENCE { - // modulus INTEGER, -- n - // publicExponent INTEGER -- e - // } - $components = array( - 'modulus' => pack('Ca*a*', CRYPT_RSA_ASN1_INTEGER, $this->_encodeLength(strlen($modulus)), $modulus), - 'publicExponent' => pack('Ca*a*', CRYPT_RSA_ASN1_INTEGER, $this->_encodeLength(strlen($publicExponent)), $publicExponent) - ); - - $RSAPublicKey = pack('Ca*a*a*', - CRYPT_RSA_ASN1_SEQUENCE, $this->_encodeLength(strlen($components['modulus']) + strlen($components['publicExponent'])), - $components['modulus'], $components['publicExponent'] - ); - - $RSAPublicKey = "-----BEGIN PUBLIC KEY-----\r\n" . - chunk_split(base64_encode($RSAPublicKey)) . - '-----END PUBLIC KEY-----'; - - return $RSAPublicKey; - } - } - - /** - * Break a public or private key down into its constituant components - * - * @access private - * @see _convertPublicKey() - * @see _convertPrivateKey() - * @param String $key - * @param Integer $type - * @return Array - */ - function _parseKey($key, $type) - { - switch ($type) { - case CRYPT_RSA_PUBLIC_FORMAT_RAW: - if (!is_array($key)) { - return false; - } - $components = array(); - switch (true) { - case isset($key['e']): - $components['publicExponent'] = $key['e']->copy(); - break; - case isset($key['exponent']): - $components['publicExponent'] = $key['exponent']->copy(); - break; - case isset($key['publicExponent']): - $components['publicExponent'] = $key['publicExponent']->copy(); - break; - case isset($key[0]): - $components['publicExponent'] = $key[0]->copy(); - } - switch (true) { - case isset($key['n']): - $components['modulus'] = $key['n']->copy(); - break; - case isset($key['modulo']): - $components['modulus'] = $key['modulo']->copy(); - break; - case isset($key['modulus']): - $components['modulus'] = $key['modulus']->copy(); - break; - case isset($key[1]): - $components['modulus'] = $key[1]->copy(); - } - return $components; - case CRYPT_RSA_PRIVATE_FORMAT_PKCS1: - case CRYPT_RSA_PUBLIC_FORMAT_PKCS1: - /* Although PKCS#1 proposes a format that public and private keys can use, encrypting them is - "outside the scope" of PKCS#1. PKCS#1 then refers you to PKCS#12 and PKCS#15 if you're wanting to - protect private keys, however, that's not what OpenSSL* does. OpenSSL protects private keys by adding - two new "fields" to the key - DEK-Info and Proc-Type. These fields are discussed here: - - http://tools.ietf.org/html/rfc1421#section-4.6.1.1 - http://tools.ietf.org/html/rfc1421#section-4.6.1.3 - - DES-EDE3-CBC as an algorithm, however, is not discussed anywhere, near as I can tell. - DES-CBC and DES-EDE are discussed in RFC1423, however, DES-EDE3-CBC isn't, nor is its key derivation - function. As is, the definitive authority on this encoding scheme isn't the IETF but rather OpenSSL's - own implementation. ie. the implementation *is* the standard and any bugs that may exist in that - implementation are part of the standard, as well. - - * OpenSSL is the de facto standard. It's utilized by OpenSSH and other projects */ - if (preg_match('#DEK-Info: (.+),(.+)#', $key, $matches)) { - $iv = pack('H*', trim($matches[2])); - $symkey = pack('H*', md5($this->password . $iv)); // symkey is short for symmetric key - $symkey.= substr(pack('H*', md5($symkey . $this->password . $iv)), 0, 8); - $ciphertext = preg_replace('#.+(\r|\n|\r\n)\1|[\r\n]|-.+-#s', '', $key); - $ciphertext = preg_match('#^[a-zA-Z\d/+]*={0,2}$#', $ciphertext) ? base64_decode($ciphertext) : false; - if ($ciphertext === false) { - $ciphertext = $key; - } - switch ($matches[1]) { - case 'DES-EDE3-CBC': - if (!class_exists('Crypt_TripleDES')) { - require_once('Crypt/TripleDES.php'); - } - $crypto = new Crypt_TripleDES(); - break; - case 'DES-CBC': - if (!class_exists('Crypt_DES')) { - require_once('Crypt/DES.php'); - } - $crypto = new Crypt_DES(); - break; - default: - return false; - } - $crypto->setKey($symkey); - $crypto->setIV($iv); - $decoded = $crypto->decrypt($ciphertext); - } else { - $decoded = preg_replace('#-.+-|[\r\n]#', '', $key); - $decoded = preg_match('#^[a-zA-Z\d/+]*={0,2}$#', $decoded) ? base64_decode($decoded) : false; - } - - if ($decoded !== false) { - $key = $decoded; - } - - $components = array(); - - if (ord($this->_string_shift($key)) != CRYPT_RSA_ASN1_SEQUENCE) { - return false; - } - if ($this->_decodeLength($key) != strlen($key)) { - return false; - } - - $tag = ord($this->_string_shift($key)); - if ($tag == CRYPT_RSA_ASN1_SEQUENCE) { - /* intended for keys for which OpenSSL's asn1parse returns the following: - - 0:d=0 hl=4 l= 290 cons: SEQUENCE - 4:d=1 hl=2 l= 13 cons: SEQUENCE - 6:d=2 hl=2 l= 9 prim: OBJECT :rsaEncryption - 17:d=2 hl=2 l= 0 prim: NULL - 19:d=1 hl=4 l= 271 prim: BIT STRING */ - $this->_string_shift($key, $this->_decodeLength($key)); - $this->_string_shift($key); // skip over the BIT STRING tag - $this->_decodeLength($key); // skip over the BIT STRING length - // "The initial octet shall encode, as an unsigned binary integer wtih bit 1 as the least significant bit, the number of - // unused bits in teh final subsequent octet. The number shall be in the range zero to seven." - // -- http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf (section 8.6.2.2) - $this->_string_shift($key); - if (ord($this->_string_shift($key)) != CRYPT_RSA_ASN1_SEQUENCE) { - return false; - } - if ($this->_decodeLength($key) != strlen($key)) { - return false; - } - $tag = ord($this->_string_shift($key)); - } - if ($tag != CRYPT_RSA_ASN1_INTEGER) { - return false; - } - - $length = $this->_decodeLength($key); - $temp = $this->_string_shift($key, $length); - if (strlen($temp) != 1 || ord($temp) > 2) { - $components['modulus'] = new Math_BigInteger($temp, -256); - $this->_string_shift($key); // skip over CRYPT_RSA_ASN1_INTEGER - $length = $this->_decodeLength($key); - $components[$type == CRYPT_RSA_PUBLIC_FORMAT_PKCS1 ? 'publicExponent' : 'privateExponent'] = new Math_BigInteger($this->_string_shift($key, $length), -256); - - return $components; - } - if (ord($this->_string_shift($key)) != CRYPT_RSA_ASN1_INTEGER) { - return false; - } - $length = $this->_decodeLength($key); - $components['modulus'] = new Math_BigInteger($this->_string_shift($key, $length), -256); - $this->_string_shift($key); - $length = $this->_decodeLength($key); - $components['publicExponent'] = new Math_BigInteger($this->_string_shift($key, $length), -256); - $this->_string_shift($key); - $length = $this->_decodeLength($key); - $components['privateExponent'] = new Math_BigInteger($this->_string_shift($key, $length), -256); - $this->_string_shift($key); - $length = $this->_decodeLength($key); - $components['primes'] = array(1 => new Math_BigInteger($this->_string_shift($key, $length), -256)); - $this->_string_shift($key); - $length = $this->_decodeLength($key); - $components['primes'][] = new Math_BigInteger($this->_string_shift($key, $length), -256); - $this->_string_shift($key); - $length = $this->_decodeLength($key); - $components['exponents'] = array(1 => new Math_BigInteger($this->_string_shift($key, $length), -256)); - $this->_string_shift($key); - $length = $this->_decodeLength($key); - $components['exponents'][] = new Math_BigInteger($this->_string_shift($key, $length), -256); - $this->_string_shift($key); - $length = $this->_decodeLength($key); - $components['coefficients'] = array(2 => new Math_BigInteger($this->_string_shift($key, $length), -256)); - - if (!empty($key)) { - if (ord($this->_string_shift($key)) != CRYPT_RSA_ASN1_SEQUENCE) { - return false; - } - $this->_decodeLength($key); - while (!empty($key)) { - if (ord($this->_string_shift($key)) != CRYPT_RSA_ASN1_SEQUENCE) { - return false; - } - $this->_decodeLength($key); - $key = substr($key, 1); - $length = $this->_decodeLength($key); - $components['primes'][] = new Math_BigInteger($this->_string_shift($key, $length), -256); - $this->_string_shift($key); - $length = $this->_decodeLength($key); - $components['exponents'][] = new Math_BigInteger($this->_string_shift($key, $length), -256); - $this->_string_shift($key); - $length = $this->_decodeLength($key); - $components['coefficients'][] = new Math_BigInteger($this->_string_shift($key, $length), -256); - } - } - - return $components; - case CRYPT_RSA_PUBLIC_FORMAT_OPENSSH: - $key = base64_decode(preg_replace('#^ssh-rsa | .+$#', '', $key)); - if ($key === false) { - return false; - } - - $cleanup = substr($key, 0, 11) == "\0\0\0\7ssh-rsa"; - - extract(unpack('Nlength', $this->_string_shift($key, 4))); - $publicExponent = new Math_BigInteger($this->_string_shift($key, $length), -256); - extract(unpack('Nlength', $this->_string_shift($key, 4))); - $modulus = new Math_BigInteger($this->_string_shift($key, $length), -256); - - if ($cleanup && strlen($key)) { - extract(unpack('Nlength', $this->_string_shift($key, 4))); - return array( - 'modulus' => new Math_BigInteger($this->_string_shift($key, $length), -256), - 'publicExponent' => $modulus - ); - } else { - return array( - 'modulus' => $modulus, - 'publicExponent' => $publicExponent - ); - } - } - } - - /** - * Loads a public or private key - * - * Returns true on success and false on failure (ie. an incorrect password was provided or the key was malformed) - * - * @access public - * @param String $key - * @param Integer $type optional - */ - function loadKey($key, $type = CRYPT_RSA_PRIVATE_FORMAT_PKCS1) - { - $components = $this->_parseKey($key, $type); - if ($components === false) { - return false; - } - - $this->modulus = $components['modulus']; - $this->k = strlen($this->modulus->toBytes()); - $this->exponent = isset($components['privateExponent']) ? $components['privateExponent'] : $components['publicExponent']; - if (isset($components['primes'])) { - $this->primes = $components['primes']; - $this->exponents = $components['exponents']; - $this->coefficients = $components['coefficients']; - $this->publicExponent = $components['publicExponent']; - } else { - $this->primes = array(); - $this->exponents = array(); - $this->coefficients = array(); - $this->publicExponent = false; - } - - return true; - } - - /** - * Sets the password - * - * Private keys can be encrypted with a password. To unset the password, pass in the empty string or false. - * Or rather, pass in $password such that empty($password) is true. - * - * @see createKey() - * @see loadKey() - * @access public - * @param String $password - */ - function setPassword($password) - { - $this->password = $password; - } - - /** - * Defines the public key - * - * Some private key formats define the public exponent and some don't. Those that don't define it are problematic when - * used in certain contexts. For example, in SSH-2, RSA authentication works by sending the public key along with a - * message signed by the private key to the server. The SSH-2 server looks the public key up in an index of public keys - * and if it's present then proceeds to verify the signature. Problem is, if your private key doesn't include the public - * exponent this won't work unless you manually add the public exponent. - * - * Do note that when a new key is loaded the index will be cleared. - * - * Returns true on success, false on failure - * - * @see getPublicKey() - * @access public - * @param String $key - * @param Integer $type optional - * @return Boolean - */ - function setPublicKey($key, $type = CRYPT_RSA_PUBLIC_FORMAT_PKCS1) - { - $components = $this->_parseKey($key, $type); - if (empty($this->modulus) || !$this->modulus->equals($components['modulus'])) { - return false; - } - $this->publicExponent = $components['publicExponent']; - } - - /** - * Returns the public key - * - * The public key is only returned under two circumstances - if the private key had the public key embedded within it - * or if the public key was set via setPublicKey(). If the currently loaded key is supposed to be the public key this - * function won't return it since this library, for the most part, doesn't distinguish between public and private keys. - * - * @see getPublicKey() - * @access public - * @param String $key - * @param Integer $type optional - */ - function getPublicKey($type = CRYPT_RSA_PUBLIC_FORMAT_PKCS1) - { - if (empty($this->modulus) || empty($this->publicExponent)) { - return false; - } - - $oldFormat = $this->publicKeyFormat; - $this->publicKeyFormat = $type; - $temp = $this->_convertPublicKey($this->modulus, $this->publicExponent); - $this->publicKeyFormat = $oldFormat; - return $temp; - } - - /** - * Generates the smallest and largest numbers requiring $bits bits - * - * @access private - * @param Integer $bits - * @return Array - */ - function _generateMinMax($bits) - { - $bytes = $bits >> 3; - $min = str_repeat(chr(0), $bytes); - $max = str_repeat(chr(0xFF), $bytes); - $msb = $bits & 7; - if ($msb) { - $min = chr(1 << ($msb - 1)) . $min; - $max = chr((1 << $msb) - 1) . $max; - } else { - $min[0] = chr(0x80); - } - - return array( - 'min' => new Math_BigInteger($min, 256), - 'max' => new Math_BigInteger($max, 256) - ); - } - - /** - * DER-decode the length - * - * DER supports lengths up to (2**8)**127, however, we'll only support lengths up to (2**8)**4. See - * {@link http://itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#p=13 X.690 � 8.1.3} for more information. - * - * @access private - * @param String $string - * @return Integer - */ - function _decodeLength(&$string) - { - $length = ord($this->_string_shift($string)); - if ( $length & 0x80 ) { // definite length, long form - $length&= 0x7F; - $temp = $this->_string_shift($string, $length); - list(, $length) = unpack('N', substr(str_pad($temp, 4, chr(0), STR_PAD_LEFT), -4)); - } - return $length; - } - - /** - * DER-encode the length - * - * DER supports lengths up to (2**8)**127, however, we'll only support lengths up to (2**8)**4. See - * {@link http://itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#p=13 X.690 � 8.1.3} for more information. - * - * @access private - * @param Integer $length - * @return String - */ - function _encodeLength($length) - { - if ($length <= 0x7F) { - return chr($length); - } - - $temp = ltrim(pack('N', $length), chr(0)); - return pack('Ca*', 0x80 | strlen($temp), $temp); - } - - /** - * String Shift - * - * Inspired by array_shift - * - * @param String $string - * @param optional Integer $index - * @return String - * @access private - */ - function _string_shift(&$string, $index = 1) - { - $substr = substr($string, 0, $index); - $string = substr($string, $index); - return $substr; - } - - /** - * Determines the private key format - * - * @see createKey() - * @access public - * @param Integer $format - */ - function setPrivateKeyFormat($format) - { - $this->privateKeyFormat = $format; - } - - /** - * Determines the public key format - * - * @see createKey() - * @access public - * @param Integer $format - */ - function setPublicKeyFormat($format) - { - $this->publicKeyFormat = $format; - } - - /** - * Determines which hashing function should be used - * - * Used with signature production / verification and (if the encryption mode is CRYPT_RSA_ENCRYPTION_OAEP) encryption and - * decryption. If $hash isn't supported, sha1 is used. - * - * @access public - * @param String $hash - */ - function setHash($hash) - { - // Crypt_Hash supports algorithms that PKCS#1 doesn't support. md5-96 and sha1-96, for example. - switch ($hash) { - case 'md2': - case 'md5': - case 'sha1': - case 'sha256': - case 'sha384': - case 'sha512': - $this->hash = new Crypt_Hash($hash); - $this->hashName = $hash; - break; - default: - $this->hash = new Crypt_Hash('sha1'); - $this->hashName = 'sha1'; - } - $this->hLen = $this->hash->getLength(); - } - - /** - * Determines which hashing function should be used for the mask generation function - * - * The mask generation function is used by CRYPT_RSA_ENCRYPTION_OAEP and CRYPT_RSA_SIGNATURE_PSS and although it's - * best if Hash and MGFHash are set to the same thing this is not a requirement. - * - * @access public - * @param String $hash - */ - function setMGFHash($hash) - { - // Crypt_Hash supports algorithms that PKCS#1 doesn't support. md5-96 and sha1-96, for example. - switch ($hash) { - case 'md2': - case 'md5': - case 'sha1': - case 'sha256': - case 'sha384': - case 'sha512': - $this->mgfHash = new Crypt_Hash($hash); - break; - default: - $this->mgfHash = new Crypt_Hash('sha1'); - } - $this->mgfHLen = $this->mgfHash->getLength(); - } - - /** - * Determines the salt length - * - * To quote from {@link http://tools.ietf.org/html/rfc3447#page-38 RFC3447#page-38}: - * - * Typical salt lengths in octets are hLen (the length of the output - * of the hash function Hash) and 0. - * - * @access public - * @param Integer $format - */ - function setSaltLength($sLen) - { - $this->sLen = $sLen; - } - - /** - * Generates a random string x bytes long - * - * @access public - * @param Integer $bytes - * @param optional Integer $nonzero - * @return String - */ - function _random($bytes, $nonzero = false) - { - $temp = ''; - if ($nonzero) { - for ($i = 0; $i < $bytes; $i++) { - $temp.= chr(crypt_random(1, 255)); - } - } else { - $ints = ($bytes + 1) >> 2; - for ($i = 0; $i < $ints; $i++) { - $temp.= pack('N', crypt_random()); - } - $temp = substr($temp, 0, $bytes); - } - return $temp; - } - - /** - * Integer-to-Octet-String primitive - * - * See {@link http://tools.ietf.org/html/rfc3447#section-4.1 RFC3447#section-4.1}. - * - * @access private - * @param Math_BigInteger $x - * @param Integer $xLen - * @return String - */ - function _i2osp($x, $xLen) - { - $x = $x->toBytes(); - if (strlen($x) > $xLen) { - user_error('Integer too large', E_USER_NOTICE); - return false; - } - return str_pad($x, $xLen, chr(0), STR_PAD_LEFT); - } - - /** - * Octet-String-to-Integer primitive - * - * See {@link http://tools.ietf.org/html/rfc3447#section-4.2 RFC3447#section-4.2}. - * - * @access private - * @param String $x - * @return Math_BigInteger - */ - function _os2ip($x) - { - return new Math_BigInteger($x, 256); - } - - /** - * Exponentiate with or without Chinese Remainder Theorem - * - * See {@link http://tools.ietf.org/html/rfc3447#section-5.1.1 RFC3447#section-5.1.2}. - * - * @access private - * @param Math_BigInteger $x - * @return Math_BigInteger - */ - function _exponentiate($x) - { - if (empty($this->primes) || empty($this->coefficients) || empty($this->exponents)) { - return $x->modPow($this->exponent, $this->modulus); - } - - $num_primes = count($this->primes); - - if (defined('CRYPT_RSA_DISABLE_BLINDING')) { - $m_i = array( - 1 => $x->modPow($this->exponents[1], $this->primes[1]), - 2 => $x->modPow($this->exponents[2], $this->primes[2]) - ); - $h = $m_i[1]->subtract($m_i[2]); - $h = $h->multiply($this->coefficients[2]); - list(, $h) = $h->divide($this->primes[1]); - $m = $m_i[2]->add($h->multiply($this->primes[2])); - - $r = $this->primes[1]; - for ($i = 3; $i <= $num_primes; $i++) { - $m_i = $x->modPow($this->exponents[$i], $this->primes[$i]); - - $r = $r->multiply($this->primes[$i - 1]); - - $h = $m_i->subtract($m); - $h = $h->multiply($this->coefficients[$i]); - list(, $h) = $h->divide($this->primes[$i]); - - $m = $m->add($r->multiply($h)); - } - } else { - $smallest = $this->primes[1]; - for ($i = 2; $i <= $num_primes; $i++) { - if ($smallest->compare($this->primes[$i]) > 0) { - $smallest = $this->primes[$i]; - } - } - - $one = new Math_BigInteger(1); - $one->setRandomGenerator('crypt_random'); - - $r = $one->random($one, $smallest->subtract($one)); - - $m_i = array( - 1 => $this->_blind($x, $r, 1), - 2 => $this->_blind($x, $r, 2) - ); - $h = $m_i[1]->subtract($m_i[2]); - $h = $h->multiply($this->coefficients[2]); - list(, $h) = $h->divide($this->primes[1]); - $m = $m_i[2]->add($h->multiply($this->primes[2])); - - $r = $this->primes[1]; - for ($i = 3; $i <= $num_primes; $i++) { - $m_i = $this->_blind($x, $r, $i); - - $r = $r->multiply($this->primes[$i - 1]); - - $h = $m_i->subtract($m); - $h = $h->multiply($this->coefficients[$i]); - list(, $h) = $h->divide($this->primes[$i]); - - $m = $m->add($r->multiply($h)); - } - } - - return $m; - } - - /** - * Performs RSA Blinding - * - * Protects against timing attacks by employing RSA Blinding. - * Returns $x->modPow($this->exponents[$i], $this->primes[$i]) - * - * @access private - * @param Math_BigInteger $x - * @param Math_BigInteger $r - * @param Integer $i - * @return Math_BigInteger - */ - function _blind($x, $r, $i) - { - $x = $x->multiply($r->modPow($this->publicExponent, $this->primes[$i])); - - $x = $x->modPow($this->exponents[$i], $this->primes[$i]); - - $r = $r->modInverse($this->primes[$i]); - $x = $x->multiply($r); - list(, $x) = $x->divide($this->primes[$i]); - - return $x; - } - - /** - * RSAEP - * - * See {@link http://tools.ietf.org/html/rfc3447#section-5.1.1 RFC3447#section-5.1.1}. - * - * @access private - * @param Math_BigInteger $m - * @return Math_BigInteger - */ - function _rsaep($m) - { - if ($m->compare($this->zero) < 0 || $m->compare($this->modulus) > 0) { - user_error('Message representative out of range', E_USER_NOTICE); - return false; - } - return $this->_exponentiate($m); - } - - /** - * RSADP - * - * See {@link http://tools.ietf.org/html/rfc3447#section-5.1.2 RFC3447#section-5.1.2}. - * - * @access private - * @param Math_BigInteger $c - * @return Math_BigInteger - */ - function _rsadp($c) - { - if ($c->compare($this->zero) < 0 || $c->compare($this->modulus) > 0) { - user_error('Ciphertext representative out of range', E_USER_NOTICE); - return false; - } - return $this->_exponentiate($c); - } - - /** - * RSASP1 - * - * See {@link http://tools.ietf.org/html/rfc3447#section-5.2.1 RFC3447#section-5.2.1}. - * - * @access private - * @param Math_BigInteger $m - * @return Math_BigInteger - */ - function _rsasp1($m) - { - if ($m->compare($this->zero) < 0 || $m->compare($this->modulus) > 0) { - user_error('Message representative out of range', E_USER_NOTICE); - return false; - } - return $this->_exponentiate($m); - } - - /** - * RSAVP1 - * - * See {@link http://tools.ietf.org/html/rfc3447#section-5.2.2 RFC3447#section-5.2.2}. - * - * @access private - * @param Math_BigInteger $s - * @return Math_BigInteger - */ - function _rsavp1($s) - { - if ($s->compare($this->zero) < 0 || $s->compare($this->modulus) > 0) { - user_error('Signature representative out of range', E_USER_NOTICE); - return false; - } - return $this->_exponentiate($s); - } - - /** - * MGF1 - * - * See {@link http://tools.ietf.org/html/rfc3447#appendix-B.2.1 RFC3447#appendix-B.2.1}. - * - * @access private - * @param String $mgfSeed - * @param Integer $mgfLen - * @return String - */ - function _mgf1($mgfSeed, $maskLen) - { - // if $maskLen would yield strings larger than 4GB, PKCS#1 suggests a "Mask too long" error be output. - - $t = ''; - $count = ceil($maskLen / $this->mgfHLen); - for ($i = 0; $i < $count; $i++) { - $c = pack('N', $i); - $t.= $this->mgfHash->hash($mgfSeed . $c); - } - - return substr($t, 0, $maskLen); - } - - /** - * RSAES-OAEP-ENCRYPT - * - * See {@link http://tools.ietf.org/html/rfc3447#section-7.1.1 RFC3447#section-7.1.1} and - * {http://en.wikipedia.org/wiki/Optimal_Asymmetric_Encryption_Padding OAES}. - * - * @access private - * @param String $m - * @param String $l - * @return String - */ - function _rsaes_oaep_encrypt($m, $l = '') - { - $mLen = strlen($m); - - // Length checking - - // if $l is larger than two million terrabytes and you're using sha1, PKCS#1 suggests a "Label too long" error - // be output. - - if ($mLen > $this->k - 2 * $this->hLen - 2) { - user_error('Message too long', E_USER_NOTICE); - return false; - } - - // EME-OAEP encoding - - $lHash = $this->hash->hash($l); - $ps = str_repeat(chr(0), $this->k - $mLen - 2 * $this->hLen - 2); - $db = $lHash . $ps . chr(1) . $m; - $seed = $this->_random($this->hLen); - $dbMask = $this->_mgf1($seed, $this->k - $this->hLen - 1); - $maskedDB = $db ^ $dbMask; - $seedMask = $this->_mgf1($maskedDB, $this->hLen); - $maskedSeed = $seed ^ $seedMask; - $em = chr(0) . $maskedSeed . $maskedDB; - - // RSA encryption - - $m = $this->_os2ip($em); - $c = $this->_rsaep($m); - $c = $this->_i2osp($c, $this->k); - - // Output the ciphertext C - - return $c; - } - - /** - * RSAES-OAEP-DECRYPT - * - * See {@link http://tools.ietf.org/html/rfc3447#section-7.1.2 RFC3447#section-7.1.2}. The fact that the error - * messages aren't distinguishable from one another hinders debugging, but, to quote from RFC3447#section-7.1.2: - * - * Note. Care must be taken to ensure that an opponent cannot - * distinguish the different error conditions in Step 3.g, whether by - * error message or timing, or, more generally, learn partial - * information about the encoded message EM. Otherwise an opponent may - * be able to obtain useful information about the decryption of the - * ciphertext C, leading to a chosen-ciphertext attack such as the one - * observed by Manger [36]. - * - * As for $l... to quote from {@link http://tools.ietf.org/html/rfc3447#page-17 RFC3447#page-17}: - * - * Both the encryption and the decryption operations of RSAES-OAEP take - * the value of a label L as input. In this version of PKCS #1, L is - * the empty string; other uses of the label are outside the scope of - * this document. - * - * @access private - * @param String $c - * @param String $l - * @return String - */ - function _rsaes_oaep_decrypt($c, $l = '') - { - // Length checking - - // if $l is larger than two million terrabytes and you're using sha1, PKCS#1 suggests a "Label too long" error - // be output. - - if (strlen($c) != $this->k || $this->k < 2 * $this->hLen + 2) { - user_error('Decryption error', E_USER_NOTICE); - return false; - } - - // RSA decryption - - $c = $this->_os2ip($c); - $m = $this->_rsadp($c); - if ($m === false) { - user_error('Decryption error', E_USER_NOTICE); - return false; - } - $em = $this->_i2osp($m, $this->k); - - // EME-OAEP decoding - - $lHash = $this->hash->hash($l); - $y = ord($em[0]); - $maskedSeed = substr($em, 1, $this->hLen); - $maskedDB = substr($em, $this->hLen + 1); - $seedMask = $this->_mgf1($maskedDB, $this->hLen); - $seed = $maskedSeed ^ $seedMask; - $dbMask = $this->_mgf1($seed, $this->k - $this->hLen - 1); - $db = $maskedDB ^ $dbMask; - $lHash2 = substr($db, 0, $this->hLen); - $m = substr($db, $this->hLen); - if ($lHash != $lHash2) { - user_error('Decryption error', E_USER_NOTICE); - return false; - } - $m = ltrim($m, chr(0)); - if (ord($m[0]) != 1) { - user_error('Decryption error', E_USER_NOTICE); - return false; - } - - // Output the message M - - return substr($m, 1); - } - - /** - * RSAES-PKCS1-V1_5-ENCRYPT - * - * See {@link http://tools.ietf.org/html/rfc3447#section-7.2.1 RFC3447#section-7.2.1}. - * - * @access private - * @param String $m - * @return String - */ - function _rsaes_pkcs1_v1_5_encrypt($m) - { - $mLen = strlen($m); - - // Length checking - - if ($mLen > $this->k - 11) { - user_error('Message too long', E_USER_NOTICE); - return false; - } - - // EME-PKCS1-v1_5 encoding - - $ps = $this->_random($this->k - $mLen - 3, true); - $em = chr(0) . chr(2) . $ps . chr(0) . $m; - - // RSA encryption - $m = $this->_os2ip($em); - $c = $this->_rsaep($m); - $c = $this->_i2osp($c, $this->k); - - // Output the ciphertext C - - return $c; - } - - /** - * RSAES-PKCS1-V1_5-DECRYPT - * - * See {@link http://tools.ietf.org/html/rfc3447#section-7.2.2 RFC3447#section-7.2.2}. - * - * For compatability purposes, this function departs slightly from the description given in RFC3447. - * The reason being that RFC2313#section-8.1 (PKCS#1 v1.5) states that ciphertext's encrypted by the - * private key should have the second byte set to either 0 or 1 and that ciphertext's encrypted by the - * public key should have the second byte set to 2. In RFC3447 (PKCS#1 v2.1), the second byte is supposed - * to be 2 regardless of which key is used. for compatability purposes, we'll just check to make sure the - * second byte is 2 or less. If it is, we'll accept the decrypted string as valid. - * - * As a consequence of this, a private key encrypted ciphertext produced with Crypt_RSA may not decrypt - * with a strictly PKCS#1 v1.5 compliant RSA implementation. Public key encrypted ciphertext's should but - * not private key encrypted ciphertext's. - * - * @access private - * @param String $c - * @return String - */ - function _rsaes_pkcs1_v1_5_decrypt($c) - { - // Length checking - - if (strlen($c) != $this->k) { // or if k < 11 - user_error('Decryption error', E_USER_NOTICE); - return false; - } - - // RSA decryption - - $c = $this->_os2ip($c); - $m = $this->_rsadp($c); - if ($m === false) { - user_error('Decryption error', E_USER_NOTICE); - return false; - } - $em = $this->_i2osp($m, $this->k); - - // EME-PKCS1-v1_5 decoding - - if (ord($em[0]) != 0 || ord($em[1]) > 2) { - user_error('Decryption error', E_USER_NOTICE); - return false; - } - - $ps = substr($em, 2, strpos($em, chr(0), 2) - 2); - $m = substr($em, strlen($ps) + 3); - - if (strlen($ps) < 8) { - user_error('Decryption error', E_USER_NOTICE); - return false; - } - - // Output M - - return $m; - } - - /** - * EMSA-PSS-ENCODE - * - * See {@link http://tools.ietf.org/html/rfc3447#section-9.1.1 RFC3447#section-9.1.1}. - * - * @access private - * @param String $m - * @param Integer $emBits - */ - function _emsa_pss_encode($m, $emBits) - { - // if $m is larger than two million terrabytes and you're using sha1, PKCS#1 suggests a "Label too long" error - // be output. - - $emLen = ($emBits + 1) >> 3; // ie. ceil($emBits / 8) - $sLen = $this->sLen == false ? $this->hLen : $this->sLen; - - $mHash = $this->hash->hash($m); - if ($emLen < $this->hLen + $sLen + 2) { - user_error('Encoding error', E_USER_NOTICE); - return false; - } - - $salt = $this->_random($sLen); - $m2 = "\0\0\0\0\0\0\0\0" . $mHash . $salt; - $h = $this->hash->hash($m2); - $ps = str_repeat(chr(0), $emLen - $sLen - $this->hLen - 2); - $db = $ps . chr(1) . $salt; - $dbMask = $this->_mgf1($h, $emLen - $this->hLen - 1); - $maskedDB = $db ^ $dbMask; - $maskedDB[0] = ~chr(0xFF << ($emBits & 7)) & $maskedDB[0]; - $em = $maskedDB . $h . chr(0xBC); - - return $em; - } - - /** - * EMSA-PSS-VERIFY - * - * See {@link http://tools.ietf.org/html/rfc3447#section-9.1.2 RFC3447#section-9.1.2}. - * - * @access private - * @param String $m - * @param String $em - * @param Integer $emBits - * @return String - */ - function _emsa_pss_verify($m, $em, $emBits) - { - // if $m is larger than two million terrabytes and you're using sha1, PKCS#1 suggests a "Label too long" error - // be output. - - $emLen = ($emBits + 1) >> 3; // ie. ceil($emBits / 8); - $sLen = $this->sLen == false ? $this->hLen : $this->sLen; - - $mHash = $this->hash->hash($m); - if ($emLen < $this->hLen + $sLen + 2) { - return false; - } - - if ($em[strlen($em) - 1] != chr(0xBC)) { - return false; - } - - $maskedDB = substr($em, 0, $em - $this->hLen - 1); - $h = substr($em, $em - $this->hLen - 1, $this->hLen); - $temp = chr(0xFF << ($emBits & 7)); - if ((~$maskedDB[0] & $temp) != $temp) { - return false; - } - $dbMask = $this->_mgf1($h, $emLen - $this->hLen - 1); - $db = $maskedDB ^ $dbMask; - $db[0] = ~chr(0xFF << ($emBits & 7)) & $db[0]; - $temp = $emLen - $this->hLen - $sLen - 2; - if (substr($db, 0, $temp) != str_repeat(chr(0), $temp) || ord($db[$temp]) != 1) { - return false; - } - $salt = substr($db, $temp + 1); // should be $sLen long - $m2 = "\0\0\0\0\0\0\0\0" . $mHash . $salt; - $h2 = $this->hash->hash($m2); - return $h == $h2; - } - - /** - * RSASSA-PSS-SIGN - * - * See {@link http://tools.ietf.org/html/rfc3447#section-8.1.1 RFC3447#section-8.1.1}. - * - * @access private - * @param String $m - * @return String - */ - function _rsassa_pss_sign($m) - { - // EMSA-PSS encoding - - $em = $this->_emsa_pss_encode($m, 8 * $this->k - 1); - - // RSA signature - - $m = $this->_os2ip($em); - $s = $this->_rsasp1($m); - $s = $this->_i2osp($s, $this->k); - - // Output the signature S - - return $s; - } - - /** - * RSASSA-PSS-VERIFY - * - * See {@link http://tools.ietf.org/html/rfc3447#section-8.1.2 RFC3447#section-8.1.2}. - * - * @access private - * @param String $m - * @param String $s - * @return String - */ - function _rsassa_pss_verify($m, $s) - { - // Length checking - - if (strlen($s) != $this->k) { - user_error('Invalid signature', E_USER_NOTICE); - return false; - } - - // RSA verification - - $modBits = 8 * $this->k; - - $s2 = $this->_os2ip($s); - $m2 = $this->_rsavp1($s2); - if ($m2 === false) { - user_error('Invalid signature', E_USER_NOTICE); - return false; - } - $em = $this->_i2osp($m2, $modBits >> 3); - if ($em === false) { - user_error('Invalid signature', E_USER_NOTICE); - return false; - } - - // EMSA-PSS verification - - return $this->_emsa_pss_verify($m, $em, $modBits - 1); - } - - /** - * EMSA-PKCS1-V1_5-ENCODE - * - * See {@link http://tools.ietf.org/html/rfc3447#section-9.2 RFC3447#section-9.2}. - * - * @access private - * @param String $m - * @param Integer $emLen - * @return String - */ - function _emsa_pkcs1_v1_5_encode($m, $emLen) - { - $h = $this->hash->hash($m); - if ($h === false) { - return false; - } - - // see http://tools.ietf.org/html/rfc3447#page-43 - switch ($this->hashName) { - case 'md2': - $t = pack('H*', '3020300c06082a864886f70d020205000410'); - break; - case 'md5': - $t = pack('H*', '3020300c06082a864886f70d020505000410'); - break; - case 'sha1': - $t = pack('H*', '3021300906052b0e03021a05000414'); - break; - case 'sha256': - $t = pack('H*', '3031300d060960864801650304020105000420'); - break; - case 'sha384': - $t = pack('H*', '3041300d060960864801650304020205000430'); - break; - case 'sha512': - $t = pack('H*', '3051300d060960864801650304020305000440'); - } - $t.= $h; - $tLen = strlen($t); - - if ($emLen < $tLen + 11) { - user_error('Intended encoded message length too short', E_USER_NOTICE); - return false; - } - - $ps = str_repeat(chr(0xFF), $emLen - $tLen - 3); - - $em = "\0\1$ps\0$t"; - - return $em; - } - - /** - * RSASSA-PKCS1-V1_5-SIGN - * - * See {@link http://tools.ietf.org/html/rfc3447#section-8.2.1 RFC3447#section-8.2.1}. - * - * @access private - * @param String $m - * @return String - */ - function _rsassa_pkcs1_v1_5_sign($m) - { - // EMSA-PKCS1-v1_5 encoding - - $em = $this->_emsa_pkcs1_v1_5_encode($m, $this->k); - if ($em === false) { - user_error('RSA modulus too short', E_USER_NOTICE); - return false; - } - - // RSA signature - - $m = $this->_os2ip($em); - $s = $this->_rsasp1($m); - $s = $this->_i2osp($s, $this->k); - - // Output the signature S - - return $s; - } - - /** - * RSASSA-PKCS1-V1_5-VERIFY - * - * See {@link http://tools.ietf.org/html/rfc3447#section-8.2.2 RFC3447#section-8.2.2}. - * - * @access private - * @param String $m - * @return String - */ - function _rsassa_pkcs1_v1_5_verify($m, $s) - { - // Length checking - - if (strlen($s) != $this->k) { - user_error('Invalid signature', E_USER_NOTICE); - return false; - } - - // RSA verification - - $s = $this->_os2ip($s); - $m2 = $this->_rsavp1($s); - if ($m2 === false) { - user_error('Invalid signature', E_USER_NOTICE); - return false; - } - $em = $this->_i2osp($m2, $this->k); - if ($em === false) { - user_error('Invalid signature', E_USER_NOTICE); - return false; - } - - // EMSA-PKCS1-v1_5 encoding - - $em2 = $this->_emsa_pkcs1_v1_5_encode($m, $this->k); - if ($em2 === false) { - user_error('RSA modulus too short', E_USER_NOTICE); - return false; - } - - // Compare - - return $em === $em2; - } - - /** - * Set Encryption Mode - * - * Valid values include CRYPT_RSA_ENCRYPTION_OAEP and CRYPT_RSA_ENCRYPTION_PKCS1. - * - * @access public - * @param Integer $mode - */ - function setEncryptionMode($mode) - { - $this->encryptionMode = $mode; - } - - /** - * Set Signature Mode - * - * Valid values include CRYPT_RSA_SIGNATURE_PSS and CRYPT_RSA_SIGNATURE_PKCS1 - * - * @access public - * @param Integer $mode - */ - function setSignatureMode($mode) - { - $this->signatureMode = $mode; - } - - /** - * Encryption - * - * Both CRYPT_RSA_ENCRYPTION_OAEP and CRYPT_RSA_ENCRYPTION_PKCS1 both place limits on how long $plaintext can be. - * If $plaintext exceeds those limits it will be broken up so that it does and the resultant ciphertext's will - * be concatenated together. - * - * @see decrypt() - * @access public - * @param String $plaintext - * @return String - */ - function encrypt($plaintext) - { - switch ($this->encryptionMode) { - case CRYPT_RSA_ENCRYPTION_PKCS1: - $length = $this->k - 11; - if ($length <= 0) { - return false; - } - - $plaintext = str_split($plaintext, $length); - $ciphertext = ''; - foreach ($plaintext as $m) { - $ciphertext.= $this->_rsaes_pkcs1_v1_5_encrypt($m); - } - return $ciphertext; - //case CRYPT_RSA_ENCRYPTION_OAEP: - default: - $length = $this->k - 2 * $this->hLen - 2; - if ($length <= 0) { - return false; - } - - $plaintext = str_split($plaintext, $length); - $ciphertext = ''; - foreach ($plaintext as $m) { - $ciphertext.= $this->_rsaes_oaep_encrypt($m); - } - return $ciphertext; - } - } - - /** - * Decryption - * - * @see encrypt() - * @access public - * @param String $plaintext - * @return String - */ - function decrypt($ciphertext) - { - if ($this->k <= 0) { - return false; - } - - $ciphertext = str_split($ciphertext, $this->k); - $plaintext = ''; - - switch ($this->encryptionMode) { - case CRYPT_RSA_ENCRYPTION_PKCS1: - $decrypt = '_rsaes_pkcs1_v1_5_decrypt'; - break; - //case CRYPT_RSA_ENCRYPTION_OAEP: - default: - $decrypt = '_rsaes_oaep_decrypt'; - } - - foreach ($ciphertext as $c) { - $temp = $this->$decrypt($c); - if ($temp === false) { - return false; - } - $plaintext.= $temp; - } - - return $plaintext; - } - - /** - * Create a signature - * - * @see verify() - * @access public - * @param String $message - * @return String - */ - function sign($message) - { - if (empty($this->modulus) || empty($this->exponent)) { - return false; - } - - switch ($this->signatureMode) { - case CRYPT_RSA_SIGNATURE_PKCS1: - return $this->_rsassa_pkcs1_v1_5_sign($message); - //case CRYPT_RSA_SIGNATURE_PSS: - default: - return $this->_rsassa_pss_sign($message); - } - } - - /** - * Verifies a signature - * - * @see sign() - * @access public - * @param String $message - * @param String $signature - * @return Boolean - */ - function verify($message, $signature) - { - if (empty($this->modulus) || empty($this->exponent)) { - return false; - } - - switch ($this->signatureMode) { - case CRYPT_RSA_SIGNATURE_PKCS1: - return $this->_rsassa_pkcs1_v1_5_verify($message, $signature); - //case CRYPT_RSA_SIGNATURE_PSS: - default: - return $this->_rsassa_pss_verify($message, $signature); - } - } -} diff --git a/lib/internal/phpseclib/Crypt/Random.php b/lib/internal/phpseclib/Crypt/Random.php deleted file mode 100644 index e8902d9fbf5..00000000000 --- a/lib/internal/phpseclib/Crypt/Random.php +++ /dev/null @@ -1,129 +0,0 @@ -<?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * Random Number Generator - * - * PHP versions 4 and 5 - * - * Here's a short example of how to use this library: - * <code> - * <?php - * include('Crypt/Random.php'); - * - * echo crypt_random(); - * ?> - * </code> - * - * LICENSE: This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - * @category Crypt - * @package Crypt_Random - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMVII Jim Wigginton - * @license http://www.gnu.org/licenses/lgpl.txt - * @version $Id: Random.php,v 1.9 2010/04/24 06:40:48 terrafrost Exp $ - * @link http://phpseclib.sourceforge.net - */ - -/** - * Generate a random value. - * - * On 32-bit machines, the largest distance that can exist between $min and $max is 2**31. - * If $min and $max are farther apart than that then the last ($max - range) numbers. - * - * Depending on how this is being used, it may be worth while to write a replacement. For example, - * a PHP-based web app that stores its data in an SQL database can collect more entropy than this function - * can. - * - * @param optional Integer $min - * @param optional Integer $max - * @return Integer - * @access public - */ -function crypt_random($min = 0, $max = 0x7FFFFFFF) -{ - if ($min == $max) { - return $min; - } - - // see http://en.wikipedia.org/wiki//dev/random - // if open_basedir is enabled file_exists() will ouput an "open_basedir restriction in effect" warning, - // so we suppress it. - if (@file_exists('/dev/urandom')) { - static $fp; - if (!$fp) { - $fp = fopen('/dev/urandom', 'rb'); - } - extract(unpack('Nrandom', fread($fp, 4))); - - // say $min = 0 and $max = 3. if we didn't do abs() then we could have stuff like this: - // -4 % 3 + 0 = -1, even though -1 < $min - return abs($random) % ($max - $min) + $min; - } - - /* Prior to PHP 4.2.0, mt_srand() had to be called before mt_rand() could be called. - Prior to PHP 5.2.6, mt_rand()'s automatic seeding was subpar, as elaborated here: - - http://www.suspekt.org/2008/08/17/mt_srand-and-not-so-random-numbers/ - - The seeding routine is pretty much ripped from PHP's own internal GENERATE_SEED() macro: - - http://svn.php.net/viewvc/php/php-src/branches/PHP_5_3_2/ext/standard/php_rand.h?view=markup */ - if (version_compare(PHP_VERSION, '5.2.5', '<=')) { - static $seeded; - if (!isset($seeded)) { - $seeded = true; - mt_srand(fmod(time() * getmypid(), 0x7FFFFFFF) ^ fmod(1000000 * lcg_value(), 0x7FFFFFFF)); - } - } - - static $crypto; - - // The CSPRNG's Yarrow and Fortuna periodically reseed. This function can be reseeded by hitting F5 - // in the browser and reloading the page. - - if (!isset($crypto)) { - $key = $iv = ''; - for ($i = 0; $i < 8; $i++) { - $key.= pack('n', mt_rand(0, 0xFFFF)); - $iv .= pack('n', mt_rand(0, 0xFFFF)); - } - switch (true) { - case class_exists('Crypt_AES'): - $crypto = new Crypt_AES(CRYPT_AES_MODE_CTR); - break; - case class_exists('Crypt_TripleDES'): - $crypto = new Crypt_TripleDES(CRYPT_DES_MODE_CTR); - break; - case class_exists('Crypt_DES'): - $crypto = new Crypt_DES(CRYPT_DES_MODE_CTR); - break; - case class_exists('Crypt_RC4'): - $crypto = new Crypt_RC4(); - break; - default: - extract(unpack('Nrandom', pack('H*', sha1(mt_rand(0, 0x7FFFFFFF))))); - return abs($random) % ($max - $min) + $min; - } - $crypto->setKey($key); - $crypto->setIV($iv); - $crypto->enableContinuousBuffer(); - } - - extract(unpack('Nrandom', $crypto->encrypt("\0\0\0\0"))); - return abs($random) % ($max - $min) + $min; -} diff --git a/lib/internal/phpseclib/Crypt/Rijndael.php b/lib/internal/phpseclib/Crypt/Rijndael.php deleted file mode 100644 index 922fd12ee75..00000000000 --- a/lib/internal/phpseclib/Crypt/Rijndael.php +++ /dev/null @@ -1,1242 +0,0 @@ -<?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * Pure-PHP implementation of Rijndael. - * - * Does not use mcrypt, even when available, for reasons that are explained below. - * - * PHP versions 4 and 5 - * - * If {@link Crypt_Rijndael::setBlockLength() setBlockLength()} isn't called, it'll be assumed to be 128 bits. If - * {@link Crypt_Rijndael::setKeyLength() setKeyLength()} isn't called, it'll be calculated from - * {@link Crypt_Rijndael::setKey() setKey()}. ie. if the key is 128-bits, the key length will be 128-bits. If it's - * 136-bits it'll be null-padded to 160-bits and 160 bits will be the key length until - * {@link Crypt_Rijndael::setKey() setKey()} is called, again, at which point, it'll be recalculated. - * - * Not all Rijndael implementations may support 160-bits or 224-bits as the block length / key length. mcrypt, for example, - * does not. AES, itself, only supports block lengths of 128 and key lengths of 128, 192, and 256. - * {@link http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=10 Rijndael-ammended.pdf#page=10} defines the - * algorithm for block lengths of 192 and 256 but not for block lengths / key lengths of 160 and 224. Indeed, 160 and 224 - * are first defined as valid key / block lengths in - * {@link http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=44 Rijndael-ammended.pdf#page=44}: - * Extensions: Other block and Cipher Key lengths. - * - * {@internal The variable names are the same as those in - * {@link http://www.csrc.nist.gov/publications/fips/fips197/fips-197.pdf#page=10 fips-197.pdf#page=10}.}} - * - * Here's a short example of how to use this library: - * <code> - * <?php - * include('Crypt/Rijndael.php'); - * - * $rijndael = new Crypt_Rijndael(); - * - * $rijndael->setKey('abcdefghijklmnop'); - * - * $size = 10 * 1024; - * $plaintext = ''; - * for ($i = 0; $i < $size; $i++) { - * $plaintext.= 'a'; - * } - * - * echo $rijndael->decrypt($rijndael->encrypt($plaintext)); - * ?> - * </code> - * - * LICENSE: This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - * @category Crypt - * @package Crypt_Rijndael - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMVIII Jim Wigginton - * @license http://www.gnu.org/licenses/lgpl.txt - * @version $Id: Rijndael.php,v 1.12 2010/02/09 06:10:26 terrafrost Exp $ - * @link http://phpseclib.sourceforge.net - */ - -/**#@+ - * @access public - * @see Crypt_Rijndael::encrypt() - * @see Crypt_Rijndael::decrypt() - */ -/** - * Encrypt / decrypt using the Counter mode. - * - * Set to -1 since that's what Crypt/Random.php uses to index the CTR mode. - * - * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29 - */ -define('CRYPT_RIJNDAEL_MODE_CTR', -1); -/** - * Encrypt / decrypt using the Electronic Code Book mode. - * - * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29 - */ -define('CRYPT_RIJNDAEL_MODE_ECB', 1); -/** - * Encrypt / decrypt using the Code Book Chaining mode. - * - * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29 - */ -define('CRYPT_RIJNDAEL_MODE_CBC', 2); -/**#@-*/ - -/**#@+ - * @access private - * @see Crypt_Rijndael::Crypt_Rijndael() - */ -/** - * Toggles the internal implementation - */ -define('CRYPT_RIJNDAEL_MODE_INTERNAL', 1); -/** - * Toggles the mcrypt implementation - */ -define('CRYPT_RIJNDAEL_MODE_MCRYPT', 2); -/**#@-*/ - -/** - * Pure-PHP implementation of Rijndael. - * - * @author Jim Wigginton <terrafrost@php.net> - * @version 0.1.0 - * @access public - * @package Crypt_Rijndael - */ -class Crypt_Rijndael { - /** - * The Encryption Mode - * - * @see Crypt_Rijndael::Crypt_Rijndael() - * @var Integer - * @access private - */ - var $mode; - - /** - * The Key - * - * @see Crypt_Rijndael::setKey() - * @var String - * @access private - */ - var $key = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; - - /** - * The Initialization Vector - * - * @see Crypt_Rijndael::setIV() - * @var String - * @access private - */ - var $iv = ''; - - /** - * A "sliding" Initialization Vector - * - * @see Crypt_Rijndael::enableContinuousBuffer() - * @var String - * @access private - */ - var $encryptIV = ''; - - /** - * A "sliding" Initialization Vector - * - * @see Crypt_Rijndael::enableContinuousBuffer() - * @var String - * @access private - */ - var $decryptIV = ''; - - /** - * Continuous Buffer status - * - * @see Crypt_Rijndael::enableContinuousBuffer() - * @var Boolean - * @access private - */ - var $continuousBuffer = false; - - /** - * Padding status - * - * @see Crypt_Rijndael::enablePadding() - * @var Boolean - * @access private - */ - var $padding = true; - - /** - * Does the key schedule need to be (re)calculated? - * - * @see setKey() - * @see setBlockLength() - * @see setKeyLength() - * @var Boolean - * @access private - */ - var $changed = true; - - /** - * Has the key length explicitly been set or should it be derived from the key, itself? - * - * @see setKeyLength() - * @var Boolean - * @access private - */ - var $explicit_key_length = false; - - /** - * The Key Schedule - * - * @see _setup() - * @var Array - * @access private - */ - var $w; - - /** - * The Inverse Key Schedule - * - * @see _setup() - * @var Array - * @access private - */ - var $dw; - - /** - * The Block Length - * - * @see setBlockLength() - * @var Integer - * @access private - * @internal The max value is 32, the min value is 16. All valid values are multiples of 4. Exists in conjunction with - * $Nb because we need this value and not $Nb to pad strings appropriately. - */ - var $block_size = 16; - - /** - * The Block Length divided by 32 - * - * @see setBlockLength() - * @var Integer - * @access private - * @internal The max value is 256 / 32 = 8, the min value is 128 / 32 = 4. Exists in conjunction with $block_size - * because the encryption / decryption / key schedule creation requires this number and not $block_size. We could - * derive this from $block_size or vice versa, but that'd mean we'd have to do multiple shift operations, so in lieu - * of that, we'll just precompute it once. - * - */ - var $Nb = 4; - - /** - * The Key Length - * - * @see setKeyLength() - * @var Integer - * @access private - * @internal The max value is 256 / 8 = 32, the min value is 128 / 8 = 16. Exists in conjunction with $key_size - * because the encryption / decryption / key schedule creation requires this number and not $key_size. We could - * derive this from $key_size or vice versa, but that'd mean we'd have to do multiple shift operations, so in lieu - * of that, we'll just precompute it once. - */ - var $key_size = 16; - - /** - * The Key Length divided by 32 - * - * @see setKeyLength() - * @var Integer - * @access private - * @internal The max value is 256 / 32 = 8, the min value is 128 / 32 = 4 - */ - var $Nk = 4; - - /** - * The Number of Rounds - * - * @var Integer - * @access private - * @internal The max value is 14, the min value is 10. - */ - var $Nr; - - /** - * Shift offsets - * - * @var Array - * @access private - */ - var $c; - - /** - * Precomputed mixColumns table - * - * @see Crypt_Rijndael() - * @var Array - * @access private - */ - var $t0; - - /** - * Precomputed mixColumns table - * - * @see Crypt_Rijndael() - * @var Array - * @access private - */ - var $t1; - - /** - * Precomputed mixColumns table - * - * @see Crypt_Rijndael() - * @var Array - * @access private - */ - var $t2; - - /** - * Precomputed mixColumns table - * - * @see Crypt_Rijndael() - * @var Array - * @access private - */ - var $t3; - - /** - * Precomputed invMixColumns table - * - * @see Crypt_Rijndael() - * @var Array - * @access private - */ - var $dt0; - - /** - * Precomputed invMixColumns table - * - * @see Crypt_Rijndael() - * @var Array - * @access private - */ - var $dt1; - - /** - * Precomputed invMixColumns table - * - * @see Crypt_Rijndael() - * @var Array - * @access private - */ - var $dt2; - - /** - * Precomputed invMixColumns table - * - * @see Crypt_Rijndael() - * @var Array - * @access private - */ - var $dt3; - - /** - * Default Constructor. - * - * Determines whether or not the mcrypt extension should be used. $mode should only, at present, be - * CRYPT_RIJNDAEL_MODE_ECB or CRYPT_RIJNDAEL_MODE_CBC. If not explictly set, CRYPT_RIJNDAEL_MODE_CBC will be used. - * - * @param optional Integer $mode - * @return Crypt_Rijndael - * @access public - */ - function Crypt_Rijndael($mode = CRYPT_RIJNDAEL_MODE_CBC) - { - switch ($mode) { - case CRYPT_RIJNDAEL_MODE_ECB: - case CRYPT_RIJNDAEL_MODE_CBC: - case CRYPT_RIJNDAEL_MODE_CTR: - $this->mode = $mode; - break; - default: - $this->mode = CRYPT_RIJNDAEL_MODE_CBC; - } - - $t3 = &$this->t3; - $t2 = &$this->t2; - $t1 = &$this->t1; - $t0 = &$this->t0; - - $dt3 = &$this->dt3; - $dt2 = &$this->dt2; - $dt1 = &$this->dt1; - $dt0 = &$this->dt0; - - // according to <http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=19> (section 5.2.1), - // precomputed tables can be used in the mixColumns phase. in that example, they're assigned t0...t3, so - // those are the names we'll use. - $t3 = array( - 0x6363A5C6, 0x7C7C84F8, 0x777799EE, 0x7B7B8DF6, 0xF2F20DFF, 0x6B6BBDD6, 0x6F6FB1DE, 0xC5C55491, - 0x30305060, 0x01010302, 0x6767A9CE, 0x2B2B7D56, 0xFEFE19E7, 0xD7D762B5, 0xABABE64D, 0x76769AEC, - 0xCACA458F, 0x82829D1F, 0xC9C94089, 0x7D7D87FA, 0xFAFA15EF, 0x5959EBB2, 0x4747C98E, 0xF0F00BFB, - 0xADADEC41, 0xD4D467B3, 0xA2A2FD5F, 0xAFAFEA45, 0x9C9CBF23, 0xA4A4F753, 0x727296E4, 0xC0C05B9B, - 0xB7B7C275, 0xFDFD1CE1, 0x9393AE3D, 0x26266A4C, 0x36365A6C, 0x3F3F417E, 0xF7F702F5, 0xCCCC4F83, - 0x34345C68, 0xA5A5F451, 0xE5E534D1, 0xF1F108F9, 0x717193E2, 0xD8D873AB, 0x31315362, 0x15153F2A, - 0x04040C08, 0xC7C75295, 0x23236546, 0xC3C35E9D, 0x18182830, 0x9696A137, 0x05050F0A, 0x9A9AB52F, - 0x0707090E, 0x12123624, 0x80809B1B, 0xE2E23DDF, 0xEBEB26CD, 0x2727694E, 0xB2B2CD7F, 0x75759FEA, - 0x09091B12, 0x83839E1D, 0x2C2C7458, 0x1A1A2E34, 0x1B1B2D36, 0x6E6EB2DC, 0x5A5AEEB4, 0xA0A0FB5B, - 0x5252F6A4, 0x3B3B4D76, 0xD6D661B7, 0xB3B3CE7D, 0x29297B52, 0xE3E33EDD, 0x2F2F715E, 0x84849713, - 0x5353F5A6, 0xD1D168B9, 0x00000000, 0xEDED2CC1, 0x20206040, 0xFCFC1FE3, 0xB1B1C879, 0x5B5BEDB6, - 0x6A6ABED4, 0xCBCB468D, 0xBEBED967, 0x39394B72, 0x4A4ADE94, 0x4C4CD498, 0x5858E8B0, 0xCFCF4A85, - 0xD0D06BBB, 0xEFEF2AC5, 0xAAAAE54F, 0xFBFB16ED, 0x4343C586, 0x4D4DD79A, 0x33335566, 0x85859411, - 0x4545CF8A, 0xF9F910E9, 0x02020604, 0x7F7F81FE, 0x5050F0A0, 0x3C3C4478, 0x9F9FBA25, 0xA8A8E34B, - 0x5151F3A2, 0xA3A3FE5D, 0x4040C080, 0x8F8F8A05, 0x9292AD3F, 0x9D9DBC21, 0x38384870, 0xF5F504F1, - 0xBCBCDF63, 0xB6B6C177, 0xDADA75AF, 0x21216342, 0x10103020, 0xFFFF1AE5, 0xF3F30EFD, 0xD2D26DBF, - 0xCDCD4C81, 0x0C0C1418, 0x13133526, 0xECEC2FC3, 0x5F5FE1BE, 0x9797A235, 0x4444CC88, 0x1717392E, - 0xC4C45793, 0xA7A7F255, 0x7E7E82FC, 0x3D3D477A, 0x6464ACC8, 0x5D5DE7BA, 0x19192B32, 0x737395E6, - 0x6060A0C0, 0x81819819, 0x4F4FD19E, 0xDCDC7FA3, 0x22226644, 0x2A2A7E54, 0x9090AB3B, 0x8888830B, - 0x4646CA8C, 0xEEEE29C7, 0xB8B8D36B, 0x14143C28, 0xDEDE79A7, 0x5E5EE2BC, 0x0B0B1D16, 0xDBDB76AD, - 0xE0E03BDB, 0x32325664, 0x3A3A4E74, 0x0A0A1E14, 0x4949DB92, 0x06060A0C, 0x24246C48, 0x5C5CE4B8, - 0xC2C25D9F, 0xD3D36EBD, 0xACACEF43, 0x6262A6C4, 0x9191A839, 0x9595A431, 0xE4E437D3, 0x79798BF2, - 0xE7E732D5, 0xC8C8438B, 0x3737596E, 0x6D6DB7DA, 0x8D8D8C01, 0xD5D564B1, 0x4E4ED29C, 0xA9A9E049, - 0x6C6CB4D8, 0x5656FAAC, 0xF4F407F3, 0xEAEA25CF, 0x6565AFCA, 0x7A7A8EF4, 0xAEAEE947, 0x08081810, - 0xBABAD56F, 0x787888F0, 0x25256F4A, 0x2E2E725C, 0x1C1C2438, 0xA6A6F157, 0xB4B4C773, 0xC6C65197, - 0xE8E823CB, 0xDDDD7CA1, 0x74749CE8, 0x1F1F213E, 0x4B4BDD96, 0xBDBDDC61, 0x8B8B860D, 0x8A8A850F, - 0x707090E0, 0x3E3E427C, 0xB5B5C471, 0x6666AACC, 0x4848D890, 0x03030506, 0xF6F601F7, 0x0E0E121C, - 0x6161A3C2, 0x35355F6A, 0x5757F9AE, 0xB9B9D069, 0x86869117, 0xC1C15899, 0x1D1D273A, 0x9E9EB927, - 0xE1E138D9, 0xF8F813EB, 0x9898B32B, 0x11113322, 0x6969BBD2, 0xD9D970A9, 0x8E8E8907, 0x9494A733, - 0x9B9BB62D, 0x1E1E223C, 0x87879215, 0xE9E920C9, 0xCECE4987, 0x5555FFAA, 0x28287850, 0xDFDF7AA5, - 0x8C8C8F03, 0xA1A1F859, 0x89898009, 0x0D0D171A, 0xBFBFDA65, 0xE6E631D7, 0x4242C684, 0x6868B8D0, - 0x4141C382, 0x9999B029, 0x2D2D775A, 0x0F0F111E, 0xB0B0CB7B, 0x5454FCA8, 0xBBBBD66D, 0x16163A2C - ); - - $dt3 = array( - 0xF4A75051, 0x4165537E, 0x17A4C31A, 0x275E963A, 0xAB6BCB3B, 0x9D45F11F, 0xFA58ABAC, 0xE303934B, - 0x30FA5520, 0x766DF6AD, 0xCC769188, 0x024C25F5, 0xE5D7FC4F, 0x2ACBD7C5, 0x35448026, 0x62A38FB5, - 0xB15A49DE, 0xBA1B6725, 0xEA0E9845, 0xFEC0E15D, 0x2F7502C3, 0x4CF01281, 0x4697A38D, 0xD3F9C66B, - 0x8F5FE703, 0x929C9515, 0x6D7AEBBF, 0x5259DA95, 0xBE832DD4, 0x7421D358, 0xE0692949, 0xC9C8448E, - 0xC2896A75, 0x8E7978F4, 0x583E6B99, 0xB971DD27, 0xE14FB6BE, 0x88AD17F0, 0x20AC66C9, 0xCE3AB47D, - 0xDF4A1863, 0x1A3182E5, 0x51336097, 0x537F4562, 0x6477E0B1, 0x6BAE84BB, 0x81A01CFE, 0x082B94F9, - 0x48685870, 0x45FD198F, 0xDE6C8794, 0x7BF8B752, 0x73D323AB, 0x4B02E272, 0x1F8F57E3, 0x55AB2A66, - 0xEB2807B2, 0xB5C2032F, 0xC57B9A86, 0x3708A5D3, 0x2887F230, 0xBFA5B223, 0x036ABA02, 0x16825CED, - 0xCF1C2B8A, 0x79B492A7, 0x07F2F0F3, 0x69E2A14E, 0xDAF4CD65, 0x05BED506, 0x34621FD1, 0xA6FE8AC4, - 0x2E539D34, 0xF355A0A2, 0x8AE13205, 0xF6EB75A4, 0x83EC390B, 0x60EFAA40, 0x719F065E, 0x6E1051BD, - 0x218AF93E, 0xDD063D96, 0x3E05AEDD, 0xE6BD464D, 0x548DB591, 0xC45D0571, 0x06D46F04, 0x5015FF60, - 0x98FB2419, 0xBDE997D6, 0x4043CC89, 0xD99E7767, 0xE842BDB0, 0x898B8807, 0x195B38E7, 0xC8EEDB79, - 0x7C0A47A1, 0x420FE97C, 0x841EC9F8, 0x00000000, 0x80868309, 0x2BED4832, 0x1170AC1E, 0x5A724E6C, - 0x0EFFFBFD, 0x8538560F, 0xAED51E3D, 0x2D392736, 0x0FD9640A, 0x5CA62168, 0x5B54D19B, 0x362E3A24, - 0x0A67B10C, 0x57E70F93, 0xEE96D2B4, 0x9B919E1B, 0xC0C54F80, 0xDC20A261, 0x774B695A, 0x121A161C, - 0x93BA0AE2, 0xA02AE5C0, 0x22E0433C, 0x1B171D12, 0x090D0B0E, 0x8BC7ADF2, 0xB6A8B92D, 0x1EA9C814, - 0xF1198557, 0x75074CAF, 0x99DDBBEE, 0x7F60FDA3, 0x01269FF7, 0x72F5BC5C, 0x663BC544, 0xFB7E345B, - 0x4329768B, 0x23C6DCCB, 0xEDFC68B6, 0xE4F163B8, 0x31DCCAD7, 0x63851042, 0x97224013, 0xC6112084, - 0x4A247D85, 0xBB3DF8D2, 0xF93211AE, 0x29A16DC7, 0x9E2F4B1D, 0xB230F3DC, 0x8652EC0D, 0xC1E3D077, - 0xB3166C2B, 0x70B999A9, 0x9448FA11, 0xE9642247, 0xFC8CC4A8, 0xF03F1AA0, 0x7D2CD856, 0x3390EF22, - 0x494EC787, 0x38D1C1D9, 0xCAA2FE8C, 0xD40B3698, 0xF581CFA6, 0x7ADE28A5, 0xB78E26DA, 0xADBFA43F, - 0x3A9DE42C, 0x78920D50, 0x5FCC9B6A, 0x7E466254, 0x8D13C2F6, 0xD8B8E890, 0x39F75E2E, 0xC3AFF582, - 0x5D80BE9F, 0xD0937C69, 0xD52DA96F, 0x2512B3CF, 0xAC993BC8, 0x187DA710, 0x9C636EE8, 0x3BBB7BDB, - 0x267809CD, 0x5918F46E, 0x9AB701EC, 0x4F9AA883, 0x956E65E6, 0xFFE67EAA, 0xBCCF0821, 0x15E8E6EF, - 0xE79BD9BA, 0x6F36CE4A, 0x9F09D4EA, 0xB07CD629, 0xA4B2AF31, 0x3F23312A, 0xA59430C6, 0xA266C035, - 0x4EBC3774, 0x82CAA6FC, 0x90D0B0E0, 0xA7D81533, 0x04984AF1, 0xECDAF741, 0xCD500E7F, 0x91F62F17, - 0x4DD68D76, 0xEFB04D43, 0xAA4D54CC, 0x9604DFE4, 0xD1B5E39E, 0x6A881B4C, 0x2C1FB8C1, 0x65517F46, - 0x5EEA049D, 0x8C355D01, 0x877473FA, 0x0B412EFB, 0x671D5AB3, 0xDBD25292, 0x105633E9, 0xD647136D, - 0xD7618C9A, 0xA10C7A37, 0xF8148E59, 0x133C89EB, 0xA927EECE, 0x61C935B7, 0x1CE5EDE1, 0x47B13C7A, - 0xD2DF599C, 0xF2733F55, 0x14CE7918, 0xC737BF73, 0xF7CDEA53, 0xFDAA5B5F, 0x3D6F14DF, 0x44DB8678, - 0xAFF381CA, 0x68C43EB9, 0x24342C38, 0xA3405FC2, 0x1DC37216, 0xE2250CBC, 0x3C498B28, 0x0D9541FF, - 0xA8017139, 0x0CB3DE08, 0xB4E49CD8, 0x56C19064, 0xCB84617B, 0x32B670D5, 0x6C5C7448, 0xB85742D0 - ); - - for ($i = 0; $i < 256; $i++) { - $t2[$i << 8] = (($t3[$i] << 8) & 0xFFFFFF00) | (($t3[$i] >> 24) & 0x000000FF); - $t1[$i << 16] = (($t3[$i] << 16) & 0xFFFF0000) | (($t3[$i] >> 16) & 0x0000FFFF); - $t0[$i << 24] = (($t3[$i] << 24) & 0xFF000000) | (($t3[$i] >> 8) & 0x00FFFFFF); - - $dt2[$i << 8] = (($this->dt3[$i] << 8) & 0xFFFFFF00) | (($dt3[$i] >> 24) & 0x000000FF); - $dt1[$i << 16] = (($this->dt3[$i] << 16) & 0xFFFF0000) | (($dt3[$i] >> 16) & 0x0000FFFF); - $dt0[$i << 24] = (($this->dt3[$i] << 24) & 0xFF000000) | (($dt3[$i] >> 8) & 0x00FFFFFF); - } - } - - /** - * Sets the key. - * - * Keys can be of any length. Rijndael, itself, requires the use of a key that's between 128-bits and 256-bits long and - * whose length is a multiple of 32. If the key is less than 256-bits and the key length isn't set, we round the length - * up to the closest valid key length, padding $key with null bytes. If the key is more than 256-bits, we trim the - * excess bits. - * - * If the key is not explicitly set, it'll be assumed to be all null bytes. - * - * @access public - * @param String $key - */ - function setKey($key) - { - $this->key = $key; - $this->changed = true; - } - - /** - * Sets the initialization vector. (optional) - * - * SetIV is not required when CRYPT_RIJNDAEL_MODE_ECB is being used. If not explictly set, it'll be assumed - * to be all zero's. - * - * @access public - * @param String $iv - */ - function setIV($iv) - { - $this->encryptIV = $this->decryptIV = $this->iv = str_pad(substr($iv, 0, $this->block_size), $this->block_size, chr(0));; - } - - /** - * Sets the key length - * - * Valid key lengths are 128, 160, 192, 224, and 256. If the length is less than 128, it will be rounded up to - * 128. If the length is greater then 128 and invalid, it will be rounded down to the closest valid amount. - * - * @access public - * @param Integer $length - */ - function setKeyLength($length) - { - $length >>= 5; - if ($length > 8) { - $length = 8; - } else if ($length < 4) { - $length = 4; - } - $this->Nk = $length; - $this->key_size = $length << 2; - - $this->explicit_key_length = true; - $this->changed = true; - } - - /** - * Sets the block length - * - * Valid block lengths are 128, 160, 192, 224, and 256. If the length is less than 128, it will be rounded up to - * 128. If the length is greater then 128 and invalid, it will be rounded down to the closest valid amount. - * - * @access public - * @param Integer $length - */ - function setBlockLength($length) - { - $length >>= 5; - if ($length > 8) { - $length = 8; - } else if ($length < 4) { - $length = 4; - } - $this->Nb = $length; - $this->block_size = $length << 2; - $this->changed = true; - } - - /** - * Generate CTR XOR encryption key - * - * Encrypt the output of this and XOR it against the ciphertext / plaintext to get the - * plaintext / ciphertext in CTR mode. - * - * @see Crypt_Rijndael::decrypt() - * @see Crypt_Rijndael::encrypt() - * @access public - * @param Integer $length - * @param String $iv - */ - function _generate_xor($length, &$iv) - { - $xor = ''; - $block_size = $this->block_size; - $num_blocks = floor(($length + ($block_size - 1)) / $block_size); - for ($i = 0; $i < $num_blocks; $i++) { - $xor.= $iv; - for ($j = 4; $j <= $block_size; $j+=4) { - $temp = substr($iv, -$j, 4); - switch ($temp) { - case "\xFF\xFF\xFF\xFF": - $iv = substr_replace($iv, "\x00\x00\x00\x00", -$j, 4); - break; - case "\x7F\xFF\xFF\xFF": - $iv = substr_replace($iv, "\x80\x00\x00\x00", -$j, 4); - break 2; - default: - extract(unpack('Ncount', $temp)); - $iv = substr_replace($iv, pack('N', $count + 1), -$j, 4); - break 2; - } - } - } - - return $xor; - } - - /** - * Encrypts a message. - * - * $plaintext will be padded with additional bytes such that it's length is a multiple of the block size. Other Rjindael - * implementations may or may not pad in the same manner. Other common approaches to padding and the reasons why it's - * necessary are discussed in the following - * URL: - * - * {@link http://www.di-mgt.com.au/cryptopad.html http://www.di-mgt.com.au/cryptopad.html} - * - * An alternative to padding is to, separately, send the length of the file. This is what SSH, in fact, does. - * strlen($plaintext) will still need to be a multiple of 8, however, arbitrary values can be added to make it that - * length. - * - * @see Crypt_Rijndael::decrypt() - * @access public - * @param String $plaintext - */ - function encrypt($plaintext) - { - $this->_setup(); - if ($this->mode != CRYPT_RIJNDAEL_MODE_CTR) { - $plaintext = $this->_pad($plaintext); - } - - $block_size = $this->block_size; - $ciphertext = ''; - switch ($this->mode) { - case CRYPT_RIJNDAEL_MODE_ECB: - for ($i = 0; $i < strlen($plaintext); $i+=$block_size) { - $ciphertext.= $this->_encryptBlock(substr($plaintext, $i, $block_size)); - } - break; - case CRYPT_RIJNDAEL_MODE_CBC: - $xor = $this->encryptIV; - for ($i = 0; $i < strlen($plaintext); $i+=$block_size) { - $block = substr($plaintext, $i, $block_size); - $block = $this->_encryptBlock($block ^ $xor); - $xor = $block; - $ciphertext.= $block; - } - if ($this->continuousBuffer) { - $this->encryptIV = $xor; - } - break; - case CRYPT_RIJNDAEL_MODE_CTR: - $xor = $this->encryptIV; - for ($i = 0; $i < strlen($plaintext); $i+=$block_size) { - $block = substr($plaintext, $i, $block_size); - $key = $this->_encryptBlock($this->_generate_xor($block_size, $xor)); - $ciphertext.= $block ^ $key; - } - if ($this->continuousBuffer) { - $this->encryptIV = $xor; - } - } - - return $ciphertext; - } - - /** - * Decrypts a message. - * - * If strlen($ciphertext) is not a multiple of the block size, null bytes will be added to the end of the string until - * it is. - * - * @see Crypt_Rijndael::encrypt() - * @access public - * @param String $ciphertext - */ - function decrypt($ciphertext) - { - $this->_setup(); - - if ($this->mode != CRYPT_RIJNDAEL_MODE_CTR) { - // we pad with chr(0) since that's what mcrypt_generic does. to quote from http://php.net/function.mcrypt-generic : - // "The data is padded with "\0" to make sure the length of the data is n * blocksize." - $ciphertext = str_pad($ciphertext, (strlen($ciphertext) + $this->block_size - 1) % $this->block_size, chr(0)); - } - - $block_size = $this->block_size; - $plaintext = ''; - switch ($this->mode) { - case CRYPT_RIJNDAEL_MODE_ECB: - for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) { - $plaintext.= $this->_decryptBlock(substr($ciphertext, $i, $block_size)); - } - break; - case CRYPT_RIJNDAEL_MODE_CBC: - $xor = $this->decryptIV; - for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) { - $block = substr($ciphertext, $i, $block_size); - $plaintext.= $this->_decryptBlock($block) ^ $xor; - $xor = $block; - } - if ($this->continuousBuffer) { - $this->decryptIV = $xor; - } - break; - case CRYPT_RIJNDAEL_MODE_CTR: - $xor = $this->decryptIV; - for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) { - $block = substr($ciphertext, $i, $block_size); - $key = $this->_encryptBlock($this->_generate_xor($block_size, $xor)); - $plaintext.= $block ^ $key; - } - if ($this->continuousBuffer) { - $this->decryptIV = $xor; - } - } - - return $this->mode != CRYPT_RIJNDAEL_MODE_CTR ? $this->_unpad($plaintext) : $plaintext; - } - - /** - * Encrypts a block - * - * @access private - * @param String $in - * @return String - */ - function _encryptBlock($in) - { - $state = array(); - $words = unpack('N*word', $in); - - $w = $this->w; - $t0 = $this->t0; - $t1 = $this->t1; - $t2 = $this->t2; - $t3 = $this->t3; - $Nb = $this->Nb; - $Nr = $this->Nr; - $c = $this->c; - - // addRoundKey - $i = 0; - foreach ($words as $word) { - $state[] = $word ^ $w[0][$i++]; - } - - // fips-197.pdf#page=19, "Figure 5. Pseudo Code for the Cipher", states that this loop has four components - - // subBytes, shiftRows, mixColumns, and addRoundKey. fips-197.pdf#page=30, "Implementation Suggestions Regarding - // Various Platforms" suggests that performs enhanced implementations are described in Rijndael-ammended.pdf. - // Rijndael-ammended.pdf#page=20, "Implementation aspects / 32-bit processor", discusses such an optimization. - // Unfortunately, the description given there is not quite correct. Per aes.spec.v316.pdf#page=19 [1], - // equation (7.4.7) is supposed to use addition instead of subtraction, so we'll do that here, as well. - - // [1] http://fp.gladman.plus.com/cryptography_technology/rijndael/aes.spec.v316.pdf - $temp = array(); - for ($round = 1; $round < $Nr; $round++) { - $i = 0; // $c[0] == 0 - $j = $c[1]; - $k = $c[2]; - $l = $c[3]; - - while ($i < $this->Nb) { - $temp[$i] = $t0[$state[$i] & 0xFF000000] ^ - $t1[$state[$j] & 0x00FF0000] ^ - $t2[$state[$k] & 0x0000FF00] ^ - $t3[$state[$l] & 0x000000FF] ^ - $w[$round][$i]; - $i++; - $j = ($j + 1) % $Nb; - $k = ($k + 1) % $Nb; - $l = ($l + 1) % $Nb; - } - - for ($i = 0; $i < $Nb; $i++) { - $state[$i] = $temp[$i]; - } - } - - // subWord - for ($i = 0; $i < $Nb; $i++) { - $state[$i] = $this->_subWord($state[$i]); - } - - // shiftRows + addRoundKey - $i = 0; // $c[0] == 0 - $j = $c[1]; - $k = $c[2]; - $l = $c[3]; - while ($i < $this->Nb) { - $temp[$i] = ($state[$i] & 0xFF000000) ^ - ($state[$j] & 0x00FF0000) ^ - ($state[$k] & 0x0000FF00) ^ - ($state[$l] & 0x000000FF) ^ - $w[$Nr][$i]; - $i++; - $j = ($j + 1) % $Nb; - $k = ($k + 1) % $Nb; - $l = ($l + 1) % $Nb; - } - $state = $temp; - - array_unshift($state, 'N*'); - - return call_user_func_array('pack', $state); - } - - /** - * Decrypts a block - * - * @access private - * @param String $in - * @return String - */ - function _decryptBlock($in) - { - $state = array(); - $words = unpack('N*word', $in); - - $num_states = count($state); - $dw = $this->dw; - $dt0 = $this->dt0; - $dt1 = $this->dt1; - $dt2 = $this->dt2; - $dt3 = $this->dt3; - $Nb = $this->Nb; - $Nr = $this->Nr; - $c = $this->c; - - // addRoundKey - $i = 0; - foreach ($words as $word) { - $state[] = $word ^ $dw[$Nr][$i++]; - } - - $temp = array(); - for ($round = $Nr - 1; $round > 0; $round--) { - $i = 0; // $c[0] == 0 - $j = $Nb - $c[1]; - $k = $Nb - $c[2]; - $l = $Nb - $c[3]; - - while ($i < $Nb) { - $temp[$i] = $dt0[$state[$i] & 0xFF000000] ^ - $dt1[$state[$j] & 0x00FF0000] ^ - $dt2[$state[$k] & 0x0000FF00] ^ - $dt3[$state[$l] & 0x000000FF] ^ - $dw[$round][$i]; - $i++; - $j = ($j + 1) % $Nb; - $k = ($k + 1) % $Nb; - $l = ($l + 1) % $Nb; - } - - for ($i = 0; $i < $Nb; $i++) { - $state[$i] = $temp[$i]; - } - } - - // invShiftRows + invSubWord + addRoundKey - $i = 0; // $c[0] == 0 - $j = $Nb - $c[1]; - $k = $Nb - $c[2]; - $l = $Nb - $c[3]; - - while ($i < $Nb) { - $temp[$i] = $dw[0][$i] ^ - $this->_invSubWord(($state[$i] & 0xFF000000) | - ($state[$j] & 0x00FF0000) | - ($state[$k] & 0x0000FF00) | - ($state[$l] & 0x000000FF)); - $i++; - $j = ($j + 1) % $Nb; - $k = ($k + 1) % $Nb; - $l = ($l + 1) % $Nb; - } - - $state = $temp; - - array_unshift($state, 'N*'); - - return call_user_func_array('pack', $state); - } - - /** - * Setup Rijndael - * - * Validates all the variables and calculates $Nr - the number of rounds that need to be performed - and $w - the key - * key schedule. - * - * @access private - */ - function _setup() - { - // Each number in $rcon is equal to the previous number multiplied by two in Rijndael's finite field. - // See http://en.wikipedia.org/wiki/Finite_field_arithmetic#Multiplicative_inverse - static $rcon = array(0, - 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000, - 0x20000000, 0x40000000, 0x80000000, 0x1B000000, 0x36000000, - 0x6C000000, 0xD8000000, 0xAB000000, 0x4D000000, 0x9A000000, - 0x2F000000, 0x5E000000, 0xBC000000, 0x63000000, 0xC6000000, - 0x97000000, 0x35000000, 0x6A000000, 0xD4000000, 0xB3000000, - 0x7D000000, 0xFA000000, 0xEF000000, 0xC5000000, 0x91000000 - ); - - if (!$this->changed) { - return; - } - - if (!$this->explicit_key_length) { - // we do >> 2, here, and not >> 5, as we do above, since strlen($this->key) tells us the number of bytes - not bits - $length = strlen($this->key) >> 2; - if ($length > 8) { - $length = 8; - } else if ($length < 4) { - $length = 4; - } - $this->Nk = $length; - $this->key_size = $length << 2; - } - - $this->key = str_pad(substr($this->key, 0, $this->key_size), $this->key_size, chr(0)); - $this->encryptIV = $this->decryptIV = $this->iv = str_pad(substr($this->iv, 0, $this->block_size), $this->block_size, chr(0)); - - // see Rijndael-ammended.pdf#page=44 - $this->Nr = max($this->Nk, $this->Nb) + 6; - - // shift offsets for Nb = 5, 7 are defined in Rijndael-ammended.pdf#page=44, - // "Table 8: Shift offsets in Shiftrow for the alternative block lengths" - // shift offsets for Nb = 4, 6, 8 are defined in Rijndael-ammended.pdf#page=14, - // "Table 2: Shift offsets for different block lengths" - switch ($this->Nb) { - case 4: - case 5: - case 6: - $this->c = array(0, 1, 2, 3); - break; - case 7: - $this->c = array(0, 1, 2, 4); - break; - case 8: - $this->c = array(0, 1, 3, 4); - } - - $key = $this->key; - - $w = array_values(unpack('N*words', $key)); - - $length = $this->Nb * ($this->Nr + 1); - for ($i = $this->Nk; $i < $length; $i++) { - $temp = $w[$i - 1]; - if ($i % $this->Nk == 0) { - // according to <http://php.net/language.types.integer>, "the size of an integer is platform-dependent". - // on a 32-bit machine, it's 32-bits, and on a 64-bit machine, it's 64-bits. on a 32-bit machine, - // 0xFFFFFFFF << 8 == 0xFFFFFF00, but on a 64-bit machine, it equals 0xFFFFFFFF00. as such, doing 'and' - // with 0xFFFFFFFF (or 0xFFFFFF00) on a 32-bit machine is unnecessary, but on a 64-bit machine, it is. - $temp = (($temp << 8) & 0xFFFFFF00) | (($temp >> 24) & 0x000000FF); // rotWord - $temp = $this->_subWord($temp) ^ $rcon[$i / $this->Nk]; - } else if ($this->Nk > 6 && $i % $this->Nk == 4) { - $temp = $this->_subWord($temp); - } - $w[$i] = $w[$i - $this->Nk] ^ $temp; - } - - // convert the key schedule from a vector of $Nb * ($Nr + 1) length to a matrix with $Nr + 1 rows and $Nb columns - // and generate the inverse key schedule. more specifically, - // according to <http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=23> (section 5.3.3), - // "The key expansion for the Inverse Cipher is defined as follows: - // 1. Apply the Key Expansion. - // 2. Apply InvMixColumn to all Round Keys except the first and the last one." - // also, see fips-197.pdf#page=27, "5.3.5 Equivalent Inverse Cipher" - $temp = array(); - for ($i = $row = $col = 0; $i < $length; $i++, $col++) { - if ($col == $this->Nb) { - if ($row == 0) { - $this->dw[0] = $this->w[0]; - } else { - // subWord + invMixColumn + invSubWord = invMixColumn - $j = 0; - while ($j < $this->Nb) { - $dw = $this->_subWord($this->w[$row][$j]); - $temp[$j] = $this->dt0[$dw & 0xFF000000] ^ - $this->dt1[$dw & 0x00FF0000] ^ - $this->dt2[$dw & 0x0000FF00] ^ - $this->dt3[$dw & 0x000000FF]; - $j++; - } - $this->dw[$row] = $temp; - } - - $col = 0; - $row++; - } - $this->w[$row][$col] = $w[$i]; - } - - $this->dw[$row] = $this->w[$row]; - - $this->changed = false; - } - - /** - * Performs S-Box substitutions - * - * @access private - */ - function _subWord($word) - { - static $sbox0, $sbox1, $sbox2, $sbox3; - - if (empty($sbox0)) { - $sbox0 = array( - 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76, - 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0, - 0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15, - 0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75, - 0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0, 0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84, - 0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B, 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF, - 0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, 0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8, - 0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5, 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2, - 0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17, 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73, - 0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB, - 0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C, 0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79, - 0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9, 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08, - 0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A, - 0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E, - 0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF, - 0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16 - ); - - $sbox1 = array(); - $sbox2 = array(); - $sbox3 = array(); - - for ($i = 0; $i < 256; $i++) { - $sbox1[$i << 8] = $sbox0[$i] << 8; - $sbox2[$i << 16] = $sbox0[$i] << 16; - $sbox3[$i << 24] = $sbox0[$i] << 24; - } - } - - return $sbox0[$word & 0x000000FF] | - $sbox1[$word & 0x0000FF00] | - $sbox2[$word & 0x00FF0000] | - $sbox3[$word & 0xFF000000]; - } - - /** - * Performs inverse S-Box substitutions - * - * @access private - */ - function _invSubWord($word) - { - static $sbox0, $sbox1, $sbox2, $sbox3; - - if (empty($sbox0)) { - $sbox0 = array( - 0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, 0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB, - 0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, 0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB, - 0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D, 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E, - 0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2, 0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B, 0xD1, 0x25, - 0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92, - 0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA, 0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84, - 0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, 0xF7, 0xE4, 0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06, - 0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02, 0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B, - 0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA, 0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73, - 0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85, 0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E, - 0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89, 0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B, - 0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20, 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4, - 0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, 0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F, - 0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D, 0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF, - 0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0, 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61, - 0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D - ); - - $sbox1 = array(); - $sbox2 = array(); - $sbox3 = array(); - - for ($i = 0; $i < 256; $i++) { - $sbox1[$i << 8] = $sbox0[$i] << 8; - $sbox2[$i << 16] = $sbox0[$i] << 16; - $sbox3[$i << 24] = $sbox0[$i] << 24; - } - } - - return $sbox0[$word & 0x000000FF] | - $sbox1[$word & 0x0000FF00] | - $sbox2[$word & 0x00FF0000] | - $sbox3[$word & 0xFF000000]; - } - - /** - * Pad "packets". - * - * Rijndael works by encrypting between sixteen and thirty-two bytes at a time, provided that number is also a multiple - * of four. If you ever need to encrypt or decrypt something that isn't of the proper length, it becomes necessary to - * pad the input so that it is of the proper length. - * - * Padding is enabled by default. Sometimes, however, it is undesirable to pad strings. Such is the case in SSH, - * where "packets" are padded with random bytes before being encrypted. Unpad these packets and you risk stripping - * away characters that shouldn't be stripped away. (SSH knows how many bytes are added because the length is - * transmitted separately) - * - * @see Crypt_Rijndael::disablePadding() - * @access public - */ - function enablePadding() - { - $this->padding = true; - } - - /** - * Do not pad packets. - * - * @see Crypt_Rijndael::enablePadding() - * @access public - */ - function disablePadding() - { - $this->padding = false; - } - - /** - * Pads a string - * - * Pads a string using the RSA PKCS padding standards so that its length is a multiple of the blocksize. - * $block_size - (strlen($text) % $block_size) bytes are added, each of which is equal to - * chr($block_size - (strlen($text) % $block_size) - * - * If padding is disabled and $text is not a multiple of the blocksize, the string will be padded regardless - * and padding will, hence forth, be enabled. - * - * @see Crypt_Rijndael::_unpad() - * @access private - */ - function _pad($text) - { - $length = strlen($text); - - if (!$this->padding) { - if ($length % $this->block_size == 0) { - return $text; - } else { - user_error("The plaintext's length ($length) is not a multiple of the block size ({$this->block_size})", E_USER_NOTICE); - $this->padding = true; - } - } - - $pad = $this->block_size - ($length % $this->block_size); - - return str_pad($text, $length + $pad, chr($pad)); - } - - /** - * Unpads a string. - * - * If padding is enabled and the reported padding length is invalid the encryption key will be assumed to be wrong - * and false will be returned. - * - * @see Crypt_Rijndael::_pad() - * @access private - */ - function _unpad($text) - { - if (!$this->padding) { - return $text; - } - - $length = ord($text[strlen($text) - 1]); - - if (!$length || $length > $this->block_size) { - return false; - } - - return substr($text, 0, -$length); - } - - /** - * Treat consecutive "packets" as if they are a continuous buffer. - * - * Say you have a 32-byte plaintext $plaintext. Using the default behavior, the two following code snippets - * will yield different outputs: - * - * <code> - * echo $rijndael->encrypt(substr($plaintext, 0, 16)); - * echo $rijndael->encrypt(substr($plaintext, 16, 16)); - * </code> - * <code> - * echo $rijndael->encrypt($plaintext); - * </code> - * - * The solution is to enable the continuous buffer. Although this will resolve the above discrepancy, it creates - * another, as demonstrated with the following: - * - * <code> - * $rijndael->encrypt(substr($plaintext, 0, 16)); - * echo $rijndael->decrypt($des->encrypt(substr($plaintext, 16, 16))); - * </code> - * <code> - * echo $rijndael->decrypt($des->encrypt(substr($plaintext, 16, 16))); - * </code> - * - * With the continuous buffer disabled, these would yield the same output. With it enabled, they yield different - * outputs. The reason is due to the fact that the initialization vector's change after every encryption / - * decryption round when the continuous buffer is enabled. When it's disabled, they remain constant. - * - * Put another way, when the continuous buffer is enabled, the state of the Crypt_Rijndael() object changes after each - * encryption / decryption round, whereas otherwise, it'd remain constant. For this reason, it's recommended that - * continuous buffers not be used. They do offer better security and are, in fact, sometimes required (SSH uses them), - * however, they are also less intuitive and more likely to cause you problems. - * - * @see Crypt_Rijndael::disableContinuousBuffer() - * @access public - */ - function enableContinuousBuffer() - { - $this->continuousBuffer = true; - } - - /** - * Treat consecutive packets as if they are a discontinuous buffer. - * - * The default behavior. - * - * @see Crypt_Rijndael::enableContinuousBuffer() - * @access public - */ - function disableContinuousBuffer() - { - $this->continuousBuffer = false; - $this->encryptIV = $this->iv; - $this->decryptIV = $this->iv; - } - - /** - * String Shift - * - * Inspired by array_shift - * - * @param String $string - * @param optional Integer $index - * @return String - * @access private - */ - function _string_shift(&$string, $index = 1) - { - $substr = substr($string, 0, $index); - $string = substr($string, $index); - return $substr; - } -} - -// vim: ts=4:sw=4:et: -// vim6: fdl=1: diff --git a/lib/internal/phpseclib/Crypt/TripleDES.php b/lib/internal/phpseclib/Crypt/TripleDES.php deleted file mode 100644 index 2a66b3e14d7..00000000000 --- a/lib/internal/phpseclib/Crypt/TripleDES.php +++ /dev/null @@ -1,690 +0,0 @@ -<?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * Pure-PHP implementation of Triple DES. - * - * Uses mcrypt, if available, and an internal implementation, otherwise. Operates in the EDE3 mode (encrypt-decrypt-encrypt). - * - * PHP versions 4 and 5 - * - * Here's a short example of how to use this library: - * <code> - * <?php - * include('Crypt/TripleDES.php'); - * - * $des = new Crypt_TripleDES(); - * - * $des->setKey('abcdefghijklmnopqrstuvwx'); - * - * $size = 10 * 1024; - * $plaintext = ''; - * for ($i = 0; $i < $size; $i++) { - * $plaintext.= 'a'; - * } - * - * echo $des->decrypt($des->encrypt($plaintext)); - * ?> - * </code> - * - * LICENSE: This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - * @category Crypt - * @package Crypt_TripleDES - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMVII Jim Wigginton - * @license http://www.gnu.org/licenses/lgpl.txt - * @version $Id: TripleDES.php,v 1.13 2010/02/26 03:40:25 terrafrost Exp $ - * @link http://phpseclib.sourceforge.net - */ - -/** - * Include Crypt_DES - */ -require_once 'DES.php'; - -/** - * Encrypt / decrypt using inner chaining - * - * Inner chaining is used by SSH-1 and is generally considered to be less secure then outer chaining (CRYPT_DES_MODE_CBC3). - */ -define('CRYPT_DES_MODE_3CBC', 3); - -/** - * Encrypt / decrypt using outer chaining - * - * Outer chaining is used by SSH-2 and when the mode is set to CRYPT_DES_MODE_CBC. - */ -define('CRYPT_DES_MODE_CBC3', CRYPT_DES_MODE_CBC); - -/** - * Pure-PHP implementation of Triple DES. - * - * @author Jim Wigginton <terrafrost@php.net> - * @version 0.1.0 - * @access public - * @package Crypt_TerraDES - */ -class Crypt_TripleDES { - /** - * The Three Keys - * - * @see Crypt_TripleDES::setKey() - * @var String - * @access private - */ - var $key = "\0\0\0\0\0\0\0\0"; - - /** - * The Encryption Mode - * - * @see Crypt_TripleDES::Crypt_TripleDES() - * @var Integer - * @access private - */ - var $mode = CRYPT_DES_MODE_CBC; - - /** - * Continuous Buffer status - * - * @see Crypt_TripleDES::enableContinuousBuffer() - * @var Boolean - * @access private - */ - var $continuousBuffer = false; - - /** - * Padding status - * - * @see Crypt_TripleDES::enablePadding() - * @var Boolean - * @access private - */ - var $padding = true; - - /** - * The Initialization Vector - * - * @see Crypt_TripleDES::setIV() - * @var String - * @access private - */ - var $iv = "\0\0\0\0\0\0\0\0"; - - /** - * A "sliding" Initialization Vector - * - * @see Crypt_TripleDES::enableContinuousBuffer() - * @var String - * @access private - */ - var $encryptIV = "\0\0\0\0\0\0\0\0"; - - /** - * A "sliding" Initialization Vector - * - * @see Crypt_TripleDES::enableContinuousBuffer() - * @var String - * @access private - */ - var $decryptIV = "\0\0\0\0\0\0\0\0"; - - /** - * The Crypt_DES objects - * - * @var Array - * @access private - */ - var $des; - - /** - * mcrypt resource for encryption - * - * The mcrypt resource can be recreated every time something needs to be created or it can be created just once. - * Since mcrypt operates in continuous mode, by default, it'll need to be recreated when in non-continuous mode. - * - * @see Crypt_AES::encrypt() - * @var String - * @access private - */ - var $enmcrypt; - - /** - * mcrypt resource for decryption - * - * The mcrypt resource can be recreated every time something needs to be created or it can be created just once. - * Since mcrypt operates in continuous mode, by default, it'll need to be recreated when in non-continuous mode. - * - * @see Crypt_AES::decrypt() - * @var String - * @access private - */ - var $demcrypt; - - /** - * Does the (en|de)mcrypt resource need to be (re)initialized? - * - * @see setKey() - * @see setIV() - * @var Boolean - * @access private - */ - var $changed = true; - - /** - * Default Constructor. - * - * Determines whether or not the mcrypt extension should be used. $mode should only, at present, be - * CRYPT_DES_MODE_ECB or CRYPT_DES_MODE_CBC. If not explictly set, CRYPT_DES_MODE_CBC will be used. - * - * @param optional Integer $mode - * @return Crypt_TripleDES - * @access public - */ - function Crypt_TripleDES($mode = CRYPT_DES_MODE_CBC) - { - if ( !defined('CRYPT_DES_MODE') ) { - switch (true) { - case extension_loaded('mcrypt'): - // i'd check to see if des was supported, by doing in_array('des', mcrypt_list_algorithms('')), - // but since that can be changed after the object has been created, there doesn't seem to be - // a lot of point... - define('CRYPT_DES_MODE', CRYPT_DES_MODE_MCRYPT); - break; - default: - define('CRYPT_DES_MODE', CRYPT_DES_MODE_INTERNAL); - } - } - - if ( $mode == CRYPT_DES_MODE_3CBC ) { - $this->mode = CRYPT_DES_MODE_3CBC; - $this->des = array( - new Crypt_DES(CRYPT_DES_MODE_CBC), - new Crypt_DES(CRYPT_DES_MODE_CBC), - new Crypt_DES(CRYPT_DES_MODE_CBC) - ); - - // we're going to be doing the padding, ourselves, so disable it in the Crypt_DES objects - $this->des[0]->disablePadding(); - $this->des[1]->disablePadding(); - $this->des[2]->disablePadding(); - - return; - } - - switch ( CRYPT_DES_MODE ) { - case CRYPT_DES_MODE_MCRYPT: - switch ($mode) { - case CRYPT_DES_MODE_ECB: - $this->mode = MCRYPT_MODE_ECB; - break; - case CRYPT_DES_MODE_CTR: - $this->mode = 'ctr'; - break; - case CRYPT_DES_MODE_CBC: - default: - $this->mode = MCRYPT_MODE_CBC; - } - - break; - default: - $this->des = array( - new Crypt_DES(CRYPT_DES_MODE_ECB), - new Crypt_DES(CRYPT_DES_MODE_ECB), - new Crypt_DES(CRYPT_DES_MODE_ECB) - ); - - // we're going to be doing the padding, ourselves, so disable it in the Crypt_DES objects - $this->des[0]->disablePadding(); - $this->des[1]->disablePadding(); - $this->des[2]->disablePadding(); - - switch ($mode) { - case CRYPT_DES_MODE_ECB: - case CRYPT_DES_MODE_CTR: - case CRYPT_DES_MODE_CBC: - $this->mode = $mode; - break; - default: - $this->mode = CRYPT_DES_MODE_CBC; - } - } - } - - /** - * Sets the key. - * - * Keys can be of any length. Triple DES, itself, can use 128-bit (eg. strlen($key) == 16) or - * 192-bit (eg. strlen($key) == 24) keys. This function pads and truncates $key as appropriate. - * - * DES also requires that every eighth bit be a parity bit, however, we'll ignore that. - * - * If the key is not explicitly set, it'll be assumed to be all zero's. - * - * @access public - * @param String $key - */ - function setKey($key) - { - $length = strlen($key); - if ($length > 8) { - $key = str_pad($key, 24, chr(0)); - // if $key is between 64 and 128-bits, use the first 64-bits as the last, per this: - // http://php.net/function.mcrypt-encrypt#47973 - //$key = $length <= 16 ? substr_replace($key, substr($key, 0, 8), 16) : substr($key, 0, 24); - } - $this->key = $key; - switch (true) { - case CRYPT_DES_MODE == CRYPT_DES_MODE_INTERNAL: - case $this->mode == CRYPT_DES_MODE_3CBC: - $this->des[0]->setKey(substr($key, 0, 8)); - $this->des[1]->setKey(substr($key, 8, 8)); - $this->des[2]->setKey(substr($key, 16, 8)); - } - $this->changed = true; - } - - /** - * Sets the initialization vector. (optional) - * - * SetIV is not required when CRYPT_DES_MODE_ECB is being used. If not explictly set, it'll be assumed - * to be all zero's. - * - * @access public - * @param String $iv - */ - function setIV($iv) - { - $this->encryptIV = $this->decryptIV = $this->iv = str_pad(substr($iv, 0, 8), 8, chr(0)); - if ($this->mode == CRYPT_DES_MODE_3CBC) { - $this->des[0]->setIV($iv); - $this->des[1]->setIV($iv); - $this->des[2]->setIV($iv); - } - $this->changed = true; - } - - /** - * Generate CTR XOR encryption key - * - * Encrypt the output of this and XOR it against the ciphertext / plaintext to get the - * plaintext / ciphertext in CTR mode. - * - * @see Crypt_DES::decrypt() - * @see Crypt_DES::encrypt() - * @access public - * @param Integer $length - * @param String $iv - */ - function _generate_xor($length, &$iv) - { - $xor = ''; - $num_blocks = ($length + 7) >> 3; - for ($i = 0; $i < $num_blocks; $i++) { - $xor.= $iv; - for ($j = 4; $j <= 8; $j+=4) { - $temp = substr($iv, -$j, 4); - switch ($temp) { - case "\xFF\xFF\xFF\xFF": - $iv = substr_replace($iv, "\x00\x00\x00\x00", -$j, 4); - break; - case "\x7F\xFF\xFF\xFF": - $iv = substr_replace($iv, "\x80\x00\x00\x00", -$j, 4); - break 2; - default: - extract(unpack('Ncount', $temp)); - $iv = substr_replace($iv, pack('N', $count + 1), -$j, 4); - break 2; - } - } - } - - return $xor; - } - - /** - * Encrypts a message. - * - * @access public - * @param String $plaintext - */ - function encrypt($plaintext) - { - if ($this->mode != CRYPT_DES_MODE_CTR && $this->mode != 'ctr') { - $plaintext = $this->_pad($plaintext); - } - - // if the key is smaller then 8, do what we'd normally do - if ($this->mode == CRYPT_DES_MODE_3CBC && strlen($this->key) > 8) { - $ciphertext = $this->des[2]->encrypt($this->des[1]->decrypt($this->des[0]->encrypt($plaintext))); - - return $ciphertext; - } - - if ( CRYPT_DES_MODE == CRYPT_DES_MODE_MCRYPT ) { - if ($this->changed) { - if (!isset($this->enmcrypt)) { - $this->enmcrypt = mcrypt_module_open(MCRYPT_3DES, '', $this->mode, ''); - } - mcrypt_generic_init($this->enmcrypt, $this->key, $this->encryptIV); - $this->changed = false; - } - - $ciphertext = mcrypt_generic($this->enmcrypt, $plaintext); - - if (!$this->continuousBuffer) { - mcrypt_generic_init($this->enmcrypt, $this->key, $this->encryptIV); - } - - return $ciphertext; - } - - if (strlen($this->key) <= 8) { - $this->des[0]->mode = $this->mode; - - return $this->des[0]->encrypt($plaintext); - } - - // we pad with chr(0) since that's what mcrypt_generic does. to quote from http://php.net/function.mcrypt-generic : - // "The data is padded with "\0" to make sure the length of the data is n * blocksize." - $plaintext = str_pad($plaintext, ceil(strlen($plaintext) / 8) * 8, chr(0)); - - $des = $this->des; - - $ciphertext = ''; - switch ($this->mode) { - case CRYPT_DES_MODE_ECB: - for ($i = 0; $i < strlen($plaintext); $i+=8) { - $block = substr($plaintext, $i, 8); - $block = $des[0]->_processBlock($block, CRYPT_DES_ENCRYPT); - $block = $des[1]->_processBlock($block, CRYPT_DES_DECRYPT); - $block = $des[2]->_processBlock($block, CRYPT_DES_ENCRYPT); - $ciphertext.= $block; - } - break; - case CRYPT_DES_MODE_CBC: - $xor = $this->encryptIV; - for ($i = 0; $i < strlen($plaintext); $i+=8) { - $block = substr($plaintext, $i, 8) ^ $xor; - $block = $des[0]->_processBlock($block, CRYPT_DES_ENCRYPT); - $block = $des[1]->_processBlock($block, CRYPT_DES_DECRYPT); - $block = $des[2]->_processBlock($block, CRYPT_DES_ENCRYPT); - $xor = $block; - $ciphertext.= $block; - } - if ($this->continuousBuffer) { - $this->encryptIV = $xor; - } - break; - case CRYPT_DES_MODE_CTR: - $xor = $this->encryptIV; - for ($i = 0; $i < strlen($plaintext); $i+=8) { - $key = $this->_generate_xor(8, $xor); - $key = $des[0]->_processBlock($key, CRYPT_DES_ENCRYPT); - $key = $des[1]->_processBlock($key, CRYPT_DES_DECRYPT); - $key = $des[2]->_processBlock($key, CRYPT_DES_ENCRYPT); - $block = substr($plaintext, $i, 8); - $ciphertext.= $block ^ $key; - } - if ($this->continuousBuffer) { - $this->encryptIV = $xor; - } - } - - return $ciphertext; - } - - /** - * Decrypts a message. - * - * @access public - * @param String $ciphertext - */ - function decrypt($ciphertext) - { - if ($this->mode == CRYPT_DES_MODE_3CBC && strlen($this->key) > 8) { - $plaintext = $this->des[0]->decrypt($this->des[1]->encrypt($this->des[2]->decrypt($ciphertext))); - - return $this->_unpad($plaintext); - } - - // we pad with chr(0) since that's what mcrypt_generic does. to quote from http://php.net/function.mcrypt-generic : - // "The data is padded with "\0" to make sure the length of the data is n * blocksize." - $ciphertext = str_pad($ciphertext, (strlen($ciphertext) + 7) & 0xFFFFFFF8, chr(0)); - - if ( CRYPT_DES_MODE == CRYPT_DES_MODE_MCRYPT ) { - if ($this->changed) { - if (!isset($this->demcrypt)) { - $this->demcrypt = mcrypt_module_open(MCRYPT_3DES, '', $this->mode, ''); - } - mcrypt_generic_init($this->demcrypt, $this->key, $this->decryptIV); - $this->changed = false; - } - - $plaintext = mdecrypt_generic($this->demcrypt, $ciphertext); - - if (!$this->continuousBuffer) { - mcrypt_generic_init($this->demcrypt, $this->key, $this->decryptIV); - } - - return $this->mode != 'ctr' ? $this->_unpad($plaintext) : $plaintext; - } - - if (strlen($this->key) <= 8) { - $this->des[0]->mode = $this->mode; - - return $this->_unpad($this->des[0]->decrypt($plaintext)); - } - - $des = $this->des; - - $plaintext = ''; - switch ($this->mode) { - case CRYPT_DES_MODE_ECB: - for ($i = 0; $i < strlen($ciphertext); $i+=8) { - $block = substr($ciphertext, $i, 8); - $block = $des[2]->_processBlock($block, CRYPT_DES_DECRYPT); - $block = $des[1]->_processBlock($block, CRYPT_DES_ENCRYPT); - $block = $des[0]->_processBlock($block, CRYPT_DES_DECRYPT); - $plaintext.= $block; - } - break; - case CRYPT_DES_MODE_CBC: - $xor = $this->decryptIV; - for ($i = 0; $i < strlen($ciphertext); $i+=8) { - $orig = $block = substr($ciphertext, $i, 8); - $block = $des[2]->_processBlock($block, CRYPT_DES_DECRYPT); - $block = $des[1]->_processBlock($block, CRYPT_DES_ENCRYPT); - $block = $des[0]->_processBlock($block, CRYPT_DES_DECRYPT); - $plaintext.= $block ^ $xor; - $xor = $orig; - } - if ($this->continuousBuffer) { - $this->decryptIV = $xor; - } - break; - case CRYPT_DES_MODE_CTR: - $xor = $this->decryptIV; - for ($i = 0; $i < strlen($ciphertext); $i+=8) { - $key = $this->_generate_xor(8, $xor); - $key = $des[0]->_processBlock($key, CRYPT_DES_ENCRYPT); - $key = $des[1]->_processBlock($key, CRYPT_DES_DECRYPT); - $key = $des[2]->_processBlock($key, CRYPT_DES_ENCRYPT); - $block = substr($ciphertext, $i, 8); - $plaintext.= $block ^ $key; - } - if ($this->continuousBuffer) { - $this->decryptIV = $xor; - } - } - - return $this->mode != CRYPT_DES_MODE_CTR ? $this->_unpad($plaintext) : $plaintext; - } - - /** - * Treat consecutive "packets" as if they are a continuous buffer. - * - * Say you have a 16-byte plaintext $plaintext. Using the default behavior, the two following code snippets - * will yield different outputs: - * - * <code> - * echo $des->encrypt(substr($plaintext, 0, 8)); - * echo $des->encrypt(substr($plaintext, 8, 8)); - * </code> - * <code> - * echo $des->encrypt($plaintext); - * </code> - * - * The solution is to enable the continuous buffer. Although this will resolve the above discrepancy, it creates - * another, as demonstrated with the following: - * - * <code> - * $des->encrypt(substr($plaintext, 0, 8)); - * echo $des->decrypt($des->encrypt(substr($plaintext, 8, 8))); - * </code> - * <code> - * echo $des->decrypt($des->encrypt(substr($plaintext, 8, 8))); - * </code> - * - * With the continuous buffer disabled, these would yield the same output. With it enabled, they yield different - * outputs. The reason is due to the fact that the initialization vector's change after every encryption / - * decryption round when the continuous buffer is enabled. When it's disabled, they remain constant. - * - * Put another way, when the continuous buffer is enabled, the state of the Crypt_DES() object changes after each - * encryption / decryption round, whereas otherwise, it'd remain constant. For this reason, it's recommended that - * continuous buffers not be used. They do offer better security and are, in fact, sometimes required (SSH uses them), - * however, they are also less intuitive and more likely to cause you problems. - * - * @see Crypt_TripleDES::disableContinuousBuffer() - * @access public - */ - function enableContinuousBuffer() - { - $this->continuousBuffer = true; - if ($this->mode == CRYPT_DES_MODE_3CBC) { - $this->des[0]->enableContinuousBuffer(); - $this->des[1]->enableContinuousBuffer(); - $this->des[2]->enableContinuousBuffer(); - } - } - - /** - * Treat consecutive packets as if they are a discontinuous buffer. - * - * The default behavior. - * - * @see Crypt_TripleDES::enableContinuousBuffer() - * @access public - */ - function disableContinuousBuffer() - { - $this->continuousBuffer = false; - $this->encryptIV = $this->iv; - $this->decryptIV = $this->iv; - - if ($this->mode == CRYPT_DES_MODE_3CBC) { - $this->des[0]->disableContinuousBuffer(); - $this->des[1]->disableContinuousBuffer(); - $this->des[2]->disableContinuousBuffer(); - } - } - - /** - * Pad "packets". - * - * DES works by encrypting eight bytes at a time. If you ever need to encrypt or decrypt something that's not - * a multiple of eight, it becomes necessary to pad the input so that it's length is a multiple of eight. - * - * Padding is enabled by default. Sometimes, however, it is undesirable to pad strings. Such is the case in SSH1, - * where "packets" are padded with random bytes before being encrypted. Unpad these packets and you risk stripping - * away characters that shouldn't be stripped away. (SSH knows how many bytes are added because the length is - * transmitted separately) - * - * @see Crypt_TripleDES::disablePadding() - * @access public - */ - function enablePadding() - { - $this->padding = true; - } - - /** - * Do not pad packets. - * - * @see Crypt_TripleDES::enablePadding() - * @access public - */ - function disablePadding() - { - $this->padding = false; - } - - /** - * Pads a string - * - * Pads a string using the RSA PKCS padding standards so that its length is a multiple of the blocksize (8). - * 8 - (strlen($text) & 7) bytes are added, each of which is equal to chr(8 - (strlen($text) & 7) - * - * If padding is disabled and $text is not a multiple of the blocksize, the string will be padded regardless - * and padding will, hence forth, be enabled. - * - * @see Crypt_TripleDES::_unpad() - * @access private - */ - function _pad($text) - { - $length = strlen($text); - - if (!$this->padding) { - if (($length & 7) == 0) { - return $text; - } else { - user_error("The plaintext's length ($length) is not a multiple of the block size (8)", E_USER_NOTICE); - $this->padding = true; - } - } - - $pad = 8 - ($length & 7); - return str_pad($text, $length + $pad, chr($pad)); - } - - /** - * Unpads a string - * - * If padding is enabled and the reported padding length is invalid the encryption key will be assumed to be wrong - * and false will be returned. - * - * @see Crypt_TripleDES::_pad() - * @access private - */ - function _unpad($text) - { - if (!$this->padding) { - return $text; - } - - $length = ord($text[strlen($text) - 1]); - - if (!$length || $length > 8) { - return false; - } - - return substr($text, 0, -$length); - } -} - -// vim: ts=4:sw=4:et: -// vim6: fdl=1: diff --git a/lib/internal/phpseclib/Math/BigInteger.php b/lib/internal/phpseclib/Math/BigInteger.php deleted file mode 100644 index 92b50b8d680..00000000000 --- a/lib/internal/phpseclib/Math/BigInteger.php +++ /dev/null @@ -1,3545 +0,0 @@ -<?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * Pure-PHP arbitrary precision integer arithmetic library. - * - * Supports base-2, base-10, base-16, and base-256 numbers. Uses the GMP or BCMath extensions, if available, - * and an internal implementation, otherwise. - * - * PHP versions 4 and 5 - * - * {@internal (all DocBlock comments regarding implementation - such as the one that follows - refer to the - * {@link MATH_BIGINTEGER_MODE_INTERNAL MATH_BIGINTEGER_MODE_INTERNAL} mode) - * - * Math_BigInteger uses base-2**26 to perform operations such as multiplication and division and - * base-2**52 (ie. two base 2**26 digits) to perform addition and subtraction. Because the largest possible - * value when multiplying two base-2**26 numbers together is a base-2**52 number, double precision floating - * point numbers - numbers that should be supported on most hardware and whose significand is 53 bits - are - * used. As a consequence, bitwise operators such as >> and << cannot be used, nor can the modulo operator %, - * which only supports integers. Although this fact will slow this library down, the fact that such a high - * base is being used should more than compensate. - * - * When PHP version 6 is officially released, we'll be able to use 64-bit integers. This should, once again, - * allow bitwise operators, and will increase the maximum possible base to 2**31 (or 2**62 for addition / - * subtraction). - * - * Numbers are stored in {@link http://en.wikipedia.org/wiki/Endianness little endian} format. ie. - * (new Math_BigInteger(pow(2, 26)))->value = array(0, 1) - * - * Useful resources are as follows: - * - * - {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf Handbook of Applied Cryptography (HAC)} - * - {@link http://math.libtomcrypt.com/files/tommath.pdf Multi-Precision Math (MPM)} - * - Java's BigInteger classes. See /j2se/src/share/classes/java/math in jdk-1_5_0-src-jrl.zip - * - * Here's an example of how to use this library: - * <code> - * <?php - * include('Math/BigInteger.php'); - * - * $a = new Math_BigInteger(2); - * $b = new Math_BigInteger(3); - * - * $c = $a->add($b); - * - * echo $c->toString(); // outputs 5 - * ?> - * </code> - * - * LICENSE: This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - * @category Math - * @package Math_BigInteger - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMVI Jim Wigginton - * @license http://www.gnu.org/licenses/lgpl.txt - * @version $Id: BigInteger.php,v 1.33 2010/03/22 22:32:03 terrafrost Exp $ - * @link http://pear.php.net/package/Math_BigInteger - */ - -/**#@+ - * Reduction constants - * - * @access private - * @see Math_BigInteger::_reduce() - */ -/** - * @see Math_BigInteger::_montgomery() - * @see Math_BigInteger::_prepMontgomery() - */ -define('MATH_BIGINTEGER_MONTGOMERY', 0); -/** - * @see Math_BigInteger::_barrett() - */ -define('MATH_BIGINTEGER_BARRETT', 1); -/** - * @see Math_BigInteger::_mod2() - */ -define('MATH_BIGINTEGER_POWEROF2', 2); -/** - * @see Math_BigInteger::_remainder() - */ -define('MATH_BIGINTEGER_CLASSIC', 3); -/** - * @see Math_BigInteger::__clone() - */ -define('MATH_BIGINTEGER_NONE', 4); -/**#@-*/ - -/**#@+ - * Array constants - * - * Rather than create a thousands and thousands of new Math_BigInteger objects in repeated function calls to add() and - * multiply() or whatever, we'll just work directly on arrays, taking them in as parameters and returning them. - * - * @access private - */ -/** - * $result[MATH_BIGINTEGER_VALUE] contains the value. - */ -define('MATH_BIGINTEGER_VALUE', 0); -/** - * $result[MATH_BIGINTEGER_SIGN] contains the sign. - */ -define('MATH_BIGINTEGER_SIGN', 1); -/**#@-*/ - -/**#@+ - * @access private - * @see Math_BigInteger::_montgomery() - * @see Math_BigInteger::_barrett() - */ -/** - * Cache constants - * - * $cache[MATH_BIGINTEGER_VARIABLE] tells us whether or not the cached data is still valid. - */ -define('MATH_BIGINTEGER_VARIABLE', 0); -/** - * $cache[MATH_BIGINTEGER_DATA] contains the cached data. - */ -define('MATH_BIGINTEGER_DATA', 1); -/**#@-*/ - -/**#@+ - * Mode constants. - * - * @access private - * @see Math_BigInteger::Math_BigInteger() - */ -/** - * To use the pure-PHP implementation - */ -define('MATH_BIGINTEGER_MODE_INTERNAL', 1); -/** - * To use the BCMath library - * - * (if enabled; otherwise, the internal implementation will be used) - */ -define('MATH_BIGINTEGER_MODE_BCMATH', 2); -/** - * To use the GMP library - * - * (if present; otherwise, either the BCMath or the internal implementation will be used) - */ -define('MATH_BIGINTEGER_MODE_GMP', 3); -/**#@-*/ - -/** - * The largest digit that may be used in addition / subtraction - * - * (we do pow(2, 52) instead of using 4503599627370496, directly, because some PHP installations - * will truncate 4503599627370496) - * - * @access private - */ -define('MATH_BIGINTEGER_MAX_DIGIT52', pow(2, 52)); - -/** - * Karatsuba Cutoff - * - * At what point do we switch between Karatsuba multiplication and schoolbook long multiplication? - * - * @access private - */ -define('MATH_BIGINTEGER_KARATSUBA_CUTOFF', 25); - -/** - * Pure-PHP arbitrary precision integer arithmetic library. Supports base-2, base-10, base-16, and base-256 - * numbers. - * - * @author Jim Wigginton <terrafrost@php.net> - * @version 1.0.0RC4 - * @access public - * @package Math_BigInteger - */ -class Math_BigInteger { - /** - * Holds the BigInteger's value. - * - * @var Array - * @access private - */ - var $value; - - /** - * Holds the BigInteger's magnitude. - * - * @var Boolean - * @access private - */ - var $is_negative = false; - - /** - * Random number generator function - * - * @see setRandomGenerator() - * @access private - */ - var $generator = 'mt_rand'; - - /** - * Precision - * - * @see setPrecision() - * @access private - */ - var $precision = -1; - - /** - * Precision Bitmask - * - * @see setPrecision() - * @access private - */ - var $bitmask = false; - - /** - * Mode independant value used for serialization. - * - * If the bcmath or gmp extensions are installed $this->value will be a non-serializable resource, hence the need for - * a variable that'll be serializable regardless of whether or not extensions are being used. Unlike $this->value, - * however, $this->hex is only calculated when $this->__sleep() is called. - * - * @see __sleep() - * @see __wakeup() - * @var String - * @access private - */ - var $hex; - - /** - * Converts base-2, base-10, base-16, and binary strings (eg. base-256) to BigIntegers. - * - * If the second parameter - $base - is negative, then it will be assumed that the number's are encoded using - * two's compliment. The sole exception to this is -10, which is treated the same as 10 is. - * - * Here's an example: - * <code> - * <?php - * include('Math/BigInteger.php'); - * - * $a = new Math_BigInteger('0x32', 16); // 50 in base-16 - * - * echo $a->toString(); // outputs 50 - * ?> - * </code> - * - * @param optional $x base-10 number or base-$base number if $base set. - * @param optional integer $base - * @return Math_BigInteger - * @access public - */ - function Math_BigInteger($x = 0, $base = 10) - { - if ( !defined('MATH_BIGINTEGER_MODE') ) { - switch (true) { - case extension_loaded('gmp'): - define('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_GMP); - break; - case extension_loaded('bcmath'): - define('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_BCMATH); - break; - default: - define('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_INTERNAL); - } - } - - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - if (is_resource($x) && get_resource_type($x) == 'GMP integer') { - $this->value = $x; - return; - } - $this->value = gmp_init(0); - break; - case MATH_BIGINTEGER_MODE_BCMATH: - $this->value = '0'; - break; - default: - $this->value = array(); - } - - if (empty($x)) { - return; - } - - switch ($base) { - case -256: - if (ord($x[0]) & 0x80) { - $x = ~$x; - $this->is_negative = true; - } - case 256: - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - $sign = $this->is_negative ? '-' : ''; - $this->value = gmp_init($sign . '0x' . bin2hex($x)); - break; - case MATH_BIGINTEGER_MODE_BCMATH: - // round $len to the nearest 4 (thanks, DavidMJ!) - $len = (strlen($x) + 3) & 0xFFFFFFFC; - - $x = str_pad($x, $len, chr(0), STR_PAD_LEFT); - - for ($i = 0; $i < $len; $i+= 4) { - $this->value = bcmul($this->value, '4294967296', 0); // 4294967296 == 2**32 - $this->value = bcadd($this->value, 0x1000000 * ord($x[$i]) + ((ord($x[$i + 1]) << 16) | (ord($x[$i + 2]) << 8) | ord($x[$i + 3])), 0); - } - - if ($this->is_negative) { - $this->value = '-' . $this->value; - } - - break; - // converts a base-2**8 (big endian / msb) number to base-2**26 (little endian / lsb) - default: - while (strlen($x)) { - $this->value[] = $this->_bytes2int($this->_base256_rshift($x, 26)); - } - } - - if ($this->is_negative) { - if (MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_INTERNAL) { - $this->is_negative = false; - } - $temp = $this->add(new Math_BigInteger('-1')); - $this->value = $temp->value; - } - break; - case 16: - case -16: - if ($base > 0 && $x[0] == '-') { - $this->is_negative = true; - $x = substr($x, 1); - } - - $x = preg_replace('#^(?:0x)?([A-Fa-f0-9]*).*#', '$1', $x); - - $is_negative = false; - if ($base < 0 && hexdec($x[0]) >= 8) { - $this->is_negative = $is_negative = true; - $x = bin2hex(~pack('H*', $x)); - } - - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - $temp = $this->is_negative ? '-0x' . $x : '0x' . $x; - $this->value = gmp_init($temp); - $this->is_negative = false; - break; - case MATH_BIGINTEGER_MODE_BCMATH: - $x = ( strlen($x) & 1 ) ? '0' . $x : $x; - $temp = new Math_BigInteger(pack('H*', $x), 256); - $this->value = $this->is_negative ? '-' . $temp->value : $temp->value; - $this->is_negative = false; - break; - default: - $x = ( strlen($x) & 1 ) ? '0' . $x : $x; - $temp = new Math_BigInteger(pack('H*', $x), 256); - $this->value = $temp->value; - } - - if ($is_negative) { - $temp = $this->add(new Math_BigInteger('-1')); - $this->value = $temp->value; - } - break; - case 10: - case -10: - $x = preg_replace('#^(-?[0-9]*).*#', '$1', $x); - - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - $this->value = gmp_init($x); - break; - case MATH_BIGINTEGER_MODE_BCMATH: - // explicitly casting $x to a string is necessary, here, since doing $x[0] on -1 yields different - // results then doing it on '-1' does (modInverse does $x[0]) - $this->value = (string) $x; - break; - default: - $temp = new Math_BigInteger(); - - // array(10000000) is 10**7 in base-2**26. 10**7 is the closest to 2**26 we can get without passing it. - $multiplier = new Math_BigInteger(); - $multiplier->value = array(10000000); - - if ($x[0] == '-') { - $this->is_negative = true; - $x = substr($x, 1); - } - - $x = str_pad($x, strlen($x) + (6 * strlen($x)) % 7, 0, STR_PAD_LEFT); - - while (strlen($x)) { - $temp = $temp->multiply($multiplier); - $temp = $temp->add(new Math_BigInteger($this->_int2bytes(substr($x, 0, 7)), 256)); - $x = substr($x, 7); - } - - $this->value = $temp->value; - } - break; - case 2: // base-2 support originally implemented by Lluis Pamies - thanks! - case -2: - if ($base > 0 && $x[0] == '-') { - $this->is_negative = true; - $x = substr($x, 1); - } - - $x = preg_replace('#^([01]*).*#', '$1', $x); - $x = str_pad($x, strlen($x) + (3 * strlen($x)) % 4, 0, STR_PAD_LEFT); - - $str = '0x'; - while (strlen($x)) { - $part = substr($x, 0, 4); - $str.= dechex(bindec($part)); - $x = substr($x, 4); - } - - if ($this->is_negative) { - $str = '-' . $str; - } - - $temp = new Math_BigInteger($str, 8 * $base); // ie. either -16 or +16 - $this->value = $temp->value; - $this->is_negative = $temp->is_negative; - - break; - default: - // base not supported, so we'll let $this == 0 - } - } - - /** - * Converts a BigInteger to a byte string (eg. base-256). - * - * Negative numbers are saved as positive numbers, unless $twos_compliment is set to true, at which point, they're - * saved as two's compliment. - * - * Here's an example: - * <code> - * <?php - * include('Math/BigInteger.php'); - * - * $a = new Math_BigInteger('65'); - * - * echo $a->toBytes(); // outputs chr(65) - * ?> - * </code> - * - * @param Boolean $twos_compliment - * @return String - * @access public - * @internal Converts a base-2**26 number to base-2**8 - */ - function toBytes($twos_compliment = false) - { - if ($twos_compliment) { - $comparison = $this->compare(new Math_BigInteger()); - if ($comparison == 0) { - return $this->precision > 0 ? str_repeat(chr(0), ($this->precision + 1) >> 3) : ''; - } - - $temp = $comparison < 0 ? $this->add(new Math_BigInteger(1)) : $this->copy(); - $bytes = $temp->toBytes(); - - if (empty($bytes)) { // eg. if the number we're trying to convert is -1 - $bytes = chr(0); - } - - if (ord($bytes[0]) & 0x80) { - $bytes = chr(0) . $bytes; - } - - return $comparison < 0 ? ~$bytes : $bytes; - } - - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - if (gmp_cmp($this->value, gmp_init(0)) == 0) { - return $this->precision > 0 ? str_repeat(chr(0), ($this->precision + 1) >> 3) : ''; - } - - $temp = gmp_strval(gmp_abs($this->value), 16); - $temp = ( strlen($temp) & 1 ) ? '0' . $temp : $temp; - $temp = pack('H*', $temp); - - return $this->precision > 0 ? - substr(str_pad($temp, $this->precision >> 3, chr(0), STR_PAD_LEFT), -($this->precision >> 3)) : - ltrim($temp, chr(0)); - case MATH_BIGINTEGER_MODE_BCMATH: - if ($this->value === '0') { - return $this->precision > 0 ? str_repeat(chr(0), ($this->precision + 1) >> 3) : ''; - } - - $value = ''; - $current = $this->value; - - if ($current[0] == '-') { - $current = substr($current, 1); - } - - while (bccomp($current, '0', 0) > 0) { - $temp = bcmod($current, '16777216'); - $value = chr($temp >> 16) . chr($temp >> 8) . chr($temp) . $value; - $current = bcdiv($current, '16777216', 0); - } - - return $this->precision > 0 ? - substr(str_pad($value, $this->precision >> 3, chr(0), STR_PAD_LEFT), -($this->precision >> 3)) : - ltrim($value, chr(0)); - } - - if (!count($this->value)) { - return $this->precision > 0 ? str_repeat(chr(0), ($this->precision + 1) >> 3) : ''; - } - $result = $this->_int2bytes($this->value[count($this->value) - 1]); - - $temp = $this->copy(); - - for ($i = count($temp->value) - 2; $i >= 0; --$i) { - $temp->_base256_lshift($result, 26); - $result = $result | str_pad($temp->_int2bytes($temp->value[$i]), strlen($result), chr(0), STR_PAD_LEFT); - } - - return $this->precision > 0 ? - str_pad(substr($result, -(($this->precision + 7) >> 3)), ($this->precision + 7) >> 3, chr(0), STR_PAD_LEFT) : - $result; - } - - /** - * Converts a BigInteger to a hex string (eg. base-16)). - * - * Negative numbers are saved as positive numbers, unless $twos_compliment is set to true, at which point, they're - * saved as two's compliment. - * - * Here's an example: - * <code> - * <?php - * include('Math/BigInteger.php'); - * - * $a = new Math_BigInteger('65'); - * - * echo $a->toHex(); // outputs '41' - * ?> - * </code> - * - * @param Boolean $twos_compliment - * @return String - * @access public - * @internal Converts a base-2**26 number to base-2**8 - */ - function toHex($twos_compliment = false) - { - return bin2hex($this->toBytes($twos_compliment)); - } - - /** - * Converts a BigInteger to a bit string (eg. base-2). - * - * Negative numbers are saved as positive numbers, unless $twos_compliment is set to true, at which point, they're - * saved as two's compliment. - * - * Here's an example: - * <code> - * <?php - * include('Math/BigInteger.php'); - * - * $a = new Math_BigInteger('65'); - * - * echo $a->toBits(); // outputs '1000001' - * ?> - * </code> - * - * @param Boolean $twos_compliment - * @return String - * @access public - * @internal Converts a base-2**26 number to base-2**2 - */ - function toBits($twos_compliment = false) - { - $hex = $this->toHex($twos_compliment); - $bits = ''; - for ($i = 0; $i < strlen($hex); $i+=8) { - $bits.= str_pad(decbin(hexdec(substr($hex, $i, 8))), 32, '0', STR_PAD_LEFT); - } - return $this->precision > 0 ? substr($bits, -$this->precision) : ltrim($bits, '0'); - } - - /** - * Converts a BigInteger to a base-10 number. - * - * Here's an example: - * <code> - * <?php - * include('Math/BigInteger.php'); - * - * $a = new Math_BigInteger('50'); - * - * echo $a->toString(); // outputs 50 - * ?> - * </code> - * - * @return String - * @access public - * @internal Converts a base-2**26 number to base-10**7 (which is pretty much base-10) - */ - function toString() - { - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - return gmp_strval($this->value); - case MATH_BIGINTEGER_MODE_BCMATH: - if ($this->value === '0') { - return '0'; - } - - return ltrim($this->value, '0'); - } - - if (!count($this->value)) { - return '0'; - } - - $temp = $this->copy(); - $temp->is_negative = false; - - $divisor = new Math_BigInteger(); - $divisor->value = array(10000000); // eg. 10**7 - $result = ''; - while (count($temp->value)) { - list($temp, $mod) = $temp->divide($divisor); - $result = str_pad(isset($mod->value[0]) ? $mod->value[0] : '', 7, '0', STR_PAD_LEFT) . $result; - } - $result = ltrim($result, '0'); - if (empty($result)) { - $result = '0'; - } - - if ($this->is_negative) { - $result = '-' . $result; - } - - return $result; - } - - /** - * Copy an object - * - * PHP5 passes objects by reference while PHP4 passes by value. As such, we need a function to guarantee - * that all objects are passed by value, when appropriate. More information can be found here: - * - * {@link http://php.net/language.oop5.basic#51624} - * - * @access public - * @see __clone() - * @return Math_BigInteger - */ - function copy() - { - $temp = new Math_BigInteger(); - $temp->value = $this->value; - $temp->is_negative = $this->is_negative; - $temp->generator = $this->generator; - $temp->precision = $this->precision; - $temp->bitmask = $this->bitmask; - return $temp; - } - - /** - * __toString() magic method - * - * Will be called, automatically, if you're supporting just PHP5. If you're supporting PHP4, you'll need to call - * toString(). - * - * @access public - * @internal Implemented per a suggestion by Techie-Michael - thanks! - */ - function __toString() - { - return $this->toString(); - } - - /** - * __clone() magic method - * - * Although you can call Math_BigInteger::__toString() directly in PHP5, you cannot call Math_BigInteger::__clone() - * directly in PHP5. You can in PHP4 since it's not a magic method, but in PHP5, you have to call it by using the PHP5 - * only syntax of $y = clone $x. As such, if you're trying to write an application that works on both PHP4 and PHP5, - * call Math_BigInteger::copy(), instead. - * - * @access public - * @see copy() - * @return Math_BigInteger - */ - function __clone() - { - return $this->copy(); - } - - /** - * __sleep() magic method - * - * Will be called, automatically, when serialize() is called on a Math_BigInteger object. - * - * @see __wakeup() - * @access public - */ - function __sleep() - { - $this->hex = $this->toHex(true); - $vars = array('hex'); - if ($this->generator != 'mt_rand') { - $vars[] = 'generator'; - } - if ($this->precision > 0) { - $vars[] = 'precision'; - } - return $vars; - - } - - /** - * __wakeup() magic method - * - * Will be called, automatically, when unserialize() is called on a Math_BigInteger object. - * - * @see __sleep() - * @access public - */ - function __wakeup() - { - $temp = new Math_BigInteger($this->hex, -16); - $this->value = $temp->value; - $this->is_negative = $temp->is_negative; - $this->setRandomGenerator($this->generator); - if ($this->precision > 0) { - // recalculate $this->bitmask - $this->setPrecision($this->precision); - } - } - - /** - * Adds two BigIntegers. - * - * Here's an example: - * <code> - * <?php - * include('Math/BigInteger.php'); - * - * $a = new Math_BigInteger('10'); - * $b = new Math_BigInteger('20'); - * - * $c = $a->add($b); - * - * echo $c->toString(); // outputs 30 - * ?> - * </code> - * - * @param Math_BigInteger $y - * @return Math_BigInteger - * @access public - * @internal Performs base-2**52 addition - */ - function add($y) - { - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - $temp = new Math_BigInteger(); - $temp->value = gmp_add($this->value, $y->value); - - return $this->_normalize($temp); - case MATH_BIGINTEGER_MODE_BCMATH: - $temp = new Math_BigInteger(); - $temp->value = bcadd($this->value, $y->value, 0); - - return $this->_normalize($temp); - } - - $temp = $this->_add($this->value, $this->is_negative, $y->value, $y->is_negative); - - $result = new Math_BigInteger(); - $result->value = $temp[MATH_BIGINTEGER_VALUE]; - $result->is_negative = $temp[MATH_BIGINTEGER_SIGN]; - - return $this->_normalize($result); - } - - /** - * Performs addition. - * - * @param Array $x_value - * @param Boolean $x_negative - * @param Array $y_value - * @param Boolean $y_negative - * @return Array - * @access private - */ - function _add($x_value, $x_negative, $y_value, $y_negative) - { - $x_size = count($x_value); - $y_size = count($y_value); - - if ($x_size == 0) { - return array( - MATH_BIGINTEGER_VALUE => $y_value, - MATH_BIGINTEGER_SIGN => $y_negative - ); - } else if ($y_size == 0) { - return array( - MATH_BIGINTEGER_VALUE => $x_value, - MATH_BIGINTEGER_SIGN => $x_negative - ); - } - - // subtract, if appropriate - if ( $x_negative != $y_negative ) { - if ( $x_value == $y_value ) { - return array( - MATH_BIGINTEGER_VALUE => array(), - MATH_BIGINTEGER_SIGN => false - ); - } - - $temp = $this->_subtract($x_value, false, $y_value, false); - $temp[MATH_BIGINTEGER_SIGN] = $this->_compare($x_value, false, $y_value, false) > 0 ? - $x_negative : $y_negative; - - return $temp; - } - - if ($x_size < $y_size) { - $size = $x_size; - $value = $y_value; - } else { - $size = $y_size; - $value = $x_value; - } - - $value[] = 0; // just in case the carry adds an extra digit - - $carry = 0; - for ($i = 0, $j = 1; $j < $size; $i+=2, $j+=2) { - $sum = $x_value[$j] * 0x4000000 + $x_value[$i] + $y_value[$j] * 0x4000000 + $y_value[$i] + $carry; - $carry = $sum >= MATH_BIGINTEGER_MAX_DIGIT52; // eg. floor($sum / 2**52); only possible values (in any base) are 0 and 1 - $sum = $carry ? $sum - MATH_BIGINTEGER_MAX_DIGIT52 : $sum; - - $temp = (int) ($sum / 0x4000000); - - $value[$i] = (int) ($sum - 0x4000000 * $temp); // eg. a faster alternative to fmod($sum, 0x4000000) - $value[$j] = $temp; - } - - if ($j == $size) { // ie. if $y_size is odd - $sum = $x_value[$i] + $y_value[$i] + $carry; - $carry = $sum >= 0x4000000; - $value[$i] = $carry ? $sum - 0x4000000 : $sum; - ++$i; // ie. let $i = $j since we've just done $value[$i] - } - - if ($carry) { - for (; $value[$i] == 0x3FFFFFF; ++$i) { - $value[$i] = 0; - } - ++$value[$i]; - } - - return array( - MATH_BIGINTEGER_VALUE => $this->_trim($value), - MATH_BIGINTEGER_SIGN => $x_negative - ); - } - - /** - * Subtracts two BigIntegers. - * - * Here's an example: - * <code> - * <?php - * include('Math/BigInteger.php'); - * - * $a = new Math_BigInteger('10'); - * $b = new Math_BigInteger('20'); - * - * $c = $a->subtract($b); - * - * echo $c->toString(); // outputs -10 - * ?> - * </code> - * - * @param Math_BigInteger $y - * @return Math_BigInteger - * @access public - * @internal Performs base-2**52 subtraction - */ - function subtract($y) - { - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - $temp = new Math_BigInteger(); - $temp->value = gmp_sub($this->value, $y->value); - - return $this->_normalize($temp); - case MATH_BIGINTEGER_MODE_BCMATH: - $temp = new Math_BigInteger(); - $temp->value = bcsub($this->value, $y->value, 0); - - return $this->_normalize($temp); - } - - $temp = $this->_subtract($this->value, $this->is_negative, $y->value, $y->is_negative); - - $result = new Math_BigInteger(); - $result->value = $temp[MATH_BIGINTEGER_VALUE]; - $result->is_negative = $temp[MATH_BIGINTEGER_SIGN]; - - return $this->_normalize($result); - } - - /** - * Performs subtraction. - * - * @param Array $x_value - * @param Boolean $x_negative - * @param Array $y_value - * @param Boolean $y_negative - * @return Array - * @access private - */ - function _subtract($x_value, $x_negative, $y_value, $y_negative) - { - $x_size = count($x_value); - $y_size = count($y_value); - - if ($x_size == 0) { - return array( - MATH_BIGINTEGER_VALUE => $y_value, - MATH_BIGINTEGER_SIGN => !$y_negative - ); - } else if ($y_size == 0) { - return array( - MATH_BIGINTEGER_VALUE => $x_value, - MATH_BIGINTEGER_SIGN => $x_negative - ); - } - - // add, if appropriate (ie. -$x - +$y or +$x - -$y) - if ( $x_negative != $y_negative ) { - $temp = $this->_add($x_value, false, $y_value, false); - $temp[MATH_BIGINTEGER_SIGN] = $x_negative; - - return $temp; - } - - $diff = $this->_compare($x_value, $x_negative, $y_value, $y_negative); - - if ( !$diff ) { - return array( - MATH_BIGINTEGER_VALUE => array(), - MATH_BIGINTEGER_SIGN => false - ); - } - - // switch $x and $y around, if appropriate. - if ( (!$x_negative && $diff < 0) || ($x_negative && $diff > 0) ) { - $temp = $x_value; - $x_value = $y_value; - $y_value = $temp; - - $x_negative = !$x_negative; - - $x_size = count($x_value); - $y_size = count($y_value); - } - - // at this point, $x_value should be at least as big as - if not bigger than - $y_value - - $carry = 0; - for ($i = 0, $j = 1; $j < $y_size; $i+=2, $j+=2) { - $sum = $x_value[$j] * 0x4000000 + $x_value[$i] - $y_value[$j] * 0x4000000 - $y_value[$i] - $carry; - $carry = $sum < 0; // eg. floor($sum / 2**52); only possible values (in any base) are 0 and 1 - $sum = $carry ? $sum + MATH_BIGINTEGER_MAX_DIGIT52 : $sum; - - $temp = (int) ($sum / 0x4000000); - - $x_value[$i] = (int) ($sum - 0x4000000 * $temp); - $x_value[$j] = $temp; - } - - if ($j == $y_size) { // ie. if $y_size is odd - $sum = $x_value[$i] - $y_value[$i] - $carry; - $carry = $sum < 0; - $x_value[$i] = $carry ? $sum + 0x4000000 : $sum; - ++$i; - } - - if ($carry) { - for (; !$x_value[$i]; ++$i) { - $x_value[$i] = 0x3FFFFFF; - } - --$x_value[$i]; - } - - return array( - MATH_BIGINTEGER_VALUE => $this->_trim($x_value), - MATH_BIGINTEGER_SIGN => $x_negative - ); - } - - /** - * Multiplies two BigIntegers - * - * Here's an example: - * <code> - * <?php - * include('Math/BigInteger.php'); - * - * $a = new Math_BigInteger('10'); - * $b = new Math_BigInteger('20'); - * - * $c = $a->multiply($b); - * - * echo $c->toString(); // outputs 200 - * ?> - * </code> - * - * @param Math_BigInteger $x - * @return Math_BigInteger - * @access public - */ - function multiply($x) - { - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - $temp = new Math_BigInteger(); - $temp->value = gmp_mul($this->value, $x->value); - - return $this->_normalize($temp); - case MATH_BIGINTEGER_MODE_BCMATH: - $temp = new Math_BigInteger(); - $temp->value = bcmul($this->value, $x->value, 0); - - return $this->_normalize($temp); - } - - $temp = $this->_multiply($this->value, $this->is_negative, $x->value, $x->is_negative); - - $product = new Math_BigInteger(); - $product->value = $temp[MATH_BIGINTEGER_VALUE]; - $product->is_negative = $temp[MATH_BIGINTEGER_SIGN]; - - return $this->_normalize($product); - } - - /** - * Performs multiplication. - * - * @param Array $x_value - * @param Boolean $x_negative - * @param Array $y_value - * @param Boolean $y_negative - * @return Array - * @access private - */ - function _multiply($x_value, $x_negative, $y_value, $y_negative) - { - //if ( $x_value == $y_value ) { - // return array( - // MATH_BIGINTEGER_VALUE => $this->_square($x_value), - // MATH_BIGINTEGER_SIGN => $x_sign != $y_value - // ); - //} - - $x_length = count($x_value); - $y_length = count($y_value); - - if ( !$x_length || !$y_length ) { // a 0 is being multiplied - return array( - MATH_BIGINTEGER_VALUE => array(), - MATH_BIGINTEGER_SIGN => false - ); - } - - return array( - MATH_BIGINTEGER_VALUE => min($x_length, $y_length) < 2 * MATH_BIGINTEGER_KARATSUBA_CUTOFF ? - $this->_trim($this->_regularMultiply($x_value, $y_value)) : - $this->_trim($this->_karatsuba($x_value, $y_value)), - MATH_BIGINTEGER_SIGN => $x_negative != $y_negative - ); - } - - /** - * Performs long multiplication on two BigIntegers - * - * Modeled after 'multiply' in MutableBigInteger.java. - * - * @param Array $x_value - * @param Array $y_value - * @return Array - * @access private - */ - function _regularMultiply($x_value, $y_value) - { - $x_length = count($x_value); - $y_length = count($y_value); - - if ( !$x_length || !$y_length ) { // a 0 is being multiplied - return array(); - } - - if ( $x_length < $y_length ) { - $temp = $x_value; - $x_value = $y_value; - $y_value = $temp; - - $x_length = count($x_value); - $y_length = count($y_value); - } - - $product_value = $this->_array_repeat(0, $x_length + $y_length); - - // the following for loop could be removed if the for loop following it - // (the one with nested for loops) initially set $i to 0, but - // doing so would also make the result in one set of unnecessary adds, - // since on the outermost loops first pass, $product->value[$k] is going - // to always be 0 - - $carry = 0; - - for ($j = 0; $j < $x_length; ++$j) { // ie. $i = 0 - $temp = $x_value[$j] * $y_value[0] + $carry; // $product_value[$k] == 0 - $carry = (int) ($temp / 0x4000000); - $product_value[$j] = (int) ($temp - 0x4000000 * $carry); - } - - $product_value[$j] = $carry; - - // the above for loop is what the previous comment was talking about. the - // following for loop is the "one with nested for loops" - for ($i = 1; $i < $y_length; ++$i) { - $carry = 0; - - for ($j = 0, $k = $i; $j < $x_length; ++$j, ++$k) { - $temp = $product_value[$k] + $x_value[$j] * $y_value[$i] + $carry; - $carry = (int) ($temp / 0x4000000); - $product_value[$k] = (int) ($temp - 0x4000000 * $carry); - } - - $product_value[$k] = $carry; - } - - return $product_value; - } - - /** - * Performs Karatsuba multiplication on two BigIntegers - * - * See {@link http://en.wikipedia.org/wiki/Karatsuba_algorithm Karatsuba algorithm} and - * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=120 MPM 5.2.3}. - * - * @param Array $x_value - * @param Array $y_value - * @return Array - * @access private - */ - function _karatsuba($x_value, $y_value) - { - $m = min(count($x_value) >> 1, count($y_value) >> 1); - - if ($m < MATH_BIGINTEGER_KARATSUBA_CUTOFF) { - return $this->_regularMultiply($x_value, $y_value); - } - - $x1 = array_slice($x_value, $m); - $x0 = array_slice($x_value, 0, $m); - $y1 = array_slice($y_value, $m); - $y0 = array_slice($y_value, 0, $m); - - $z2 = $this->_karatsuba($x1, $y1); - $z0 = $this->_karatsuba($x0, $y0); - - $z1 = $this->_add($x1, false, $x0, false); - $temp = $this->_add($y1, false, $y0, false); - $z1 = $this->_karatsuba($z1[MATH_BIGINTEGER_VALUE], $temp[MATH_BIGINTEGER_VALUE]); - $temp = $this->_add($z2, false, $z0, false); - $z1 = $this->_subtract($z1, false, $temp[MATH_BIGINTEGER_VALUE], false); - - $z2 = array_merge(array_fill(0, 2 * $m, 0), $z2); - $z1[MATH_BIGINTEGER_VALUE] = array_merge(array_fill(0, $m, 0), $z1[MATH_BIGINTEGER_VALUE]); - - $xy = $this->_add($z2, false, $z1[MATH_BIGINTEGER_VALUE], $z1[MATH_BIGINTEGER_SIGN]); - $xy = $this->_add($xy[MATH_BIGINTEGER_VALUE], $xy[MATH_BIGINTEGER_SIGN], $z0, false); - - return $xy[MATH_BIGINTEGER_VALUE]; - } - - /** - * Performs squaring - * - * @param Array $x - * @return Array - * @access private - */ - function _square($x = false) - { - return count($x) < 2 * MATH_BIGINTEGER_KARATSUBA_CUTOFF ? - $this->_trim($this->_baseSquare($x)) : - $this->_trim($this->_karatsubaSquare($x)); - } - - /** - * Performs traditional squaring on two BigIntegers - * - * Squaring can be done faster than multiplying a number by itself can be. See - * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=7 HAC 14.2.4} / - * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=141 MPM 5.3} for more information. - * - * @param Array $value - * @return Array - * @access private - */ - function _baseSquare($value) - { - if ( empty($value) ) { - return array(); - } - $square_value = $this->_array_repeat(0, 2 * count($value)); - - for ($i = 0, $max_index = count($value) - 1; $i <= $max_index; ++$i) { - $i2 = $i << 1; - - $temp = $square_value[$i2] + $value[$i] * $value[$i]; - $carry = (int) ($temp / 0x4000000); - $square_value[$i2] = (int) ($temp - 0x4000000 * $carry); - - // note how we start from $i+1 instead of 0 as we do in multiplication. - for ($j = $i + 1, $k = $i2 + 1; $j <= $max_index; ++$j, ++$k) { - $temp = $square_value[$k] + 2 * $value[$j] * $value[$i] + $carry; - $carry = (int) ($temp / 0x4000000); - $square_value[$k] = (int) ($temp - 0x4000000 * $carry); - } - - // the following line can yield values larger 2**15. at this point, PHP should switch - // over to floats. - $square_value[$i + $max_index + 1] = $carry; - } - - return $square_value; - } - - /** - * Performs Karatsuba "squaring" on two BigIntegers - * - * See {@link http://en.wikipedia.org/wiki/Karatsuba_algorithm Karatsuba algorithm} and - * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=151 MPM 5.3.4}. - * - * @param Array $value - * @return Array - * @access private - */ - function _karatsubaSquare($value) - { - $m = count($value) >> 1; - - if ($m < MATH_BIGINTEGER_KARATSUBA_CUTOFF) { - return $this->_baseSquare($value); - } - - $x1 = array_slice($value, $m); - $x0 = array_slice($value, 0, $m); - - $z2 = $this->_karatsubaSquare($x1); - $z0 = $this->_karatsubaSquare($x0); - - $z1 = $this->_add($x1, false, $x0, false); - $z1 = $this->_karatsubaSquare($z1[MATH_BIGINTEGER_VALUE]); - $temp = $this->_add($z2, false, $z0, false); - $z1 = $this->_subtract($z1, false, $temp[MATH_BIGINTEGER_VALUE], false); - - $z2 = array_merge(array_fill(0, 2 * $m, 0), $z2); - $z1[MATH_BIGINTEGER_VALUE] = array_merge(array_fill(0, $m, 0), $z1[MATH_BIGINTEGER_VALUE]); - - $xx = $this->_add($z2, false, $z1[MATH_BIGINTEGER_VALUE], $z1[MATH_BIGINTEGER_SIGN]); - $xx = $this->_add($xx[MATH_BIGINTEGER_VALUE], $xx[MATH_BIGINTEGER_SIGN], $z0, false); - - return $xx[MATH_BIGINTEGER_VALUE]; - } - - /** - * Divides two BigIntegers. - * - * Returns an array whose first element contains the quotient and whose second element contains the - * "common residue". If the remainder would be positive, the "common residue" and the remainder are the - * same. If the remainder would be negative, the "common residue" is equal to the sum of the remainder - * and the divisor (basically, the "common residue" is the first positive modulo). - * - * Here's an example: - * <code> - * <?php - * include('Math/BigInteger.php'); - * - * $a = new Math_BigInteger('10'); - * $b = new Math_BigInteger('20'); - * - * list($quotient, $remainder) = $a->divide($b); - * - * echo $quotient->toString(); // outputs 0 - * echo "\r\n"; - * echo $remainder->toString(); // outputs 10 - * ?> - * </code> - * - * @param Math_BigInteger $y - * @return Array - * @access public - * @internal This function is based off of {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=9 HAC 14.20}. - */ - function divide($y) - { - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - $quotient = new Math_BigInteger(); - $remainder = new Math_BigInteger(); - - list($quotient->value, $remainder->value) = gmp_div_qr($this->value, $y->value); - - if (gmp_sign($remainder->value) < 0) { - $remainder->value = gmp_add($remainder->value, gmp_abs($y->value)); - } - - return array($this->_normalize($quotient), $this->_normalize($remainder)); - case MATH_BIGINTEGER_MODE_BCMATH: - $quotient = new Math_BigInteger(); - $remainder = new Math_BigInteger(); - - $quotient->value = bcdiv($this->value, $y->value, 0); - $remainder->value = bcmod($this->value, $y->value); - - if ($remainder->value[0] == '-') { - $remainder->value = bcadd($remainder->value, $y->value[0] == '-' ? substr($y->value, 1) : $y->value, 0); - } - - return array($this->_normalize($quotient), $this->_normalize($remainder)); - } - - if (count($y->value) == 1) { - list($q, $r) = $this->_divide_digit($this->value, $y->value[0]); - $quotient = new Math_BigInteger(); - $remainder = new Math_BigInteger(); - $quotient->value = $q; - $remainder->value = array($r); - $quotient->is_negative = $this->is_negative != $y->is_negative; - return array($this->_normalize($quotient), $this->_normalize($remainder)); - } - - static $zero; - if ( !isset($zero) ) { - $zero = new Math_BigInteger(); - } - - $x = $this->copy(); - $y = $y->copy(); - - $x_sign = $x->is_negative; - $y_sign = $y->is_negative; - - $x->is_negative = $y->is_negative = false; - - $diff = $x->compare($y); - - if ( !$diff ) { - $temp = new Math_BigInteger(); - $temp->value = array(1); - $temp->is_negative = $x_sign != $y_sign; - return array($this->_normalize($temp), $this->_normalize(new Math_BigInteger())); - } - - if ( $diff < 0 ) { - // if $x is negative, "add" $y. - if ( $x_sign ) { - $x = $y->subtract($x); - } - return array($this->_normalize(new Math_BigInteger()), $this->_normalize($x)); - } - - // normalize $x and $y as described in HAC 14.23 / 14.24 - $msb = $y->value[count($y->value) - 1]; - for ($shift = 0; !($msb & 0x2000000); ++$shift) { - $msb <<= 1; - } - $x->_lshift($shift); - $y->_lshift($shift); - $y_value = &$y->value; - - $x_max = count($x->value) - 1; - $y_max = count($y->value) - 1; - - $quotient = new Math_BigInteger(); - $quotient_value = &$quotient->value; - $quotient_value = $this->_array_repeat(0, $x_max - $y_max + 1); - - static $temp, $lhs, $rhs; - if (!isset($temp)) { - $temp = new Math_BigInteger(); - $lhs = new Math_BigInteger(); - $rhs = new Math_BigInteger(); - } - $temp_value = &$temp->value; - $rhs_value = &$rhs->value; - - // $temp = $y << ($x_max - $y_max-1) in base 2**26 - $temp_value = array_merge($this->_array_repeat(0, $x_max - $y_max), $y_value); - - while ( $x->compare($temp) >= 0 ) { - // calculate the "common residue" - ++$quotient_value[$x_max - $y_max]; - $x = $x->subtract($temp); - $x_max = count($x->value) - 1; - } - - for ($i = $x_max; $i >= $y_max + 1; --$i) { - $x_value = &$x->value; - $x_window = array( - isset($x_value[$i]) ? $x_value[$i] : 0, - isset($x_value[$i - 1]) ? $x_value[$i - 1] : 0, - isset($x_value[$i - 2]) ? $x_value[$i - 2] : 0 - ); - $y_window = array( - $y_value[$y_max], - ( $y_max > 0 ) ? $y_value[$y_max - 1] : 0 - ); - - $q_index = $i - $y_max - 1; - if ($x_window[0] == $y_window[0]) { - $quotient_value[$q_index] = 0x3FFFFFF; - } else { - $quotient_value[$q_index] = (int) ( - ($x_window[0] * 0x4000000 + $x_window[1]) - / - $y_window[0] - ); - } - - $temp_value = array($y_window[1], $y_window[0]); - - $lhs->value = array($quotient_value[$q_index]); - $lhs = $lhs->multiply($temp); - - $rhs_value = array($x_window[2], $x_window[1], $x_window[0]); - - while ( $lhs->compare($rhs) > 0 ) { - --$quotient_value[$q_index]; - - $lhs->value = array($quotient_value[$q_index]); - $lhs = $lhs->multiply($temp); - } - - $adjust = $this->_array_repeat(0, $q_index); - $temp_value = array($quotient_value[$q_index]); - $temp = $temp->multiply($y); - $temp_value = &$temp->value; - $temp_value = array_merge($adjust, $temp_value); - - $x = $x->subtract($temp); - - if ($x->compare($zero) < 0) { - $temp_value = array_merge($adjust, $y_value); - $x = $x->add($temp); - - --$quotient_value[$q_index]; - } - - $x_max = count($x_value) - 1; - } - - // unnormalize the remainder - $x->_rshift($shift); - - $quotient->is_negative = $x_sign != $y_sign; - - // calculate the "common residue", if appropriate - if ( $x_sign ) { - $y->_rshift($shift); - $x = $y->subtract($x); - } - - return array($this->_normalize($quotient), $this->_normalize($x)); - } - - /** - * Divides a BigInteger by a regular integer - * - * abc / x = a00 / x + b0 / x + c / x - * - * @param Array $dividend - * @param Array $divisor - * @return Array - * @access private - */ - function _divide_digit($dividend, $divisor) - { - $carry = 0; - $result = array(); - - for ($i = count($dividend) - 1; $i >= 0; --$i) { - $temp = 0x4000000 * $carry + $dividend[$i]; - $result[$i] = (int) ($temp / $divisor); - $carry = (int) ($temp - $divisor * $result[$i]); - } - - return array($result, $carry); - } - - /** - * Performs modular exponentiation. - * - * Here's an example: - * <code> - * <?php - * include('Math/BigInteger.php'); - * - * $a = new Math_BigInteger('10'); - * $b = new Math_BigInteger('20'); - * $c = new Math_BigInteger('30'); - * - * $c = $a->modPow($b, $c); - * - * echo $c->toString(); // outputs 10 - * ?> - * </code> - * - * @param Math_BigInteger $e - * @param Math_BigInteger $n - * @return Math_BigInteger - * @access public - * @internal The most naive approach to modular exponentiation has very unreasonable requirements, and - * and although the approach involving repeated squaring does vastly better, it, too, is impractical - * for our purposes. The reason being that division - by far the most complicated and time-consuming - * of the basic operations (eg. +,-,*,/) - occurs multiple times within it. - * - * Modular reductions resolve this issue. Although an individual modular reduction takes more time - * then an individual division, when performed in succession (with the same modulo), they're a lot faster. - * - * The two most commonly used modular reductions are Barrett and Montgomery reduction. Montgomery reduction, - * although faster, only works when the gcd of the modulo and of the base being used is 1. In RSA, when the - * base is a power of two, the modulo - a product of two primes - is always going to have a gcd of 1 (because - * the product of two odd numbers is odd), but what about when RSA isn't used? - * - * In contrast, Barrett reduction has no such constraint. As such, some bigint implementations perform a - * Barrett reduction after every operation in the modpow function. Others perform Barrett reductions when the - * modulo is even and Montgomery reductions when the modulo is odd. BigInteger.java's modPow method, however, - * uses a trick involving the Chinese Remainder Theorem to factor the even modulo into two numbers - one odd and - * the other, a power of two - and recombine them, later. This is the method that this modPow function uses. - * {@link http://islab.oregonstate.edu/papers/j34monex.pdf Montgomery Reduction with Even Modulus} elaborates. - */ - function modPow($e, $n) - { - $n = $this->bitmask !== false && $this->bitmask->compare($n) < 0 ? $this->bitmask : $n->abs(); - - if ($e->compare(new Math_BigInteger()) < 0) { - $e = $e->abs(); - - $temp = $this->modInverse($n); - if ($temp === false) { - return false; - } - - return $this->_normalize($temp->modPow($e, $n)); - } - - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - $temp = new Math_BigInteger(); - $temp->value = gmp_powm($this->value, $e->value, $n->value); - - return $this->_normalize($temp); - case MATH_BIGINTEGER_MODE_BCMATH: - $temp = new Math_BigInteger(); - $temp->value = bcpowmod($this->value, $e->value, $n->value, 0); - - return $this->_normalize($temp); - } - - if ( empty($e->value) ) { - $temp = new Math_BigInteger(); - $temp->value = array(1); - return $this->_normalize($temp); - } - - if ( $e->value == array(1) ) { - list(, $temp) = $this->divide($n); - return $this->_normalize($temp); - } - - if ( $e->value == array(2) ) { - $temp = new Math_BigInteger(); - $temp->value = $this->_square($this->value); - list(, $temp) = $temp->divide($n); - return $this->_normalize($temp); - } - - return $this->_normalize($this->_slidingWindow($e, $n, MATH_BIGINTEGER_BARRETT)); - - // is the modulo odd? - if ( $n->value[0] & 1 ) { - return $this->_normalize($this->_slidingWindow($e, $n, MATH_BIGINTEGER_MONTGOMERY)); - } - // if it's not, it's even - - // find the lowest set bit (eg. the max pow of 2 that divides $n) - for ($i = 0; $i < count($n->value); ++$i) { - if ( $n->value[$i] ) { - $temp = decbin($n->value[$i]); - $j = strlen($temp) - strrpos($temp, '1') - 1; - $j+= 26 * $i; - break; - } - } - // at this point, 2^$j * $n/(2^$j) == $n - - $mod1 = $n->copy(); - $mod1->_rshift($j); - $mod2 = new Math_BigInteger(); - $mod2->value = array(1); - $mod2->_lshift($j); - - $part1 = ( $mod1->value != array(1) ) ? $this->_slidingWindow($e, $mod1, MATH_BIGINTEGER_MONTGOMERY) : new Math_BigInteger(); - $part2 = $this->_slidingWindow($e, $mod2, MATH_BIGINTEGER_POWEROF2); - - $y1 = $mod2->modInverse($mod1); - $y2 = $mod1->modInverse($mod2); - - $result = $part1->multiply($mod2); - $result = $result->multiply($y1); - - $temp = $part2->multiply($mod1); - $temp = $temp->multiply($y2); - - $result = $result->add($temp); - list(, $result) = $result->divide($n); - - return $this->_normalize($result); - } - - /** - * Performs modular exponentiation. - * - * Alias for Math_BigInteger::modPow() - * - * @param Math_BigInteger $e - * @param Math_BigInteger $n - * @return Math_BigInteger - * @access public - */ - function powMod($e, $n) - { - return $this->modPow($e, $n); - } - - /** - * Sliding Window k-ary Modular Exponentiation - * - * Based on {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=27 HAC 14.85} / - * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=210 MPM 7.7}. In a departure from those algorithims, - * however, this function performs a modular reduction after every multiplication and squaring operation. - * As such, this function has the same preconditions that the reductions being used do. - * - * @param Math_BigInteger $e - * @param Math_BigInteger $n - * @param Integer $mode - * @return Math_BigInteger - * @access private - */ - function _slidingWindow($e, $n, $mode) - { - static $window_ranges = array(7, 25, 81, 241, 673, 1793); // from BigInteger.java's oddModPow function - //static $window_ranges = array(0, 7, 36, 140, 450, 1303, 3529); // from MPM 7.3.1 - - $e_value = $e->value; - $e_length = count($e_value) - 1; - $e_bits = decbin($e_value[$e_length]); - for ($i = $e_length - 1; $i >= 0; --$i) { - $e_bits.= str_pad(decbin($e_value[$i]), 26, '0', STR_PAD_LEFT); - } - - $e_length = strlen($e_bits); - - // calculate the appropriate window size. - // $window_size == 3 if $window_ranges is between 25 and 81, for example. - for ($i = 0, $window_size = 1; $e_length > $window_ranges[$i] && $i < count($window_ranges); ++$window_size, ++$i); - - $n_value = $n->value; - - // precompute $this^0 through $this^$window_size - $powers = array(); - $powers[1] = $this->_prepareReduce($this->value, $n_value, $mode); - $powers[2] = $this->_squareReduce($powers[1], $n_value, $mode); - - // we do every other number since substr($e_bits, $i, $j+1) (see below) is supposed to end - // in a 1. ie. it's supposed to be odd. - $temp = 1 << ($window_size - 1); - for ($i = 1; $i < $temp; ++$i) { - $i2 = $i << 1; - $powers[$i2 + 1] = $this->_multiplyReduce($powers[$i2 - 1], $powers[2], $n_value, $mode); - } - - $result = array(1); - $result = $this->_prepareReduce($result, $n_value, $mode); - - for ($i = 0; $i < $e_length; ) { - if ( !$e_bits[$i] ) { - $result = $this->_squareReduce($result, $n_value, $mode); - ++$i; - } else { - for ($j = $window_size - 1; $j > 0; --$j) { - if ( !empty($e_bits[$i + $j]) ) { - break; - } - } - - for ($k = 0; $k <= $j; ++$k) {// eg. the length of substr($e_bits, $i, $j+1) - $result = $this->_squareReduce($result, $n_value, $mode); - } - - $result = $this->_multiplyReduce($result, $powers[bindec(substr($e_bits, $i, $j + 1))], $n_value, $mode); - - $i+=$j + 1; - } - } - - $temp = new Math_BigInteger(); - $temp->value = $this->_reduce($result, $n_value, $mode); - - return $temp; - } - - /** - * Modular reduction - * - * For most $modes this will return the remainder. - * - * @see _slidingWindow() - * @access private - * @param Array $x - * @param Array $n - * @param Integer $mode - * @return Array - */ - function _reduce($x, $n, $mode) - { - switch ($mode) { - case MATH_BIGINTEGER_MONTGOMERY: - return $this->_montgomery($x, $n); - case MATH_BIGINTEGER_BARRETT: - return $this->_barrett($x, $n); - case MATH_BIGINTEGER_POWEROF2: - $lhs = new Math_BigInteger(); - $lhs->value = $x; - $rhs = new Math_BigInteger(); - $rhs->value = $n; - return $x->_mod2($n); - case MATH_BIGINTEGER_CLASSIC: - $lhs = new Math_BigInteger(); - $lhs->value = $x; - $rhs = new Math_BigInteger(); - $rhs->value = $n; - list(, $temp) = $lhs->divide($rhs); - return $temp->value; - case MATH_BIGINTEGER_NONE: - return $x; - default: - // an invalid $mode was provided - } - } - - /** - * Modular reduction preperation - * - * @see _slidingWindow() - * @access private - * @param Array $x - * @param Array $n - * @param Integer $mode - * @return Array - */ - function _prepareReduce($x, $n, $mode) - { - if ($mode == MATH_BIGINTEGER_MONTGOMERY) { - return $this->_prepMontgomery($x, $n); - } - return $this->_reduce($x, $n, $mode); - } - - /** - * Modular multiply - * - * @see _slidingWindow() - * @access private - * @param Array $x - * @param Array $y - * @param Array $n - * @param Integer $mode - * @return Array - */ - function _multiplyReduce($x, $y, $n, $mode) - { - if ($mode == MATH_BIGINTEGER_MONTGOMERY) { - return $this->_montgomeryMultiply($x, $y, $n); - } - $temp = $this->_multiply($x, false, $y, false); - return $this->_reduce($temp[MATH_BIGINTEGER_VALUE], $n, $mode); - } - - /** - * Modular square - * - * @see _slidingWindow() - * @access private - * @param Array $x - * @param Array $n - * @param Integer $mode - * @return Array - */ - function _squareReduce($x, $n, $mode) - { - if ($mode == MATH_BIGINTEGER_MONTGOMERY) { - return $this->_montgomeryMultiply($x, $x, $n); - } - return $this->_reduce($this->_square($x), $n, $mode); - } - - /** - * Modulos for Powers of Two - * - * Calculates $x%$n, where $n = 2**$e, for some $e. Since this is basically the same as doing $x & ($n-1), - * we'll just use this function as a wrapper for doing that. - * - * @see _slidingWindow() - * @access private - * @param Math_BigInteger - * @return Math_BigInteger - */ - function _mod2($n) - { - $temp = new Math_BigInteger(); - $temp->value = array(1); - return $this->bitwise_and($n->subtract($temp)); - } - - /** - * Barrett Modular Reduction - * - * See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=14 HAC 14.3.3} / - * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=165 MPM 6.2.5} for more information. Modified slightly, - * so as not to require negative numbers (initially, this script didn't support negative numbers). - * - * Employs "folding", as described at - * {@link http://www.cosic.esat.kuleuven.be/publications/thesis-149.pdf#page=66 thesis-149.pdf#page=66}. To quote from - * it, "the idea [behind folding] is to find a value x' such that x (mod m) = x' (mod m), with x' being smaller than x." - * - * Unfortunately, the "Barrett Reduction with Folding" algorithm described in thesis-149.pdf is not, as written, all that - * usable on account of (1) its not using reasonable radix points as discussed in - * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=162 MPM 6.2.2} and (2) the fact that, even with reasonable - * radix points, it only works when there are an even number of digits in the denominator. The reason for (2) is that - * (x >> 1) + (x >> 1) != x / 2 + x / 2. If x is even, they're the same, but if x is odd, they're not. See the in-line - * comments for details. - * - * @see _slidingWindow() - * @access private - * @param Array $n - * @param Array $m - * @return Array - */ - function _barrett($n, $m) - { - static $cache = array( - MATH_BIGINTEGER_VARIABLE => array(), - MATH_BIGINTEGER_DATA => array() - ); - - $m_length = count($m); - - // if ($this->_compare($n, $this->_square($m)) >= 0) { - if (count($n) > 2 * $m_length) { - $lhs = new Math_BigInteger(); - $rhs = new Math_BigInteger(); - $lhs->value = $n; - $rhs->value = $m; - list(, $temp) = $lhs->divide($rhs); - return $temp->value; - } - - // if (m.length >> 1) + 2 <= m.length then m is too small and n can't be reduced - if ($m_length < 5) { - return $this->_regularBarrett($n, $m); - } - - // n = 2 * m.length - - if ( ($key = array_search($m, $cache[MATH_BIGINTEGER_VARIABLE])) === false ) { - $key = count($cache[MATH_BIGINTEGER_VARIABLE]); - $cache[MATH_BIGINTEGER_VARIABLE][] = $m; - - $lhs = new Math_BigInteger(); - $lhs_value = &$lhs->value; - $lhs_value = $this->_array_repeat(0, $m_length + ($m_length >> 1)); - $lhs_value[] = 1; - $rhs = new Math_BigInteger(); - $rhs->value = $m; - - list($u, $m1) = $lhs->divide($rhs); - $u = $u->value; - $m1 = $m1->value; - - $cache[MATH_BIGINTEGER_DATA][] = array( - 'u' => $u, // m.length >> 1 (technically (m.length >> 1) + 1) - 'm1'=> $m1 // m.length - ); - } else { - extract($cache[MATH_BIGINTEGER_DATA][$key]); - } - - $cutoff = $m_length + ($m_length >> 1); - $lsd = array_slice($n, 0, $cutoff); // m.length + (m.length >> 1) - $msd = array_slice($n, $cutoff); // m.length >> 1 - $lsd = $this->_trim($lsd); - $temp = $this->_multiply($msd, false, $m1, false); - $n = $this->_add($lsd, false, $temp[MATH_BIGINTEGER_VALUE], false); // m.length + (m.length >> 1) + 1 - - if ($m_length & 1) { - return $this->_regularBarrett($n[MATH_BIGINTEGER_VALUE], $m); - } - - // (m.length + (m.length >> 1) + 1) - (m.length - 1) == (m.length >> 1) + 2 - $temp = array_slice($n[MATH_BIGINTEGER_VALUE], $m_length - 1); - // if even: ((m.length >> 1) + 2) + (m.length >> 1) == m.length + 2 - // if odd: ((m.length >> 1) + 2) + (m.length >> 1) == (m.length - 1) + 2 == m.length + 1 - $temp = $this->_multiply($temp, false, $u, false); - // if even: (m.length + 2) - ((m.length >> 1) + 1) = m.length - (m.length >> 1) + 1 - // if odd: (m.length + 1) - ((m.length >> 1) + 1) = m.length - (m.length >> 1) - $temp = array_slice($temp[MATH_BIGINTEGER_VALUE], ($m_length >> 1) + 1); - // if even: (m.length - (m.length >> 1) + 1) + m.length = 2 * m.length - (m.length >> 1) + 1 - // if odd: (m.length - (m.length >> 1)) + m.length = 2 * m.length - (m.length >> 1) - $temp = $this->_multiply($temp, false, $m, false); - - // at this point, if m had an odd number of digits, we'd be subtracting a 2 * m.length - (m.length >> 1) digit - // number from a m.length + (m.length >> 1) + 1 digit number. ie. there'd be an extra digit and the while loop - // following this comment would loop a lot (hence our calling _regularBarrett() in that situation). - - $result = $this->_subtract($n[MATH_BIGINTEGER_VALUE], false, $temp[MATH_BIGINTEGER_VALUE], false); - - while ($this->_compare($result[MATH_BIGINTEGER_VALUE], $result[MATH_BIGINTEGER_SIGN], $m, false) >= 0) { - $result = $this->_subtract($result[MATH_BIGINTEGER_VALUE], $result[MATH_BIGINTEGER_SIGN], $m, false); - } - - return $result[MATH_BIGINTEGER_VALUE]; - } - - /** - * (Regular) Barrett Modular Reduction - * - * For numbers with more than four digits Math_BigInteger::_barrett() is faster. The difference between that and this - * is that this function does not fold the denominator into a smaller form. - * - * @see _slidingWindow() - * @access private - * @param Array $x - * @param Array $n - * @return Array - */ - function _regularBarrett($x, $n) - { - static $cache = array( - MATH_BIGINTEGER_VARIABLE => array(), - MATH_BIGINTEGER_DATA => array() - ); - - $n_length = count($n); - - if (count($x) > 2 * $n_length) { - $lhs = new Math_BigInteger(); - $rhs = new Math_BigInteger(); - $lhs->value = $x; - $rhs->value = $n; - list(, $temp) = $lhs->divide($rhs); - return $temp->value; - } - - if ( ($key = array_search($n, $cache[MATH_BIGINTEGER_VARIABLE])) === false ) { - $key = count($cache[MATH_BIGINTEGER_VARIABLE]); - $cache[MATH_BIGINTEGER_VARIABLE][] = $n; - $lhs = new Math_BigInteger(); - $lhs_value = &$lhs->value; - $lhs_value = $this->_array_repeat(0, 2 * $n_length); - $lhs_value[] = 1; - $rhs = new Math_BigInteger(); - $rhs->value = $n; - list($temp, ) = $lhs->divide($rhs); // m.length - $cache[MATH_BIGINTEGER_DATA][] = $temp->value; - } - - // 2 * m.length - (m.length - 1) = m.length + 1 - $temp = array_slice($x, $n_length - 1); - // (m.length + 1) + m.length = 2 * m.length + 1 - $temp = $this->_multiply($temp, false, $cache[MATH_BIGINTEGER_DATA][$key], false); - // (2 * m.length + 1) - (m.length - 1) = m.length + 2 - $temp = array_slice($temp[MATH_BIGINTEGER_VALUE], $n_length + 1); - - // m.length + 1 - $result = array_slice($x, 0, $n_length + 1); - // m.length + 1 - $temp = $this->_multiplyLower($temp, false, $n, false, $n_length + 1); - // $temp == array_slice($temp->_multiply($temp, false, $n, false)->value, 0, $n_length + 1) - - if ($this->_compare($result, false, $temp[MATH_BIGINTEGER_VALUE], $temp[MATH_BIGINTEGER_SIGN]) < 0) { - $corrector_value = $this->_array_repeat(0, $n_length + 1); - $corrector_value[] = 1; - $result = $this->_add($result, false, $corrector, false); - $result = $result[MATH_BIGINTEGER_VALUE]; - } - - // at this point, we're subtracting a number with m.length + 1 digits from another number with m.length + 1 digits - $result = $this->_subtract($result, false, $temp[MATH_BIGINTEGER_VALUE], $temp[MATH_BIGINTEGER_SIGN]); - while ($this->_compare($result[MATH_BIGINTEGER_VALUE], $result[MATH_BIGINTEGER_SIGN], $n, false) > 0) { - $result = $this->_subtract($result[MATH_BIGINTEGER_VALUE], $result[MATH_BIGINTEGER_SIGN], $n, false); - } - - return $result[MATH_BIGINTEGER_VALUE]; - } - - /** - * Performs long multiplication up to $stop digits - * - * If you're going to be doing array_slice($product->value, 0, $stop), some cycles can be saved. - * - * @see _regularBarrett() - * @param Array $x_value - * @param Boolean $x_negative - * @param Array $y_value - * @param Boolean $y_negative - * @return Array - * @access private - */ - function _multiplyLower($x_value, $x_negative, $y_value, $y_negative, $stop) - { - $x_length = count($x_value); - $y_length = count($y_value); - - if ( !$x_length || !$y_length ) { // a 0 is being multiplied - return array( - MATH_BIGINTEGER_VALUE => array(), - MATH_BIGINTEGER_SIGN => false - ); - } - - if ( $x_length < $y_length ) { - $temp = $x_value; - $x_value = $y_value; - $y_value = $temp; - - $x_length = count($x_value); - $y_length = count($y_value); - } - - $product_value = $this->_array_repeat(0, $x_length + $y_length); - - // the following for loop could be removed if the for loop following it - // (the one with nested for loops) initially set $i to 0, but - // doing so would also make the result in one set of unnecessary adds, - // since on the outermost loops first pass, $product->value[$k] is going - // to always be 0 - - $carry = 0; - - for ($j = 0; $j < $x_length; ++$j) { // ie. $i = 0, $k = $i - $temp = $x_value[$j] * $y_value[0] + $carry; // $product_value[$k] == 0 - $carry = (int) ($temp / 0x4000000); - $product_value[$j] = (int) ($temp - 0x4000000 * $carry); - } - - if ($j < $stop) { - $product_value[$j] = $carry; - } - - // the above for loop is what the previous comment was talking about. the - // following for loop is the "one with nested for loops" - - for ($i = 1; $i < $y_length; ++$i) { - $carry = 0; - - for ($j = 0, $k = $i; $j < $x_length && $k < $stop; ++$j, ++$k) { - $temp = $product_value[$k] + $x_value[$j] * $y_value[$i] + $carry; - $carry = (int) ($temp / 0x4000000); - $product_value[$k] = (int) ($temp - 0x4000000 * $carry); - } - - if ($k < $stop) { - $product_value[$k] = $carry; - } - } - - return array( - MATH_BIGINTEGER_VALUE => $this->_trim($product_value), - MATH_BIGINTEGER_SIGN => $x_negative != $y_negative - ); - } - - /** - * Montgomery Modular Reduction - * - * ($x->_prepMontgomery($n))->_montgomery($n) yields $x % $n. - * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=170 MPM 6.3} provides insights on how this can be - * improved upon (basically, by using the comba method). gcd($n, 2) must be equal to one for this function - * to work correctly. - * - * @see _prepMontgomery() - * @see _slidingWindow() - * @access private - * @param Array $x - * @param Array $n - * @return Array - */ - function _montgomery($x, $n) - { - static $cache = array( - MATH_BIGINTEGER_VARIABLE => array(), - MATH_BIGINTEGER_DATA => array() - ); - - if ( ($key = array_search($n, $cache[MATH_BIGINTEGER_VARIABLE])) === false ) { - $key = count($cache[MATH_BIGINTEGER_VARIABLE]); - $cache[MATH_BIGINTEGER_VARIABLE][] = $x; - $cache[MATH_BIGINTEGER_DATA][] = $this->_modInverse67108864($n); - } - - $k = count($n); - - $result = array(MATH_BIGINTEGER_VALUE => $x); - - for ($i = 0; $i < $k; ++$i) { - $temp = $result[MATH_BIGINTEGER_VALUE][$i] * $cache[MATH_BIGINTEGER_DATA][$key]; - $temp = (int) ($temp - 0x4000000 * ((int) ($temp / 0x4000000))); - $temp = $this->_regularMultiply(array($temp), $n); - $temp = array_merge($this->_array_repeat(0, $i), $temp); - $result = $this->_add($result[MATH_BIGINTEGER_VALUE], false, $temp, false); - } - - $result[MATH_BIGINTEGER_VALUE] = array_slice($result[MATH_BIGINTEGER_VALUE], $k); - - if ($this->_compare($result, false, $n, false) >= 0) { - $result = $this->_subtract($result[MATH_BIGINTEGER_VALUE], false, $n, false); - } - - return $result[MATH_BIGINTEGER_VALUE]; - } - - /** - * Montgomery Multiply - * - * Interleaves the montgomery reduction and long multiplication algorithms together as described in - * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=13 HAC 14.36} - * - * @see _prepMontgomery() - * @see _montgomery() - * @access private - * @param Array $x - * @param Array $y - * @param Array $m - * @return Array - */ - function _montgomeryMultiply($x, $y, $m) - { - $temp = $this->_multiply($x, false, $y, false); - return $this->_montgomery($temp[MATH_BIGINTEGER_VALUE], $m); - - static $cache = array( - MATH_BIGINTEGER_VARIABLE => array(), - MATH_BIGINTEGER_DATA => array() - ); - - if ( ($key = array_search($m, $cache[MATH_BIGINTEGER_VARIABLE])) === false ) { - $key = count($cache[MATH_BIGINTEGER_VARIABLE]); - $cache[MATH_BIGINTEGER_VARIABLE][] = $m; - $cache[MATH_BIGINTEGER_DATA][] = $this->_modInverse67108864($m); - } - - $n = max(count($x), count($y), count($m)); - $x = array_pad($x, $n, 0); - $y = array_pad($y, $n, 0); - $m = array_pad($m, $n, 0); - $a = array(MATH_BIGINTEGER_VALUE => $this->_array_repeat(0, $n + 1)); - for ($i = 0; $i < $n; ++$i) { - $temp = $a[MATH_BIGINTEGER_VALUE][0] + $x[$i] * $y[0]; - $temp = (int) ($temp - 0x4000000 * ((int) ($temp / 0x4000000))); - $temp = $temp * $cache[MATH_BIGINTEGER_DATA][$key]; - $temp = (int) ($temp - 0x4000000 * ((int) ($temp / 0x4000000))); - $temp = $this->_add($this->_regularMultiply(array($x[$i]), $y), false, $this->_regularMultiply(array($temp), $m), false); - $a = $this->_add($a[MATH_BIGINTEGER_VALUE], false, $temp[MATH_BIGINTEGER_VALUE], false); - $a[MATH_BIGINTEGER_VALUE] = array_slice($a[MATH_BIGINTEGER_VALUE], 1); - } - if ($this->_compare($a[MATH_BIGINTEGER_VALUE], false, $m, false) >= 0) { - $a = $this->_subtract($a[MATH_BIGINTEGER_VALUE], false, $m, false); - } - return $a[MATH_BIGINTEGER_VALUE]; - } - - /** - * Prepare a number for use in Montgomery Modular Reductions - * - * @see _montgomery() - * @see _slidingWindow() - * @access private - * @param Array $x - * @param Array $n - * @return Array - */ - function _prepMontgomery($x, $n) - { - $lhs = new Math_BigInteger(); - $lhs->value = array_merge($this->_array_repeat(0, count($n)), $x); - $rhs = new Math_BigInteger(); - $rhs->value = $n; - - list(, $temp) = $lhs->divide($rhs); - return $temp->value; - } - - /** - * Modular Inverse of a number mod 2**26 (eg. 67108864) - * - * Based off of the bnpInvDigit function implemented and justified in the following URL: - * - * {@link http://www-cs-students.stanford.edu/~tjw/jsbn/jsbn.js} - * - * The following URL provides more info: - * - * {@link http://groups.google.com/group/sci.crypt/msg/7a137205c1be7d85} - * - * As for why we do all the bitmasking... strange things can happen when converting from floats to ints. For - * instance, on some computers, var_dump((int) -4294967297) yields int(-1) and on others, it yields - * int(-2147483648). To avoid problems stemming from this, we use bitmasks to guarantee that ints aren't - * auto-converted to floats. The outermost bitmask is present because without it, there's no guarantee that - * the "residue" returned would be the so-called "common residue". We use fmod, in the last step, because the - * maximum possible $x is 26 bits and the maximum $result is 16 bits. Thus, we have to be able to handle up to - * 40 bits, which only 64-bit floating points will support. - * - * Thanks to Pedro Gimeno Fortea for input! - * - * @see _montgomery() - * @access private - * @param Array $x - * @return Integer - */ - function _modInverse67108864($x) // 2**26 == 67108864 - { - $x = -$x[0]; - $result = $x & 0x3; // x**-1 mod 2**2 - $result = ($result * (2 - $x * $result)) & 0xF; // x**-1 mod 2**4 - $result = ($result * (2 - ($x & 0xFF) * $result)) & 0xFF; // x**-1 mod 2**8 - $result = ($result * ((2 - ($x & 0xFFFF) * $result) & 0xFFFF)) & 0xFFFF; // x**-1 mod 2**16 - $result = fmod($result * (2 - fmod($x * $result, 0x4000000)), 0x4000000); // x**-1 mod 2**26 - return $result & 0x3FFFFFF; - } - - /** - * Calculates modular inverses. - * - * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses. - * - * Here's an example: - * <code> - * <?php - * include('Math/BigInteger.php'); - * - * $a = new Math_BigInteger(30); - * $b = new Math_BigInteger(17); - * - * $c = $a->modInverse($b); - * echo $c->toString(); // outputs 4 - * - * echo "\r\n"; - * - * $d = $a->multiply($c); - * list(, $d) = $d->divide($b); - * echo $d; // outputs 1 (as per the definition of modular inverse) - * ?> - * </code> - * - * @param Math_BigInteger $n - * @return mixed false, if no modular inverse exists, Math_BigInteger, otherwise. - * @access public - * @internal See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=21 HAC 14.64} for more information. - */ - function modInverse($n) - { - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - $temp = new Math_BigInteger(); - $temp->value = gmp_invert($this->value, $n->value); - - return ( $temp->value === false ) ? false : $this->_normalize($temp); - } - - static $zero, $one; - if (!isset($zero)) { - $zero = new Math_BigInteger(); - $one = new Math_BigInteger(1); - } - - // $x mod $n == $x mod -$n. - $n = $n->abs(); - - if ($this->compare($zero) < 0) { - $temp = $this->abs(); - $temp = $temp->modInverse($n); - return $negated === false ? false : $this->_normalize($n->subtract($temp)); - } - - extract($this->extendedGCD($n)); - - if (!$gcd->equals($one)) { - return false; - } - - $x = $x->compare($zero) < 0 ? $x->add($n) : $x; - - return $this->compare($zero) < 0 ? $this->_normalize($n->subtract($x)) : $this->_normalize($x); - } - - /** - * Calculates the greatest common divisor and B�zout's identity. - * - * Say you have 693 and 609. The GCD is 21. B�zout's identity states that there exist integers x and y such that - * 693*x + 609*y == 21. In point of fact, there are actually an infinite number of x and y combinations and which - * combination is returned is dependant upon which mode is in use. See - * {@link http://en.wikipedia.org/wiki/B%C3%A9zout%27s_identity B�zout's identity - Wikipedia} for more information. - * - * Here's an example: - * <code> - * <?php - * include('Math/BigInteger.php'); - * - * $a = new Math_BigInteger(693); - * $b = new Math_BigInteger(609); - * - * extract($a->extendedGCD($b)); - * - * echo $gcd->toString() . "\r\n"; // outputs 21 - * echo $a->toString() * $x->toString() + $b->toString() * $y->toString(); // outputs 21 - * ?> - * </code> - * - * @param Math_BigInteger $n - * @return Math_BigInteger - * @access public - * @internal Calculates the GCD using the binary xGCD algorithim described in - * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=19 HAC 14.61}. As the text above 14.61 notes, - * the more traditional algorithim requires "relatively costly multiple-precision divisions". - */ - function extendedGCD($n) - { - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - extract(gmp_gcdext($this->value, $n->value)); - - return array( - 'gcd' => $this->_normalize(new Math_BigInteger($g)), - 'x' => $this->_normalize(new Math_BigInteger($s)), - 'y' => $this->_normalize(new Math_BigInteger($t)) - ); - case MATH_BIGINTEGER_MODE_BCMATH: - // it might be faster to use the binary xGCD algorithim here, as well, but (1) that algorithim works - // best when the base is a power of 2 and (2) i don't think it'd make much difference, anyway. as is, - // the basic extended euclidean algorithim is what we're using. - - $u = $this->value; - $v = $n->value; - - $a = '1'; - $b = '0'; - $c = '0'; - $d = '1'; - - while (bccomp($v, '0', 0) != 0) { - $q = bcdiv($u, $v, 0); - - $temp = $u; - $u = $v; - $v = bcsub($temp, bcmul($v, $q, 0), 0); - - $temp = $a; - $a = $c; - $c = bcsub($temp, bcmul($a, $q, 0), 0); - - $temp = $b; - $b = $d; - $d = bcsub($temp, bcmul($b, $q, 0), 0); - } - - return array( - 'gcd' => $this->_normalize(new Math_BigInteger($u)), - 'x' => $this->_normalize(new Math_BigInteger($a)), - 'y' => $this->_normalize(new Math_BigInteger($b)) - ); - } - - $y = $n->copy(); - $x = $this->copy(); - $g = new Math_BigInteger(); - $g->value = array(1); - - while ( !(($x->value[0] & 1)|| ($y->value[0] & 1)) ) { - $x->_rshift(1); - $y->_rshift(1); - $g->_lshift(1); - } - - $u = $x->copy(); - $v = $y->copy(); - - $a = new Math_BigInteger(); - $b = new Math_BigInteger(); - $c = new Math_BigInteger(); - $d = new Math_BigInteger(); - - $a->value = $d->value = $g->value = array(1); - $b->value = $c->value = array(); - - while ( !empty($u->value) ) { - while ( !($u->value[0] & 1) ) { - $u->_rshift(1); - if ( (!empty($a->value) && ($a->value[0] & 1)) || (!empty($b->value) && ($b->value[0] & 1)) ) { - $a = $a->add($y); - $b = $b->subtract($x); - } - $a->_rshift(1); - $b->_rshift(1); - } - - while ( !($v->value[0] & 1) ) { - $v->_rshift(1); - if ( (!empty($d->value) && ($d->value[0] & 1)) || (!empty($c->value) && ($c->value[0] & 1)) ) { - $c = $c->add($y); - $d = $d->subtract($x); - } - $c->_rshift(1); - $d->_rshift(1); - } - - if ($u->compare($v) >= 0) { - $u = $u->subtract($v); - $a = $a->subtract($c); - $b = $b->subtract($d); - } else { - $v = $v->subtract($u); - $c = $c->subtract($a); - $d = $d->subtract($b); - } - } - - return array( - 'gcd' => $this->_normalize($g->multiply($v)), - 'x' => $this->_normalize($c), - 'y' => $this->_normalize($d) - ); - } - - /** - * Calculates the greatest common divisor - * - * Say you have 693 and 609. The GCD is 21. - * - * Here's an example: - * <code> - * <?php - * include('Math/BigInteger.php'); - * - * $a = new Math_BigInteger(693); - * $b = new Math_BigInteger(609); - * - * $gcd = a->extendedGCD($b); - * - * echo $gcd->toString() . "\r\n"; // outputs 21 - * ?> - * </code> - * - * @param Math_BigInteger $n - * @return Math_BigInteger - * @access public - */ - function gcd($n) - { - extract($this->extendedGCD($n)); - return $gcd; - } - - /** - * Absolute value. - * - * @return Math_BigInteger - * @access public - */ - function abs() - { - $temp = new Math_BigInteger(); - - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - $temp->value = gmp_abs($this->value); - break; - case MATH_BIGINTEGER_MODE_BCMATH: - $temp->value = (bccomp($this->value, '0', 0) < 0) ? substr($this->value, 1) : $this->value; - break; - default: - $temp->value = $this->value; - } - - return $temp; - } - - /** - * Compares two numbers. - * - * Although one might think !$x->compare($y) means $x != $y, it, in fact, means the opposite. The reason for this is - * demonstrated thusly: - * - * $x > $y: $x->compare($y) > 0 - * $x < $y: $x->compare($y) < 0 - * $x == $y: $x->compare($y) == 0 - * - * Note how the same comparison operator is used. If you want to test for equality, use $x->equals($y). - * - * @param Math_BigInteger $x - * @return Integer < 0 if $this is less than $x; > 0 if $this is greater than $x, and 0 if they are equal. - * @access public - * @see equals() - * @internal Could return $this->subtract($x), but that's not as fast as what we do do. - */ - function compare($y) - { - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - return gmp_cmp($this->value, $y->value); - case MATH_BIGINTEGER_MODE_BCMATH: - return bccomp($this->value, $y->value, 0); - } - - return $this->_compare($this->value, $this->is_negative, $y->value, $y->is_negative); - } - - /** - * Compares two numbers. - * - * @param Array $x_value - * @param Boolean $x_negative - * @param Array $y_value - * @param Boolean $y_negative - * @return Integer - * @see compare() - * @access private - */ - function _compare($x_value, $x_negative, $y_value, $y_negative) - { - if ( $x_negative != $y_negative ) { - return ( !$x_negative && $y_negative ) ? 1 : -1; - } - - $result = $x_negative ? -1 : 1; - - if ( count($x_value) != count($y_value) ) { - return ( count($x_value) > count($y_value) ) ? $result : -$result; - } - $size = max(count($x_value), count($y_value)); - - $x_value = array_pad($x_value, $size, 0); - $y_value = array_pad($y_value, $size, 0); - - for ($i = count($x_value) - 1; $i >= 0; --$i) { - if ($x_value[$i] != $y_value[$i]) { - return ( $x_value[$i] > $y_value[$i] ) ? $result : -$result; - } - } - - return 0; - } - - /** - * Tests the equality of two numbers. - * - * If you need to see if one number is greater than or less than another number, use Math_BigInteger::compare() - * - * @param Math_BigInteger $x - * @return Boolean - * @access public - * @see compare() - */ - function equals($x) - { - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - return gmp_cmp($this->value, $x->value) == 0; - default: - return $this->value === $x->value && $this->is_negative == $x->is_negative; - } - } - - /** - * Set Precision - * - * Some bitwise operations give different results depending on the precision being used. Examples include left - * shift, not, and rotates. - * - * @param Math_BigInteger $x - * @access public - * @return Math_BigInteger - */ - function setPrecision($bits) - { - $this->precision = $bits; - if ( MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_BCMATH ) { - $this->bitmask = new Math_BigInteger(chr((1 << ($bits & 0x7)) - 1) . str_repeat(chr(0xFF), $bits >> 3), 256); - } else { - $this->bitmask = new Math_BigInteger(bcpow('2', $bits, 0)); - } - - $temp = $this->_normalize($this); - $this->value = $temp->value; - } - - /** - * Logical And - * - * @param Math_BigInteger $x - * @access public - * @internal Implemented per a request by Lluis Pamies i Juarez <lluis _a_ pamies.cat> - * @return Math_BigInteger - */ - function bitwise_and($x) - { - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - $temp = new Math_BigInteger(); - $temp->value = gmp_and($this->value, $x->value); - - return $this->_normalize($temp); - case MATH_BIGINTEGER_MODE_BCMATH: - $left = $this->toBytes(); - $right = $x->toBytes(); - - $length = max(strlen($left), strlen($right)); - - $left = str_pad($left, $length, chr(0), STR_PAD_LEFT); - $right = str_pad($right, $length, chr(0), STR_PAD_LEFT); - - return $this->_normalize(new Math_BigInteger($left & $right, 256)); - } - - $result = $this->copy(); - - $length = min(count($x->value), count($this->value)); - - $result->value = array_slice($result->value, 0, $length); - - for ($i = 0; $i < $length; ++$i) { - $result->value[$i] = $result->value[$i] & $x->value[$i]; - } - - return $this->_normalize($result); - } - - /** - * Logical Or - * - * @param Math_BigInteger $x - * @access public - * @internal Implemented per a request by Lluis Pamies i Juarez <lluis _a_ pamies.cat> - * @return Math_BigInteger - */ - function bitwise_or($x) - { - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - $temp = new Math_BigInteger(); - $temp->value = gmp_or($this->value, $x->value); - - return $this->_normalize($temp); - case MATH_BIGINTEGER_MODE_BCMATH: - $left = $this->toBytes(); - $right = $x->toBytes(); - - $length = max(strlen($left), strlen($right)); - - $left = str_pad($left, $length, chr(0), STR_PAD_LEFT); - $right = str_pad($right, $length, chr(0), STR_PAD_LEFT); - - return $this->_normalize(new Math_BigInteger($left | $right, 256)); - } - - $length = max(count($this->value), count($x->value)); - $result = $this->copy(); - $result->value = array_pad($result->value, 0, $length); - $x->value = array_pad($x->value, 0, $length); - - for ($i = 0; $i < $length; ++$i) { - $result->value[$i] = $this->value[$i] | $x->value[$i]; - } - - return $this->_normalize($result); - } - - /** - * Logical Exclusive-Or - * - * @param Math_BigInteger $x - * @access public - * @internal Implemented per a request by Lluis Pamies i Juarez <lluis _a_ pamies.cat> - * @return Math_BigInteger - */ - function bitwise_xor($x) - { - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - $temp = new Math_BigInteger(); - $temp->value = gmp_xor($this->value, $x->value); - - return $this->_normalize($temp); - case MATH_BIGINTEGER_MODE_BCMATH: - $left = $this->toBytes(); - $right = $x->toBytes(); - - $length = max(strlen($left), strlen($right)); - - $left = str_pad($left, $length, chr(0), STR_PAD_LEFT); - $right = str_pad($right, $length, chr(0), STR_PAD_LEFT); - - return $this->_normalize(new Math_BigInteger($left ^ $right, 256)); - } - - $length = max(count($this->value), count($x->value)); - $result = $this->copy(); - $result->value = array_pad($result->value, 0, $length); - $x->value = array_pad($x->value, 0, $length); - - for ($i = 0; $i < $length; ++$i) { - $result->value[$i] = $this->value[$i] ^ $x->value[$i]; - } - - return $this->_normalize($result); - } - - /** - * Logical Not - * - * @access public - * @internal Implemented per a request by Lluis Pamies i Juarez <lluis _a_ pamies.cat> - * @return Math_BigInteger - */ - function bitwise_not() - { - // calculuate "not" without regard to $this->precision - // (will always result in a smaller number. ie. ~1 isn't 1111 1110 - it's 0) - $temp = $this->toBytes(); - $pre_msb = decbin(ord($temp[0])); - $temp = ~$temp; - $msb = decbin(ord($temp[0])); - if (strlen($msb) == 8) { - $msb = substr($msb, strpos($msb, '0')); - } - $temp[0] = chr(bindec($msb)); - - // see if we need to add extra leading 1's - $current_bits = strlen($pre_msb) + 8 * strlen($temp) - 8; - $new_bits = $this->precision - $current_bits; - if ($new_bits <= 0) { - return $this->_normalize(new Math_BigInteger($temp, 256)); - } - - // generate as many leading 1's as we need to. - $leading_ones = chr((1 << ($new_bits & 0x7)) - 1) . str_repeat(chr(0xFF), $new_bits >> 3); - $this->_base256_lshift($leading_ones, $current_bits); - - $temp = str_pad($temp, ceil($this->bits / 8), chr(0), STR_PAD_LEFT); - - return $this->_normalize(new Math_BigInteger($leading_ones | $temp, 256)); - } - - /** - * Logical Right Shift - * - * Shifts BigInteger's by $shift bits, effectively dividing by 2**$shift. - * - * @param Integer $shift - * @return Math_BigInteger - * @access public - * @internal The only version that yields any speed increases is the internal version. - */ - function bitwise_rightShift($shift) - { - $temp = new Math_BigInteger(); - - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - static $two; - - if (!isset($two)) { - $two = gmp_init('2'); - } - - $temp->value = gmp_div_q($this->value, gmp_pow($two, $shift)); - - break; - case MATH_BIGINTEGER_MODE_BCMATH: - $temp->value = bcdiv($this->value, bcpow('2', $shift, 0), 0); - - break; - default: // could just replace _lshift with this, but then all _lshift() calls would need to be rewritten - // and I don't want to do that... - $temp->value = $this->value; - $temp->_rshift($shift); - } - - return $this->_normalize($temp); - } - - /** - * Logical Left Shift - * - * Shifts BigInteger's by $shift bits, effectively multiplying by 2**$shift. - * - * @param Integer $shift - * @return Math_BigInteger - * @access public - * @internal The only version that yields any speed increases is the internal version. - */ - function bitwise_leftShift($shift) - { - $temp = new Math_BigInteger(); - - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - static $two; - - if (!isset($two)) { - $two = gmp_init('2'); - } - - $temp->value = gmp_mul($this->value, gmp_pow($two, $shift)); - - break; - case MATH_BIGINTEGER_MODE_BCMATH: - $temp->value = bcmul($this->value, bcpow('2', $shift, 0), 0); - - break; - default: // could just replace _rshift with this, but then all _lshift() calls would need to be rewritten - // and I don't want to do that... - $temp->value = $this->value; - $temp->_lshift($shift); - } - - return $this->_normalize($temp); - } - - /** - * Logical Left Rotate - * - * Instead of the top x bits being dropped they're appended to the shifted bit string. - * - * @param Integer $shift - * @return Math_BigInteger - * @access public - */ - function bitwise_leftRotate($shift) - { - $bits = $this->toBytes(); - - if ($this->precision > 0) { - $precision = $this->precision; - if ( MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_BCMATH ) { - $mask = $this->bitmask->subtract(new Math_BigInteger(1)); - $mask = $mask->toBytes(); - } else { - $mask = $this->bitmask->toBytes(); - } - } else { - $temp = ord($bits[0]); - for ($i = 0; $temp >> $i; ++$i); - $precision = 8 * strlen($bits) - 8 + $i; - $mask = chr((1 << ($precision & 0x7)) - 1) . str_repeat(chr(0xFF), $precision >> 3); - } - - if ($shift < 0) { - $shift+= $precision; - } - $shift%= $precision; - - if (!$shift) { - return $this->copy(); - } - - $left = $this->bitwise_leftShift($shift); - $left = $left->bitwise_and(new Math_BigInteger($mask, 256)); - $right = $this->bitwise_rightShift($precision - $shift); - $result = MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_BCMATH ? $left->bitwise_or($right) : $left->add($right); - return $this->_normalize($result); - } - - /** - * Logical Right Rotate - * - * Instead of the bottom x bits being dropped they're prepended to the shifted bit string. - * - * @param Integer $shift - * @return Math_BigInteger - * @access public - */ - function bitwise_rightRotate($shift) - { - return $this->bitwise_leftRotate(-$shift); - } - - /** - * Set random number generator function - * - * $generator should be the name of a random generating function whose first parameter is the minimum - * value and whose second parameter is the maximum value. If this function needs to be seeded, it should - * be seeded prior to calling Math_BigInteger::random() or Math_BigInteger::randomPrime() - * - * If the random generating function is not explicitly set, it'll be assumed to be mt_rand(). - * - * @see random() - * @see randomPrime() - * @param optional String $generator - * @access public - */ - function setRandomGenerator($generator) - { - $this->generator = $generator; - } - - /** - * Generate a random number - * - * @param optional Integer $min - * @param optional Integer $max - * @return Math_BigInteger - * @access public - */ - function random($min = false, $max = false) - { - if ($min === false) { - $min = new Math_BigInteger(0); - } - - if ($max === false) { - $max = new Math_BigInteger(0x7FFFFFFF); - } - - $compare = $max->compare($min); - - if (!$compare) { - return $this->_normalize($min); - } else if ($compare < 0) { - // if $min is bigger then $max, swap $min and $max - $temp = $max; - $max = $min; - $min = $temp; - } - - $generator = $this->generator; - - $max = $max->subtract($min); - $max = ltrim($max->toBytes(), chr(0)); - $size = strlen($max) - 1; - $random = ''; - - $bytes = $size & 1; - for ($i = 0; $i < $bytes; ++$i) { - $random.= chr($generator(0, 255)); - } - - $blocks = $size >> 1; - for ($i = 0; $i < $blocks; ++$i) { - // mt_rand(-2147483648, 0x7FFFFFFF) always produces -2147483648 on some systems - $random.= pack('n', $generator(0, 0xFFFF)); - } - - $temp = new Math_BigInteger($random, 256); - if ($temp->compare(new Math_BigInteger(substr($max, 1), 256)) > 0) { - $random = chr($generator(0, ord($max[0]) - 1)) . $random; - } else { - $random = chr($generator(0, ord($max[0]) )) . $random; - } - - $random = new Math_BigInteger($random, 256); - - return $this->_normalize($random->add($min)); - } - - /** - * Generate a random prime number. - * - * If there's not a prime within the given range, false will be returned. If more than $timeout seconds have elapsed, - * give up and return false. - * - * @param optional Integer $min - * @param optional Integer $max - * @param optional Integer $timeout - * @return Math_BigInteger - * @access public - * @internal See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap4.pdf#page=15 HAC 4.44}. - */ - function randomPrime($min = false, $max = false, $timeout = false) - { - $compare = $max->compare($min); - - if (!$compare) { - return $min; - } else if ($compare < 0) { - // if $min is bigger then $max, swap $min and $max - $temp = $max; - $max = $min; - $min = $temp; - } - - // gmp_nextprime() requires PHP 5 >= 5.2.0 per <http://php.net/gmp-nextprime>. - if ( MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_GMP && function_exists('gmp_nextprime') ) { - // we don't rely on Math_BigInteger::random()'s min / max when gmp_nextprime() is being used since this function - // does its own checks on $max / $min when gmp_nextprime() is used. When gmp_nextprime() is not used, however, - // the same $max / $min checks are not performed. - if ($min === false) { - $min = new Math_BigInteger(0); - } - - if ($max === false) { - $max = new Math_BigInteger(0x7FFFFFFF); - } - - $x = $this->random($min, $max); - - $x->value = gmp_nextprime($x->value); - - if ($x->compare($max) <= 0) { - return $x; - } - - $x->value = gmp_nextprime($min->value); - - if ($x->compare($max) <= 0) { - return $x; - } - - return false; - } - - static $one, $two; - if (!isset($one)) { - $one = new Math_BigInteger(1); - $two = new Math_BigInteger(2); - } - - $start = time(); - - $x = $this->random($min, $max); - if ($x->equals($two)) { - return $x; - } - - $x->_make_odd(); - if ($x->compare($max) > 0) { - // if $x > $max then $max is even and if $min == $max then no prime number exists between the specified range - if ($min->equals($max)) { - return false; - } - $x = $min->copy(); - $x->_make_odd(); - } - - $initial_x = $x->copy(); - - while (true) { - if ($timeout !== false && time() - $start > $timeout) { - return false; - } - - if ($x->isPrime()) { - return $x; - } - - $x = $x->add($two); - - if ($x->compare($max) > 0) { - $x = $min->copy(); - if ($x->equals($two)) { - return $x; - } - $x->_make_odd(); - } - - if ($x->equals($initial_x)) { - return false; - } - } - } - - /** - * Make the current number odd - * - * If the current number is odd it'll be unchanged. If it's even, one will be added to it. - * - * @see randomPrime() - * @access private - */ - function _make_odd() - { - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - gmp_setbit($this->value, 0); - break; - case MATH_BIGINTEGER_MODE_BCMATH: - if ($this->value[strlen($this->value) - 1] % 2 == 0) { - $this->value = bcadd($this->value, '1'); - } - break; - default: - $this->value[0] |= 1; - } - } - - /** - * Checks a numer to see if it's prime - * - * Assuming the $t parameter is not set, this function has an error rate of 2**-80. The main motivation for the - * $t parameter is distributability. Math_BigInteger::randomPrime() can be distributed accross multiple pageloads - * on a website instead of just one. - * - * @param optional Integer $t - * @return Boolean - * @access public - * @internal Uses the - * {@link http://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test Miller-Rabin primality test}. See - * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap4.pdf#page=8 HAC 4.24}. - */ - function isPrime($t = false) - { - $length = strlen($this->toBytes()); - - if (!$t) { - // see HAC 4.49 "Note (controlling the error probability)" - if ($length >= 163) { $t = 2; } // floor(1300 / 8) - else if ($length >= 106) { $t = 3; } // floor( 850 / 8) - else if ($length >= 81 ) { $t = 4; } // floor( 650 / 8) - else if ($length >= 68 ) { $t = 5; } // floor( 550 / 8) - else if ($length >= 56 ) { $t = 6; } // floor( 450 / 8) - else if ($length >= 50 ) { $t = 7; } // floor( 400 / 8) - else if ($length >= 43 ) { $t = 8; } // floor( 350 / 8) - else if ($length >= 37 ) { $t = 9; } // floor( 300 / 8) - else if ($length >= 31 ) { $t = 12; } // floor( 250 / 8) - else if ($length >= 25 ) { $t = 15; } // floor( 200 / 8) - else if ($length >= 18 ) { $t = 18; } // floor( 150 / 8) - else { $t = 27; } - } - - // ie. gmp_testbit($this, 0) - // ie. isEven() or !isOdd() - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - return gmp_prob_prime($this->value, $t) != 0; - case MATH_BIGINTEGER_MODE_BCMATH: - if ($this->value === '2') { - return true; - } - if ($this->value[strlen($this->value) - 1] % 2 == 0) { - return false; - } - break; - default: - if ($this->value == array(2)) { - return true; - } - if (~$this->value[0] & 1) { - return false; - } - } - - static $primes, $zero, $one, $two; - - if (!isset($primes)) { - $primes = array( - 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, - 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, - 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, - 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, - 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, - 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, - 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, - 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, - 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, - 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, - 953, 967, 971, 977, 983, 991, 997 - ); - - if ( MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_INTERNAL ) { - for ($i = 0; $i < count($primes); ++$i) { - $primes[$i] = new Math_BigInteger($primes[$i]); - } - } - - $zero = new Math_BigInteger(); - $one = new Math_BigInteger(1); - $two = new Math_BigInteger(2); - } - - if ($this->equals($one)) { - return false; - } - - // see HAC 4.4.1 "Random search for probable primes" - if ( MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_INTERNAL ) { - foreach ($primes as $prime) { - list(, $r) = $this->divide($prime); - if ($r->equals($zero)) { - return $this->equals($prime); - } - } - } else { - $value = $this->value; - foreach ($primes as $prime) { - list(, $r) = $this->_divide_digit($value, $prime); - if (!$r) { - return count($value) == 1 && $value[0] == $prime; - } - } - } - - $n = $this->copy(); - $n_1 = $n->subtract($one); - $n_2 = $n->subtract($two); - - $r = $n_1->copy(); - $r_value = $r->value; - // ie. $s = gmp_scan1($n, 0) and $r = gmp_div_q($n, gmp_pow(gmp_init('2'), $s)); - if ( MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_BCMATH ) { - $s = 0; - // if $n was 1, $r would be 0 and this would be an infinite loop, hence our $this->equals($one) check earlier - while ($r->value[strlen($r->value) - 1] % 2 == 0) { - $r->value = bcdiv($r->value, '2', 0); - ++$s; - } - } else { - for ($i = 0, $r_length = count($r_value); $i < $r_length; ++$i) { - $temp = ~$r_value[$i] & 0xFFFFFF; - for ($j = 1; ($temp >> $j) & 1; ++$j); - if ($j != 25) { - break; - } - } - $s = 26 * $i + $j - 1; - $r->_rshift($s); - } - - for ($i = 0; $i < $t; ++$i) { - $a = $this->random($two, $n_2); - $y = $a->modPow($r, $n); - - if (!$y->equals($one) && !$y->equals($n_1)) { - for ($j = 1; $j < $s && !$y->equals($n_1); ++$j) { - $y = $y->modPow($two, $n); - if ($y->equals($one)) { - return false; - } - } - - if (!$y->equals($n_1)) { - return false; - } - } - } - return true; - } - - /** - * Logical Left Shift - * - * Shifts BigInteger's by $shift bits. - * - * @param Integer $shift - * @access private - */ - function _lshift($shift) - { - if ( $shift == 0 ) { - return; - } - - $num_digits = (int) ($shift / 26); - $shift %= 26; - $shift = 1 << $shift; - - $carry = 0; - - for ($i = 0; $i < count($this->value); ++$i) { - $temp = $this->value[$i] * $shift + $carry; - $carry = (int) ($temp / 0x4000000); - $this->value[$i] = (int) ($temp - $carry * 0x4000000); - } - - if ( $carry ) { - $this->value[] = $carry; - } - - while ($num_digits--) { - array_unshift($this->value, 0); - } - } - - /** - * Logical Right Shift - * - * Shifts BigInteger's by $shift bits. - * - * @param Integer $shift - * @access private - */ - function _rshift($shift) - { - if ($shift == 0) { - return; - } - - $num_digits = (int) ($shift / 26); - $shift %= 26; - $carry_shift = 26 - $shift; - $carry_mask = (1 << $shift) - 1; - - if ( $num_digits ) { - $this->value = array_slice($this->value, $num_digits); - } - - $carry = 0; - - for ($i = count($this->value) - 1; $i >= 0; --$i) { - $temp = $this->value[$i] >> $shift | $carry; - $carry = ($this->value[$i] & $carry_mask) << $carry_shift; - $this->value[$i] = $temp; - } - - $this->value = $this->_trim($this->value); - } - - /** - * Normalize - * - * Removes leading zeros and truncates (if necessary) to maintain the appropriate precision - * - * @param Math_BigInteger - * @return Math_BigInteger - * @see _trim() - * @access private - */ - function _normalize($result) - { - $result->precision = $this->precision; - $result->bitmask = $this->bitmask; - - switch ( MATH_BIGINTEGER_MODE ) { - case MATH_BIGINTEGER_MODE_GMP: - if (!empty($result->bitmask->value)) { - $result->value = gmp_and($result->value, $result->bitmask->value); - } - - return $result; - case MATH_BIGINTEGER_MODE_BCMATH: - if (!empty($result->bitmask->value)) { - $result->value = bcmod($result->value, $result->bitmask->value); - } - - return $result; - } - - $value = &$result->value; - - if ( !count($value) ) { - return $result; - } - - $value = $this->_trim($value); - - if (!empty($result->bitmask->value)) { - $length = min(count($value), count($this->bitmask->value)); - $value = array_slice($value, 0, $length); - - for ($i = 0; $i < $length; ++$i) { - $value[$i] = $value[$i] & $this->bitmask->value[$i]; - } - } - - return $result; - } - - /** - * Trim - * - * Removes leading zeros - * - * @return Math_BigInteger - * @access private - */ - function _trim($value) - { - for ($i = count($value) - 1; $i >= 0; --$i) { - if ( $value[$i] ) { - break; - } - unset($value[$i]); - } - - return $value; - } - - /** - * Array Repeat - * - * @param $input Array - * @param $multiplier mixed - * @return Array - * @access private - */ - function _array_repeat($input, $multiplier) - { - return ($multiplier) ? array_fill(0, $multiplier, $input) : array(); - } - - /** - * Logical Left Shift - * - * Shifts binary strings $shift bits, essentially multiplying by 2**$shift. - * - * @param $x String - * @param $shift Integer - * @return String - * @access private - */ - function _base256_lshift(&$x, $shift) - { - if ($shift == 0) { - return; - } - - $num_bytes = $shift >> 3; // eg. floor($shift/8) - $shift &= 7; // eg. $shift % 8 - - $carry = 0; - for ($i = strlen($x) - 1; $i >= 0; --$i) { - $temp = ord($x[$i]) << $shift | $carry; - $x[$i] = chr($temp); - $carry = $temp >> 8; - } - $carry = ($carry != 0) ? chr($carry) : ''; - $x = $carry . $x . str_repeat(chr(0), $num_bytes); - } - - /** - * Logical Right Shift - * - * Shifts binary strings $shift bits, essentially dividing by 2**$shift and returning the remainder. - * - * @param $x String - * @param $shift Integer - * @return String - * @access private - */ - function _base256_rshift(&$x, $shift) - { - if ($shift == 0) { - $x = ltrim($x, chr(0)); - return ''; - } - - $num_bytes = $shift >> 3; // eg. floor($shift/8) - $shift &= 7; // eg. $shift % 8 - - $remainder = ''; - if ($num_bytes) { - $start = $num_bytes > strlen($x) ? -strlen($x) : -$num_bytes; - $remainder = substr($x, $start); - $x = substr($x, 0, -$num_bytes); - } - - $carry = 0; - $carry_shift = 8 - $shift; - for ($i = 0; $i < strlen($x); ++$i) { - $temp = (ord($x[$i]) >> $shift) | $carry; - $carry = (ord($x[$i]) << $carry_shift) & 0xFF; - $x[$i] = chr($temp); - } - $x = ltrim($x, chr(0)); - - $remainder = chr($carry >> $carry_shift) . $remainder; - - return ltrim($remainder, chr(0)); - } - - // one quirk about how the following functions are implemented is that PHP defines N to be an unsigned long - // at 32-bits, while java's longs are 64-bits. - - /** - * Converts 32-bit integers to bytes. - * - * @param Integer $x - * @return String - * @access private - */ - function _int2bytes($x) - { - return ltrim(pack('N', $x), chr(0)); - } - - /** - * Converts bytes to 32-bit integers - * - * @param String $x - * @return Integer - * @access private - */ - function _bytes2int($x) - { - $temp = unpack('Nint', str_pad($x, 4, chr(0), STR_PAD_LEFT)); - return $temp['int']; - } -} diff --git a/lib/internal/phpseclib/Net/SFTP.php b/lib/internal/phpseclib/Net/SFTP.php deleted file mode 100644 index ad750568435..00000000000 --- a/lib/internal/phpseclib/Net/SFTP.php +++ /dev/null @@ -1,1461 +0,0 @@ -<?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * Pure-PHP implementation of SFTP. - * - * PHP versions 4 and 5 - * - * Currently only supports SFTPv3, which, according to wikipedia.org, "is the most widely used version, - * implemented by the popular OpenSSH SFTP server". If you want SFTPv4/5/6 support, provide me with access - * to an SFTPv4/5/6 server. - * - * The API for this library is modeled after the API from PHP's {@link http://php.net/book.ftp FTP extension}. - * - * Here's a short example of how to use this library: - * <code> - * <?php - * include('Net/SFTP.php'); - * - * $sftp = new Net_SFTP('www.domain.tld'); - * if (!$sftp->login('username', 'password')) { - * exit('Login Failed'); - * } - * - * echo $sftp->pwd() . "\r\n"; - * $sftp->put('filename.ext', 'hello, world!'); - * print_r($sftp->nlist()); - * ?> - * </code> - * - * LICENSE: This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - * @category Net - * @package Net_SFTP - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMIX Jim Wigginton - * @license http://www.gnu.org/licenses/lgpl.txt - * @version $Id: SFTP.php,v 1.21 2010/04/09 02:31:34 terrafrost Exp $ - * @link http://phpseclib.sourceforge.net - */ - -/** - * Include Net_SSH2 - */ -require_once('phpseclib/Net/SSH2.php'); - -/**#@+ - * @access public - * @see Net_SFTP::getLog() - */ -/** - * Returns the message numbers - */ -define('NET_SFTP_LOG_SIMPLE', NET_SSH2_LOG_SIMPLE); -/** - * Returns the message content - */ -define('NET_SFTP_LOG_COMPLEX', NET_SSH2_LOG_COMPLEX); -/**#@-*/ - -/** - * SFTP channel constant - * - * Net_SSH2::exec() uses 0 and Net_SSH2::interactiveRead() / Net_SSH2::interactiveWrite() use 1. - * - * @see Net_SSH2::_send_channel_packet() - * @see Net_SSH2::_get_channel_packet() - * @access private - */ -define('NET_SFTP_CHANNEL', 2); - -/**#@+ - * @access public - * @see Net_SFTP::put() - */ -/** - * Reads data from a local file. - */ -define('NET_SFTP_LOCAL_FILE', 1); -/** - * Reads data from a string. - */ -define('NET_SFTP_STRING', 2); -/**#@-*/ - -/** - * Pure-PHP implementations of SFTP. - * - * @author Jim Wigginton <terrafrost@php.net> - * @version 0.1.0 - * @access public - * @package Net_SFTP - */ -class Net_SFTP extends Net_SSH2 { - /** - * Packet Types - * - * @see Net_SFTP::Net_SFTP() - * @var Array - * @access private - */ - var $packet_types = array(); - - /** - * Status Codes - * - * @see Net_SFTP::Net_SFTP() - * @var Array - * @access private - */ - var $status_codes = array(); - - /** - * The Request ID - * - * The request ID exists in the off chance that a packet is sent out-of-order. Of course, this library doesn't support - * concurrent actions, so it's somewhat academic, here. - * - * @var Integer - * @see Net_SFTP::_send_sftp_packet() - * @access private - */ - var $request_id = false; - - /** - * The Packet Type - * - * The request ID exists in the off chance that a packet is sent out-of-order. Of course, this library doesn't support - * concurrent actions, so it's somewhat academic, here. - * - * @var Integer - * @see Net_SFTP::_get_sftp_packet() - * @access private - */ - var $packet_type = -1; - - /** - * Packet Buffer - * - * @var String - * @see Net_SFTP::_get_sftp_packet() - * @access private - */ - var $packet_buffer = ''; - - /** - * Extensions supported by the server - * - * @var Array - * @see Net_SFTP::_initChannel() - * @access private - */ - var $extensions = array(); - - /** - * Server SFTP version - * - * @var Integer - * @see Net_SFTP::_initChannel() - * @access private - */ - var $version; - - /** - * Current working directory - * - * @var String - * @see Net_SFTP::_realpath() - * @see Net_SFTP::chdir() - * @access private - */ - var $pwd = false; - - /** - * Packet Type Log - * - * @see Net_SFTP::getLog() - * @var Array - * @access private - */ - var $packet_type_log = array(); - - /** - * Packet Log - * - * @see Net_SFTP::getLog() - * @var Array - * @access private - */ - var $packet_log = array(); - - /** - * Error information - * - * @see Net_SFTP::getSFTPErrors() - * @see Net_SFTP::getLastSFTPError() - * @var String - * @access private - */ - var $errors = array(); - - /** - * Default Constructor. - * - * Connects to an SFTP server - * - * @param String $host - * @param optional Integer $port - * @param optional Integer $timeout - * @return Net_SFTP - * @access public - */ - function Net_SFTP($host, $port = 22, $timeout = 10) - { - parent::Net_SSH2($host, $port, $timeout); - $this->packet_types = array( - 1 => 'NET_SFTP_INIT', - 2 => 'NET_SFTP_VERSION', - /* the format of SSH_FXP_OPEN changed between SFTPv4 and SFTPv5+: - SFTPv5+: http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.1.1 - pre-SFTPv5 : http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-6.3 */ - 3 => 'NET_SFTP_OPEN', - 4 => 'NET_SFTP_CLOSE', - 5 => 'NET_SFTP_READ', - 6 => 'NET_SFTP_WRITE', - 8 => 'NET_SFTP_FSTAT', - 9 => 'NET_SFTP_SETSTAT', - 11 => 'NET_SFTP_OPENDIR', - 12 => 'NET_SFTP_READDIR', - 13 => 'NET_SFTP_REMOVE', - 14 => 'NET_SFTP_MKDIR', - 15 => 'NET_SFTP_RMDIR', - 16 => 'NET_SFTP_REALPATH', - 17 => 'NET_SFTP_STAT', - /* the format of SSH_FXP_RENAME changed between SFTPv4 and SFTPv5+: - SFTPv5+: http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.3 - pre-SFTPv5 : http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-6.5 */ - 18 => 'NET_SFTP_RENAME', - - 101=> 'NET_SFTP_STATUS', - 102=> 'NET_SFTP_HANDLE', - /* the format of SSH_FXP_NAME changed between SFTPv3 and SFTPv4+: - SFTPv4+: http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-9.4 - pre-SFTPv4 : http://tools.ietf.org/html/draft-ietf-secsh-filexfer-02#section-7 */ - 103=> 'NET_SFTP_DATA', - 104=> 'NET_SFTP_NAME', - 105=> 'NET_SFTP_ATTRS', - - 200=> 'NET_SFTP_EXTENDED' - ); - $this->status_codes = array( - 0 => 'NET_SFTP_STATUS_OK', - 1 => 'NET_SFTP_STATUS_EOF', - 2 => 'NET_SFTP_STATUS_NO_SUCH_FILE', - 3 => 'NET_SFTP_STATUS_PERMISSION_DENIED', - 4 => 'NET_SFTP_STATUS_FAILURE', - 5 => 'NET_SFTP_STATUS_BAD_MESSAGE', - 6 => 'NET_SFTP_STATUS_NO_CONNECTION', - 7 => 'NET_SFTP_STATUS_CONNECTION_LOST', - 8 => 'NET_SFTP_STATUS_OP_UNSUPPORTED' - ); - // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-7.1 - // the order, in this case, matters quite a lot - see Net_SFTP::_parseAttributes() to understand why - $this->attributes = array( - 0x00000001 => 'NET_SFTP_ATTR_SIZE', - 0x00000002 => 'NET_SFTP_ATTR_UIDGID', // defined in SFTPv3, removed in SFTPv4+ - 0x00000004 => 'NET_SFTP_ATTR_PERMISSIONS', - 0x00000008 => 'NET_SFTP_ATTR_ACCESSTIME', - -1 => 'NET_SFTP_ATTR_EXTENDED' // unpack('N', "\xFF\xFF\xFF\xFF") == array(1 => int(-1)) - ); - // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-6.3 - // the flag definitions change somewhat in SFTPv5+. if SFTPv5+ support is added to this library, maybe name - // the array for that $this->open5_flags and similarily alter the constant names. - $this->open_flags = array( - 0x00000001 => 'NET_SFTP_OPEN_READ', - 0x00000002 => 'NET_SFTP_OPEN_WRITE', - 0x00000008 => 'NET_SFTP_OPEN_CREATE', - 0x00000010 => 'NET_SFTP_OPEN_TRUNCATE' - ); - $this->_define_array( - $this->packet_types, - $this->status_codes, - $this->attributes, - $this->open_flags - ); - } - - /** - * Login - * - * @param String $username - * @param optional String $password - * @return Boolean - * @access public - */ - function login($username, $password = '') - { - if (!parent::login($username, $password)) { - return false; - } - - $this->window_size_client_to_server[NET_SFTP_CHANNEL] = $this->window_size; - - $packet = pack('CNa*N3', - NET_SSH2_MSG_CHANNEL_OPEN, strlen('session'), 'session', NET_SFTP_CHANNEL, $this->window_size, 0x4000); - - if (!$this->_send_binary_packet($packet)) { - return false; - } - - $this->channel_status[NET_SFTP_CHANNEL] = NET_SSH2_MSG_CHANNEL_OPEN; - - $response = $this->_get_channel_packet(NET_SFTP_CHANNEL); - if ($response === false) { - return false; - } - - $packet = pack('CNNa*CNa*', - NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[NET_SFTP_CHANNEL], strlen('subsystem'), 'subsystem', 1, strlen('sftp'), 'sftp'); - if (!$this->_send_binary_packet($packet)) { - return false; - } - - $this->channel_status[NET_SFTP_CHANNEL] = NET_SSH2_MSG_CHANNEL_REQUEST; - - $response = $this->_get_channel_packet(NET_SFTP_CHANNEL); - if ($response === false) { - return false; - } - - $this->channel_status[NET_SFTP_CHANNEL] = NET_SSH2_MSG_CHANNEL_DATA; - - if (!$this->_send_sftp_packet(NET_SFTP_INIT, "\0\0\0\3")) { - return false; - } - - $response = $this->_get_sftp_packet(); - if ($this->packet_type != NET_SFTP_VERSION) { - user_error('Expected SSH_FXP_VERSION', E_USER_NOTICE); - return false; - } - - extract(unpack('Nversion', $this->_string_shift($response, 4))); - $this->version = $version; - while (!empty($response)) { - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $key = $this->_string_shift($response, $length); - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $value = $this->_string_shift($response, $length); - $this->extensions[$key] = $value; - } - - /* - SFTPv4+ defines a 'newline' extension. SFTPv3 seems to have unofficial support for it via 'newline@vandyke.com', - however, I'm not sure what 'newline@vandyke.com' is supposed to do (the fact that it's unofficial means that it's - not in the official SFTPv3 specs) and 'newline@vandyke.com' / 'newline' are likely not drop-in substitutes for - one another due to the fact that 'newline' comes with a SSH_FXF_TEXT bitmask whereas it seems unlikely that - 'newline@vandyke.com' would. - */ - /* - if (isset($this->extensions['newline@vandyke.com'])) { - $this->extensions['newline'] = $this->extensions['newline@vandyke.com']; - unset($this->extensions['newline@vandyke.com']); - } - */ - - $this->request_id = 1; - - /* - A Note on SFTPv4/5/6 support: - <http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-5.1> states the following: - - "If the client wishes to interoperate with servers that support noncontiguous version - numbers it SHOULD send '3'" - - Given that the server only sends its version number after the client has already done so, the above - seems to be suggesting that v3 should be the default version. This makes sense given that v3 is the - most popular. - - <http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-5.5> states the following; - - "If the server did not send the "versions" extension, or the version-from-list was not included, the - server MAY send a status response describing the failure, but MUST then close the channel without - processing any further requests." - - So what do you do if you have a client whose initial SSH_FXP_INIT packet says it implements v3 and - a server whose initial SSH_FXP_VERSION reply says it implements v4 and only v4? If it only implements - v4, the "versions" extension is likely not going to have been sent so version re-negotiation as discussed - in draft-ietf-secsh-filexfer-13 would be quite impossible. As such, what Net_SFTP would do is close the - channel and reopen it with a new and updated SSH_FXP_INIT packet. - */ - if ($this->version != 3) { - return false; - } - - $this->pwd = $this->_realpath('.'); - - return true; - } - - /** - * Returns the current directory name - * - * @return Mixed - * @access public - */ - function pwd() - { - return $this->pwd; - } - - /** - * Canonicalize the Server-Side Path Name - * - * SFTP doesn't provide a mechanism by which the current working directory can be changed, so we'll emulate it. Returns - * the absolute (canonicalized) path. If $mode is set to NET_SFTP_CONFIRM_DIR (as opposed to NET_SFTP_CONFIRM_NONE, - * which is what it is set to by default), false is returned if $dir is not a valid directory. - * - * @see Net_SFTP::chdir() - * @param String $dir - * @param optional Integer $mode - * @return Mixed - * @access private - */ - function _realpath($dir) - { - /* - "This protocol represents file names as strings. File names are - assumed to use the slash ('/') character as a directory separator. - - File names starting with a slash are "absolute", and are relative to - the root of the file system. Names starting with any other character - are relative to the user's default directory (home directory). Note - that identifying the user is assumed to take place outside of this - protocol." - - -- http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-6 - */ - $file = ''; - if ($this->pwd !== false) { - // if the SFTP server returned the canonicalized path even for non-existant files this wouldn't be necessary - // on OpenSSH it isn't necessary but on other SFTP servers it is. that and since the specs say nothing on - // the subject, we'll go ahead and work around it with the following. - if ($dir[strlen($dir) - 1] != '/') { - $file = basename($dir); - $dir = dirname($dir); - } - - if ($dir == '.' || $dir == $this->pwd) { - return $this->pwd . $file; - } - - if ($dir[0] != '/') { - $dir = $this->pwd . '/' . $dir; - } - // on the surface it seems like maybe resolving a path beginning with / is unnecessary, but such paths - // can contain .'s and ..'s just like any other. we could parse those out as appropriate or we can let - // the server do it. we'll do the latter. - } - - /* - that SSH_FXP_REALPATH returns SSH_FXP_NAME does not necessarily mean that anything actually exists at the - specified path. generally speaking, no attributes are returned with this particular SSH_FXP_NAME packet - regardless of whether or not a file actually exists. and in SFTPv3, the longname field and the filename - field match for this particular SSH_FXP_NAME packet. for other SSH_FXP_NAME packets, this will likely - not be the case, but for this one, it is. - */ - // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.9 - if (!$this->_send_sftp_packet(NET_SFTP_REALPATH, pack('Na*', strlen($dir), $dir))) { - return false; - } - - $response = $this->_get_sftp_packet(); - switch ($this->packet_type) { - case NET_SFTP_NAME: - // although SSH_FXP_NAME is implemented differently in SFTPv3 than it is in SFTPv4+, the following - // should work on all SFTP versions since the only part of the SSH_FXP_NAME packet the following looks - // at is the first part and that part is defined the same in SFTP versions 3 through 6. - $this->_string_shift($response, 4); // skip over the count - it should be 1, anyway - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $realpath = $this->_string_shift($response, $length); - break; - case NET_SFTP_STATUS: - extract(unpack('Nstatus/Nlength', $this->_string_shift($response, 8))); - $this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length); - return false; - default: - user_error('Expected SSH_FXP_NAME or SSH_FXP_STATUS', E_USER_NOTICE); - return false; - } - - // if $this->pwd isn't set than the only thing $realpath could be is for '.', which is pretty much guaranteed to - // be a bonafide directory - return $realpath . '/' . $file; - } - - /** - * Changes the current directory - * - * @param String $dir - * @return Boolean - * @access public - */ - function chdir($dir) - { - if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) { - return false; - } - - if ($dir[strlen($dir) - 1] != '/') { - $dir.= '/'; - } - $dir = $this->_realpath($dir); - - // confirm that $dir is, in fact, a valid directory - if (!$this->_send_sftp_packet(NET_SFTP_OPENDIR, pack('Na*', strlen($dir), $dir))) { - return false; - } - - // see Net_SFTP::nlist() for a more thorough explanation of the following - $response = $this->_get_sftp_packet(); - switch ($this->packet_type) { - case NET_SFTP_HANDLE: - $handle = substr($response, 4); - break; - case NET_SFTP_STATUS: - extract(unpack('Nstatus/Nlength', $this->_string_shift($response, 8))); - $this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length); - return false; - default: - user_error('Expected SSH_FXP_HANDLE or SSH_FXP_STATUS', E_USER_NOTICE); - return false; - } - - if (!$this->_send_sftp_packet(NET_SFTP_CLOSE, pack('Na*', strlen($handle), $handle))) { - return false; - } - - $response = $this->_get_sftp_packet(); - if ($this->packet_type != NET_SFTP_STATUS) { - user_error('Expected SSH_FXP_STATUS', E_USER_NOTICE); - return false; - } - - extract(unpack('Nstatus', $this->_string_shift($response, 4))); - if ($status != NET_SFTP_STATUS_OK) { - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length); - return false; - } - - $this->pwd = $dir; - return true; - } - - /** - * Returns a list of files in the given directory - * - * @param optional String $dir - * @return Mixed - * @access public - */ - function nlist($dir = '.') - { - return $this->_list($dir, false); - } - - /** - * Returns a list of files in the given directory - * - * @param optional String $dir - * @return Mixed - * @access public - */ - function rawlist($dir = '.') - { - return $this->_list($dir, true); - } - - function _list($dir, $raw = true) - { - if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) { - return false; - } - - $dir = $this->_realpath($dir); - if ($dir === false) { - return false; - } - - // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.1.2 - if (!$this->_send_sftp_packet(NET_SFTP_OPENDIR, pack('Na*', strlen($dir), $dir))) { - return false; - } - - $response = $this->_get_sftp_packet(); - switch ($this->packet_type) { - case NET_SFTP_HANDLE: - // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-9.2 - // since 'handle' is the last field in the SSH_FXP_HANDLE packet, we'll just remove the first four bytes that - // represent the length of the string and leave it at that - $handle = substr($response, 4); - break; - case NET_SFTP_STATUS: - // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED - extract(unpack('Nstatus/Nlength', $this->_string_shift($response, 8))); - $this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length); - return false; - default: - user_error('Expected SSH_FXP_HANDLE or SSH_FXP_STATUS', E_USER_NOTICE); - return false; - } - - $contents = array(); - while (true) { - // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.2.2 - // why multiple SSH_FXP_READDIR packets would be sent when the response to a single one can span arbitrarily many - // SSH_MSG_CHANNEL_DATA messages is not known to me. - if (!$this->_send_sftp_packet(NET_SFTP_READDIR, pack('Na*', strlen($handle), $handle))) { - return false; - } - - $response = $this->_get_sftp_packet(); - switch ($this->packet_type) { - case NET_SFTP_NAME: - extract(unpack('Ncount', $this->_string_shift($response, 4))); - for ($i = 0; $i < $count; $i++) { - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $shortname = $this->_string_shift($response, $length); - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $this->_string_shift($response, $length); // SFTPv4+ drop this field - the "longname" field - $attributes = $this->_parseAttributes($response); // we also don't care about the attributes - if (!$raw) { - $contents[] = $shortname; - } else { - $contents[$shortname] = $attributes; - } - // SFTPv6 has an optional boolean end-of-list field, but we'll ignore that, since the - // final SSH_FXP_STATUS packet should tell us that, already. - } - break; - case NET_SFTP_STATUS: - extract(unpack('Nstatus', $this->_string_shift($response, 4))); - if ($status != NET_SFTP_STATUS_EOF) { - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length); - return false; - } - break 2; - default: - user_error('Expected SSH_FXP_NAME or SSH_FXP_STATUS', E_USER_NOTICE); - return false; - } - } - - if (!$this->_send_sftp_packet(NET_SFTP_CLOSE, pack('Na*', strlen($handle), $handle))) { - return false; - } - - // "The client MUST release all resources associated with the handle regardless of the status." - // -- http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.1.3 - $response = $this->_get_sftp_packet(); - if ($this->packet_type != NET_SFTP_STATUS) { - user_error('Expected SSH_FXP_STATUS', E_USER_NOTICE); - return false; - } - - extract(unpack('Nstatus', $this->_string_shift($response, 4))); - if ($status != NET_SFTP_STATUS_OK) { - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length); - return false; - } - - return $contents; - } - - /** - * Returns the file size, in bytes, or false, on failure - * - * Files larger than 4GB will show up as being exactly 4GB. - * - * @param optional String $dir - * @return Mixed - * @access public - */ - function size($filename) - { - if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) { - return false; - } - - $filename = $this->_realpath($filename); - if ($filename === false) { - return false; - } - - // SFTPv4+ adds an additional 32-bit integer field - flags - to the following: - $packet = pack('Na*', strlen($filename), $filename); - if (!$this->_send_sftp_packet(NET_SFTP_STAT, $packet)) { - return false; - } - - $response = $this->_get_sftp_packet(); - switch ($this->packet_type) { - case NET_SFTP_ATTRS: - $attrs = $this->_parseAttributes($response); - return $attrs['size']; - case NET_SFTP_STATUS: - extract(unpack('Nstatus/Nlength', $this->_string_shift($response, 8))); - $this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length); - return false; - } - - user_error('Expected SSH_FXP_ATTRS or SSH_FXP_STATUS', E_USER_NOTICE); - return false; - } - - /** - * Set permissions on a file. - * - * Returns the new file permissions on success or FALSE on error. - * - * @param Integer $mode - * @param String $filename - * @return Mixed - * @access public - */ - function chmod($mode, $filename) - { - if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) { - return false; - } - - $filename = $this->_realpath($filename); - if ($filename === false) { - return false; - } - - // SFTPv4+ has an additional byte field - type - that would need to be sent, as well. setting it to - // SSH_FILEXFER_TYPE_UNKNOWN might work. if not, we'd have to do an SSH_FXP_STAT before doing an SSH_FXP_SETSTAT. - $attr = pack('N2', NET_SFTP_ATTR_PERMISSIONS, $mode & 07777); - if (!$this->_send_sftp_packet(NET_SFTP_SETSTAT, pack('Na*a*', strlen($filename), $filename, $attr))) { - return false; - } - - /* - "Because some systems must use separate system calls to set various attributes, it is possible that a failure - response will be returned, but yet some of the attributes may be have been successfully modified. If possible, - servers SHOULD avoid this situation; however, clients MUST be aware that this is possible." - - -- http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.6 - */ - $response = $this->_get_sftp_packet(); - if ($this->packet_type != NET_SFTP_STATUS) { - user_error('Expected SSH_FXP_STATUS', E_USER_NOTICE); - return false; - } - - extract(unpack('Nstatus', $this->_string_shift($response, 4))); - if ($status != NET_SFTP_STATUS_EOF) { - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length); - } - - // rather than return what the permissions *should* be, we'll return what they actually are. this will also - // tell us if the file actually exists. - // incidentally, SFTPv4+ adds an additional 32-bit integer field - flags - to the following: - $packet = pack('Na*', strlen($filename), $filename); - if (!$this->_send_sftp_packet(NET_SFTP_STAT, $packet)) { - return false; - } - - $response = $this->_get_sftp_packet(); - switch ($this->packet_type) { - case NET_SFTP_ATTRS: - $attrs = $this->_parseAttributes($response); - return $attrs['permissions']; - case NET_SFTP_STATUS: - extract(unpack('Nstatus/Nlength', $this->_string_shift($response, 8))); - $this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length); - return false; - } - - user_error('Expected SSH_FXP_ATTRS or SSH_FXP_STATUS', E_USER_NOTICE); - return false; - } - - /** - * Creates a directory. - * - * @param String $dir - * @return Boolean - * @access public - */ - function mkdir($dir) - { - if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) { - return false; - } - - $dir = $this->_realpath(rtrim($dir, '/')); - if ($dir === false) { - return false; - } - - // by not providing any permissions, hopefully the server will use the logged in users umask - their - // default permissions. - if (!$this->_send_sftp_packet(NET_SFTP_MKDIR, pack('Na*N', strlen($dir), $dir, 0))) { - return false; - } - - $response = $this->_get_sftp_packet(); - if ($this->packet_type != NET_SFTP_STATUS) { - user_error('Expected SSH_FXP_STATUS', E_USER_NOTICE); - return false; - } - - extract(unpack('Nstatus', $this->_string_shift($response, 4))); - if ($status != NET_SFTP_STATUS_OK) { - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length); - return false; - } - - return true; - } - - /** - * Removes a directory. - * - * @param String $dir - * @return Boolean - * @access public - */ - function rmdir($dir) - { - if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) { - return false; - } - - $dir = $this->_realpath($dir); - if ($dir === false) { - return false; - } - - if (!$this->_send_sftp_packet(NET_SFTP_RMDIR, pack('Na*', strlen($dir), $dir))) { - return false; - } - - $response = $this->_get_sftp_packet(); - if ($this->packet_type != NET_SFTP_STATUS) { - user_error('Expected SSH_FXP_STATUS', E_USER_NOTICE); - return false; - } - - extract(unpack('Nstatus', $this->_string_shift($response, 4))); - if ($status != NET_SFTP_STATUS_OK) { - // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED? - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length); - return false; - } - - return true; - } - - /** - * Uploads a file to the SFTP server. - * - * By default, Net_SFTP::put() does not read from the local filesystem. $data is dumped directly into $remote_file. - * So, for example, if you set $data to 'filename.ext' and then do Net_SFTP::get(), you will get a file, twelve bytes - * long, containing 'filename.ext' as its contents. - * - * Setting $mode to NET_SFTP_LOCAL_FILE will change the above behavior. With NET_SFTP_LOCAL_FILE, $remote_file will - * contain as many bytes as filename.ext does on your local filesystem. If your filename.ext is 1MB then that is how - * large $remote_file will be, as well. - * - * Currently, only binary mode is supported. As such, if the line endings need to be adjusted, you will need to take - * care of that, yourself. - * - * @param String $remote_file - * @param String $data - * @param optional Integer $flags - * @return Boolean - * @access public - * @internal ASCII mode for SFTPv4/5/6 can be supported by adding a new function - Net_SFTP::setMode(). - */ - function put($remote_file, $data, $mode = NET_SFTP_STRING) - { - if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) { - return false; - } - - $remote_file = $this->_realpath($remote_file); - if ($remote_file === false) { - return false; - } - - $packet = pack('Na*N2', strlen($remote_file), $remote_file, NET_SFTP_OPEN_WRITE | NET_SFTP_OPEN_CREATE | NET_SFTP_OPEN_TRUNCATE, 0); - if (!$this->_send_sftp_packet(NET_SFTP_OPEN, $packet)) { - return false; - } - - $response = $this->_get_sftp_packet(); - switch ($this->packet_type) { - case NET_SFTP_HANDLE: - $handle = substr($response, 4); - break; - case NET_SFTP_STATUS: - extract(unpack('Nstatus/Nlength', $this->_string_shift($response, 8))); - $this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length); - return false; - default: - user_error('Expected SSH_FXP_HANDLE or SSH_FXP_STATUS', E_USER_NOTICE); - return false; - } - - $initialize = true; - - // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.2.3 - if ($mode == NET_SFTP_LOCAL_FILE) { - if (!is_file($data)) { - user_error("$data is not a valid file", E_USER_NOTICE); - return false; - } - $fp = fopen($data, 'rb'); - if (!$fp) { - return false; - } - $sent = 0; - $size = filesize($data); - } else { - $sent = 0; - $size = strlen($data); - } - - $size = $size < 0 ? ($size & 0x7FFFFFFF) + 0x80000000 : $size; - - $sftp_packet_size = 34000; // PuTTY uses 4096 - $i = 0; - while ($sent < $size) { - $temp = $mode == NET_SFTP_LOCAL_FILE ? fread($fp, $sftp_packet_size) : $this->_string_shift($data, $sftp_packet_size); - $packet = pack('Na*N3a*', strlen($handle), $handle, 0, $sent, strlen($temp), $temp); - if (!$this->_send_sftp_packet(NET_SFTP_WRITE, $packet)) { - fclose($fp); - return false; - } - $sent+= strlen($temp); - - $i++; - - if ($i == 50) { - if (!$this->_read_put_responses($i)) { - $i = 0; - break; - } - $i = 0; - } - } - - $this->_read_put_responses($i); - - if ($mode == NET_SFTP_LOCAL_FILE) { - fclose($fp); - } - - if (!$this->_send_sftp_packet(NET_SFTP_CLOSE, pack('Na*', strlen($handle), $handle))) { - return false; - } - - $response = $this->_get_sftp_packet(); - if ($this->packet_type != NET_SFTP_STATUS) { - user_error('Expected SSH_FXP_STATUS', E_USER_NOTICE); - return false; - } - - extract(unpack('Nstatus', $this->_string_shift($response, 4))); - if ($status != NET_SFTP_STATUS_OK) { - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length); - return false; - } - - return true; - } - - /** - * Reads multiple successive SSH_FXP_WRITE responses - * - * Sending an SSH_FXP_WRITE packet and immediately reading its response isn't as efficient as blindly sending out $i - * SSH_FXP_WRITEs, in succession, and then reading $i responses. - * - * @param Integer $i - * @return Boolean - * @access private - */ - function _read_put_responses($i) - { - while ($i--) { - $response = $this->_get_sftp_packet(); - if ($this->packet_type != NET_SFTP_STATUS) { - user_error('Expected SSH_FXP_STATUS', E_USER_NOTICE); - return false; - } - - extract(unpack('Nstatus', $this->_string_shift($response, 4))); - if ($status != NET_SFTP_STATUS_OK) { - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length); - break; - } - } - - return $i < 0; - } - - /** - * Downloads a file from the SFTP server. - * - * Returns a string containing the contents of $remote_file if $local_file is left undefined or a boolean false if - * the operation was unsuccessful. If $local_file is defined, returns true or false depending on the success of the - * operation - * - * @param String $remote_file - * @param optional String $local_file - * @return Mixed - * @access public - */ - function get($remote_file, $local_file = false) - { - if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) { - return false; - } - - $remote_file = $this->_realpath($remote_file); - if ($remote_file === false) { - return false; - } - - $packet = pack('Na*N2', strlen($remote_file), $remote_file, NET_SFTP_OPEN_READ, 0); - if (!$this->_send_sftp_packet(NET_SFTP_OPEN, $packet)) { - return false; - } - - $response = $this->_get_sftp_packet(); - switch ($this->packet_type) { - case NET_SFTP_HANDLE: - $handle = substr($response, 4); - break; - case NET_SFTP_STATUS: // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED - extract(unpack('Nstatus/Nlength', $this->_string_shift($response, 8))); - $this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length); - return false; - default: - user_error('Expected SSH_FXP_HANDLE or SSH_FXP_STATUS', E_USER_NOTICE); - return false; - } - - $packet = pack('Na*', strlen($handle), $handle); - if (!$this->_send_sftp_packet(NET_SFTP_FSTAT, $packet)) { - return false; - } - - $response = $this->_get_sftp_packet(); - switch ($this->packet_type) { - case NET_SFTP_ATTRS: - $attrs = $this->_parseAttributes($response); - break; - case NET_SFTP_STATUS: - extract(unpack('Nstatus/Nlength', $this->_string_shift($response, 8))); - $this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length); - return false; - default: - user_error('Expected SSH_FXP_ATTRS or SSH_FXP_STATUS', E_USER_NOTICE); - return false; - } - - if ($local_file !== false) { - $fp = fopen($local_file, 'wb'); - if (!$fp) { - return false; - } - } else { - $content = ''; - } - - $read = 0; - while ($read < $attrs['size']) { - $packet = pack('Na*N3', strlen($handle), $handle, 0, $read, 1 << 20); - if (!$this->_send_sftp_packet(NET_SFTP_READ, $packet)) { - return false; - } - - $response = $this->_get_sftp_packet(); - switch ($this->packet_type) { - case NET_SFTP_DATA: - $temp = substr($response, 4); - $read+= strlen($temp); - if ($local_file === false) { - $content.= $temp; - } else { - fputs($fp, $temp); - } - break; - case NET_SFTP_STATUS: - extract(unpack('Nstatus/Nlength', $this->_string_shift($response, 8))); - $this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length); - break 2; - default: - user_error('Expected SSH_FXP_DATA or SSH_FXP_STATUS', E_USER_NOTICE); - return false; - } - } - - if (!$this->_send_sftp_packet(NET_SFTP_CLOSE, pack('Na*', strlen($handle), $handle))) { - return false; - } - - $response = $this->_get_sftp_packet(); - if ($this->packet_type != NET_SFTP_STATUS) { - user_error('Expected SSH_FXP_STATUS', E_USER_NOTICE); - return false; - } - - extract(unpack('Nstatus', $this->_string_shift($response, 4))); - if ($status != NET_SFTP_STATUS_OK) { - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length); - return false; - } - - if (isset($content)) { - return $content; - } - - fclose($fp); - return true; - } - - /** - * Deletes a file on the SFTP server. - * - * @param String $path - * @return Boolean - * @access public - */ - function delete($path) - { - if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) { - return false; - } - - $remote_file = $this->_realpath($path); - if ($path === false) { - return false; - } - - // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.3 - if (!$this->_send_sftp_packet(NET_SFTP_REMOVE, pack('Na*', strlen($path), $path))) { - return false; - } - - $response = $this->_get_sftp_packet(); - if ($this->packet_type != NET_SFTP_STATUS) { - user_error('Expected SSH_FXP_STATUS', E_USER_NOTICE); - return false; - } - - // if $status isn't SSH_FX_OK it's probably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED - extract(unpack('Nstatus', $this->_string_shift($response, 4))); - if ($status != NET_SFTP_STATUS_OK) { - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length); - return false; - } - - return true; - } - - /** - * Renames a file or a directory on the SFTP server - * - * @param String $oldname - * @param String $newname - * @return Boolean - * @access public - */ - function rename($oldname, $newname) - { - if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) { - return false; - } - - $oldname = $this->_realpath($oldname); - $newname = $this->_realpath($newname); - if ($oldname === false || $newname === false) { - return false; - } - - // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.3 - $packet = pack('Na*Na*', strlen($oldname), $oldname, strlen($newname), $newname); - if (!$this->_send_sftp_packet(NET_SFTP_RENAME, $packet)) { - return false; - } - - $response = $this->_get_sftp_packet(); - if ($this->packet_type != NET_SFTP_STATUS) { - user_error('Expected SSH_FXP_STATUS', E_USER_NOTICE); - return false; - } - - // if $status isn't SSH_FX_OK it's probably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED - extract(unpack('Nstatus', $this->_string_shift($response, 4))); - if ($status != NET_SFTP_STATUS_OK) { - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $this->sftp_errors[] = $this->status_codes[$status] . ': ' . $this->_string_shift($response, $length); - return false; - } - - return true; - } - - /** - * Parse Attributes - * - * See '7. File Attributes' of draft-ietf-secsh-filexfer-13 for more info. - * - * @param String $response - * @return Array - * @access private - */ - function _parseAttributes(&$response) - { - $attr = array(); - extract(unpack('Nflags', $this->_string_shift($response, 4))); - // SFTPv4+ have a type field (a byte) that follows the above flag field - foreach ($this->attributes as $key => $value) { - switch ($flags & $key) { - case NET_SFTP_ATTR_SIZE: // 0x00000001 - // size is represented by a 64-bit integer, so we perhaps ought to be doing the following: - // $attr['size'] = new Math_BigInteger($this->_string_shift($response, 8), 256); - // of course, you shouldn't be using Net_SFTP to transfer files that are in excess of 4GB - // (0xFFFFFFFF bytes), anyway. as such, we'll just represent all file sizes that are bigger than - // 4GB as being 4GB. - extract(unpack('Nupper/Nsize', $this->_string_shift($response, 8))); - if ($upper) { - $attr['size'] = 0xFFFFFFFF; - } else { - $attr['size'] = $size < 0 ? ($size & 0x7FFFFFFF) + 0x80000000 : $size; - } - break; - case NET_SFTP_ATTR_UIDGID: // 0x00000002 (SFTPv3 only) - $attr+= unpack('Nuid/Ngid', $this->_string_shift($response, 8)); - break; - case NET_SFTP_ATTR_PERMISSIONS: // 0x00000004 - $attr+= unpack('Npermissions', $this->_string_shift($response, 4)); - break; - case NET_SFTP_ATTR_ACCESSTIME: // 0x00000008 - $attr+= unpack('Natime/Nmtime', $this->_string_shift($response, 8)); - break; - case NET_SFTP_ATTR_EXTENDED: // 0x80000000 - extract(unpack('Ncount', $this->_string_shift($response, 4))); - for ($i = 0; $i < $count; $i++) { - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $key = $this->_string_shift($response, $length); - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $attr[$key] = $this->_string_shift($response, $length); - } - } - } - return $attr; - } - - /** - * Sends SFTP Packets - * - * See '6. General Packet Format' of draft-ietf-secsh-filexfer-13 for more info. - * - * @param Integer $type - * @param String $data - * @see Net_SFTP::_get_sftp_packet() - * @see Net_SSH2::_send_channel_packet() - * @return Boolean - * @access private - */ - function _send_sftp_packet($type, $data) - { - $packet = $this->request_id !== false ? - pack('NCNa*', strlen($data) + 5, $type, $this->request_id, $data) : - pack('NCa*', strlen($data) + 1, $type, $data); - - $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838 - $result = $this->_send_channel_packet(NET_SFTP_CHANNEL, $packet); - $stop = strtok(microtime(), ' ') + strtok(''); - - if (defined('NET_SFTP_LOGGING')) { - $this->packet_type_log[] = '-> ' . $this->packet_types[$type] . - ' (' . round($stop - $start, 4) . 's)'; - if (NET_SFTP_LOGGING == NET_SFTP_LOG_COMPLEX) { - $this->packet_log[] = $data; - } - } - - return $result; - } - - /** - * Receives SFTP Packets - * - * See '6. General Packet Format' of draft-ietf-secsh-filexfer-13 for more info. - * - * Incidentally, the number of SSH_MSG_CHANNEL_DATA messages has no bearing on the number of SFTP packets present. - * There can be one SSH_MSG_CHANNEL_DATA messages containing two SFTP packets or there can be two SSH_MSG_CHANNEL_DATA - * messages containing one SFTP packet. - * - * @see Net_SFTP::_send_sftp_packet() - * @return String - * @access private - */ - function _get_sftp_packet() - { - $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838 - - // SFTP packet length - while (strlen($this->packet_buffer) < 4) { - $temp = $this->_get_channel_packet(NET_SFTP_CHANNEL); - if (is_bool($temp)) { - $this->packet_type = false; - $this->packet_buffer = ''; - return false; - } - $this->packet_buffer.= $temp; - } - extract(unpack('Nlength', $this->_string_shift($this->packet_buffer, 4))); - $tempLength = $length; - $tempLength-= strlen($this->packet_buffer); - - // SFTP packet type and data payload - while ($tempLength > 0) { - $temp = $this->_get_channel_packet(NET_SFTP_CHANNEL); - if (is_bool($temp)) { - $this->packet_type = false; - $this->packet_buffer = ''; - return false; - } - $this->packet_buffer.= $temp; - $tempLength-= strlen($temp); - } - - $stop = strtok(microtime(), ' ') + strtok(''); - - $this->packet_type = ord($this->_string_shift($this->packet_buffer)); - - if ($this->request_id !== false) { - $this->_string_shift($this->packet_buffer, 4); // remove the request id - $length-= 5; // account for the request id and the packet type - } else { - $length-= 1; // account for the packet type - } - - $packet = $this->_string_shift($this->packet_buffer, $length); - - if (defined('NET_SFTP_LOGGING')) { - $this->packet_type_log[] = '<- ' . $this->packet_types[$this->packet_type] . - ' (' . round($stop - $start, 4) . 's)'; - if (NET_SFTP_LOGGING == NET_SFTP_LOG_COMPLEX) { - $this->packet_log[] = $packet; - } - } - - return $packet; - } - - /** - * Returns a log of the packets that have been sent and received. - * - * Returns a string if NET_SFTP_LOGGING == NET_SFTP_LOG_COMPLEX, an array if NET_SFTP_LOGGING == NET_SFTP_LOG_SIMPLE and false if !defined('NET_SFTP_LOGGING') - * - * @access public - * @return String or Array - */ - function getSFTPLog() - { - if (!defined('NET_SFTP_LOGGING')) { - return false; - } - - switch (NET_SFTP_LOGGING) { - case NET_SFTP_LOG_COMPLEX: - return $this->_format_log($this->packet_log, $this->packet_type_log); - break; - //case NET_SFTP_LOG_SIMPLE: - default: - return $this->packet_type_log; - } - } - - /** - * Returns all errors - * - * @return String - * @access public - */ - function getSFTPErrors() - { - return $this->sftp_errors; - } - - /** - * Returns the last error - * - * @return String - * @access public - */ - function getLastSFTPError() - { - return $this->sftp_errors[count($this->sftp_errors) - 1]; - } - - /** - * Get supported SFTP versions - * - * @return Array - * @access public - */ - function getSupportedVersions() - { - $temp = array('version' => $this->version); - if (isset($this->extensions['versions'])) { - $temp['extensions'] = $this->extensions['versions']; - } - return $temp; - } - - /** - * Disconnect - * - * @param Integer $reason - * @return Boolean - * @access private - */ - function _disconnect($reason) - { - $this->pwd = false; - parent::_disconnect($reason); - } -} diff --git a/lib/internal/phpseclib/Net/SSH1.php b/lib/internal/phpseclib/Net/SSH1.php deleted file mode 100644 index 1872700b452..00000000000 --- a/lib/internal/phpseclib/Net/SSH1.php +++ /dev/null @@ -1,1159 +0,0 @@ -<?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * Pure-PHP implementation of SSHv1. - * - * PHP versions 4 and 5 - * - * Here's a short example of how to use this library: - * <code> - * <?php - * include('Net/SSH1.php'); - * - * $ssh = new Net_SSH1('www.domain.tld'); - * if (!$ssh->login('username', 'password')) { - * exit('Login Failed'); - * } - * - * while (true) { - * echo $ssh->interactiveRead(); - * - * $read = array(STDIN); - * $write = $except = NULL; - * if (stream_select($read, $write, $except, 0)) { - * $ssh->interactiveWrite(fread(STDIN, 1)); - * } - * } - * ?> - * </code> - * - * Here's another short example: - * <code> - * <?php - * include('Net/SSH1.php'); - * - * $ssh = new Net_SSH1('www.domain.tld'); - * if (!$ssh->login('username', 'password')) { - * exit('Login Failed'); - * } - * - * echo $ssh->exec('ls -la'); - * ?> - * </code> - * - * More information on the SSHv1 specification can be found by reading - * {@link http://www.snailbook.com/docs/protocol-1.5.txt protocol-1.5.txt}. - * - * LICENSE: This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - * @category Net - * @package Net_SSH1 - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMVII Jim Wigginton - * @license http://www.gnu.org/licenses/lgpl.txt - * @version $Id: SSH1.php,v 1.15 2010/03/22 22:01:38 terrafrost Exp $ - * @link http://phpseclib.sourceforge.net - */ - -/** - * Include Math_BigInteger - * - * Used to do RSA encryption. - */ -require_once('phpseclib/Math/BigInteger.php'); - -/** - * Include Crypt_Null - */ -//require_once('Crypt/Null.php'); - -/** - * Include Crypt_DES - */ -require_once('phpseclib/Crypt/DES.php'); - -/** - * Include Crypt_TripleDES - */ -require_once('phpseclib/Crypt/TripleDES.php'); - -/** - * Include Crypt_RC4 - */ -require_once('phpseclib/Crypt/RC4.php'); - -/** - * Include Crypt_Random - */ -require_once('phpseclib/Crypt/Random.php'); - -/**#@+ - * Protocol Flags - * - * @access private - */ -define('NET_SSH1_MSG_DISCONNECT', 1); -define('NET_SSH1_SMSG_PUBLIC_KEY', 2); -define('NET_SSH1_CMSG_SESSION_KEY', 3); -define('NET_SSH1_CMSG_USER', 4); -define('NET_SSH1_CMSG_AUTH_PASSWORD', 9); -define('NET_SSH1_CMSG_REQUEST_PTY', 10); -define('NET_SSH1_CMSG_EXEC_SHELL', 12); -define('NET_SSH1_CMSG_EXEC_CMD', 13); -define('NET_SSH1_SMSG_SUCCESS', 14); -define('NET_SSH1_SMSG_FAILURE', 15); -define('NET_SSH1_CMSG_STDIN_DATA', 16); -define('NET_SSH1_SMSG_STDOUT_DATA', 17); -define('NET_SSH1_SMSG_STDERR_DATA', 18); -define('NET_SSH1_SMSG_EXITSTATUS', 20); -define('NET_SSH1_CMSG_EXIT_CONFIRMATION', 33); -/**#@-*/ - -/**#@+ - * Encryption Methods - * - * @see Net_SSH1::getSupportedCiphers() - * @access public - */ -/** - * No encryption - * - * Not supported. - */ -define('NET_SSH1_CIPHER_NONE', 0); -/** - * IDEA in CFB mode - * - * Not supported. - */ -define('NET_SSH1_CIPHER_IDEA', 1); -/** - * DES in CBC mode - */ -define('NET_SSH1_CIPHER_DES', 2); -/** - * Triple-DES in CBC mode - * - * All implementations are required to support this - */ -define('NET_SSH1_CIPHER_3DES', 3); -/** - * TRI's Simple Stream encryption CBC - * - * Not supported nor is it defined in the official SSH1 specs. OpenSSH, however, does define it (see cipher.h), - * although it doesn't use it (see cipher.c) - */ -define('NET_SSH1_CIPHER_BROKEN_TSS', 4); -/** - * RC4 - * - * Not supported. - * - * @internal According to the SSH1 specs: - * - * "The first 16 bytes of the session key are used as the key for - * the server to client direction. The remaining 16 bytes are used - * as the key for the client to server direction. This gives - * independent 128-bit keys for each direction." - * - * This library currently only supports encryption when the same key is being used for both directions. This is - * because there's only one $crypto object. Two could be added ($encrypt and $decrypt, perhaps). - */ -define('NET_SSH1_CIPHER_RC4', 5); -/** - * Blowfish - * - * Not supported nor is it defined in the official SSH1 specs. OpenSSH, however, defines it (see cipher.h) and - * uses it (see cipher.c) - */ -define('NET_SSH1_CIPHER_BLOWFISH', 6); -/**#@-*/ - -/**#@+ - * Authentication Methods - * - * @see Net_SSH1::getSupportedAuthentications() - * @access public - */ -/** - * .rhosts or /etc/hosts.equiv - */ -define('NET_SSH1_AUTH_RHOSTS', 1); -/** - * pure RSA authentication - */ -define('NET_SSH1_AUTH_RSA', 2); -/** - * password authentication - * - * This is the only method that is supported by this library. - */ -define('NET_SSH1_AUTH_PASSWORD', 3); -/** - * .rhosts with RSA host authentication - */ -define('NET_SSH1_AUTH_RHOSTS_RSA', 4); -/**#@-*/ - -/**#@+ - * Terminal Modes - * - * @link http://3sp.com/content/developer/maverick-net/docs/Maverick.SSH.PseudoTerminalModesMembers.html - * @access private - */ -define('NET_SSH1_TTY_OP_END', 0); -/**#@-*/ - -/** - * The Response Type - * - * @see Net_SSH1::_get_binary_packet() - * @access private - */ -define('NET_SSH1_RESPONSE_TYPE', 1); - -/** - * The Response Data - * - * @see Net_SSH1::_get_binary_packet() - * @access private - */ -define('NET_SSH1_RESPONSE_DATA', 2); - -/**#@+ - * Execution Bitmap Masks - * - * @see Net_SSH1::bitmap - * @access private - */ -define('NET_SSH1_MASK_CONSTRUCTOR', 0x00000001); -define('NET_SSH1_MASK_LOGIN', 0x00000002); -define('NET_SSH1_MASK_SHELL', 0x00000004); -/**#@-*/ - -/** - * Pure-PHP implementation of SSHv1. - * - * @author Jim Wigginton <terrafrost@php.net> - * @version 0.1.0 - * @access public - * @package Net_SSH1 - */ -class Net_SSH1 { - /** - * The SSH identifier - * - * @var String - * @access private - */ - var $identifier = 'SSH-1.5-phpseclib'; - - /** - * The Socket Object - * - * @var Object - * @access private - */ - var $fsock; - - /** - * The cryptography object - * - * @var Object - * @access private - */ - var $crypto = false; - - /** - * Execution Bitmap - * - * The bits that are set reprsent functions that have been called already. This is used to determine - * if a requisite function has been successfully executed. If not, an error should be thrown. - * - * @var Integer - * @access private - */ - var $bitmap = 0; - - /** - * The Server Key Public Exponent - * - * Logged for debug purposes - * - * @see Net_SSH1::getServerKeyPublicExponent() - * @var String - * @access private - */ - var $server_key_public_exponent; - - /** - * The Server Key Public Modulus - * - * Logged for debug purposes - * - * @see Net_SSH1::getServerKeyPublicModulus() - * @var String - * @access private - */ - var $server_key_public_modulus; - - /** - * The Host Key Public Exponent - * - * Logged for debug purposes - * - * @see Net_SSH1::getHostKeyPublicExponent() - * @var String - * @access private - */ - var $host_key_public_exponent; - - /** - * The Host Key Public Modulus - * - * Logged for debug purposes - * - * @see Net_SSH1::getHostKeyPublicModulus() - * @var String - * @access private - */ - var $host_key_public_modulus; - - /** - * Supported Ciphers - * - * Logged for debug purposes - * - * @see Net_SSH1::getSupportedCiphers() - * @var Array - * @access private - */ - var $supported_ciphers = array( - NET_SSH1_CIPHER_NONE => 'No encryption', - NET_SSH1_CIPHER_IDEA => 'IDEA in CFB mode', - NET_SSH1_CIPHER_DES => 'DES in CBC mode', - NET_SSH1_CIPHER_3DES => 'Triple-DES in CBC mode', - NET_SSH1_CIPHER_BROKEN_TSS => 'TRI\'s Simple Stream encryption CBC', - NET_SSH1_CIPHER_RC4 => 'RC4', - NET_SSH1_CIPHER_BLOWFISH => 'Blowfish' - ); - - /** - * Supported Authentications - * - * Logged for debug purposes - * - * @see Net_SSH1::getSupportedAuthentications() - * @var Array - * @access private - */ - var $supported_authentications = array( - NET_SSH1_AUTH_RHOSTS => '.rhosts or /etc/hosts.equiv', - NET_SSH1_AUTH_RSA => 'pure RSA authentication', - NET_SSH1_AUTH_PASSWORD => 'password authentication', - NET_SSH1_AUTH_RHOSTS_RSA => '.rhosts with RSA host authentication' - ); - - /** - * Server Identification - * - * @see Net_SSH1::getServerIdentification() - * @var String - * @access private - */ - var $server_identification = ''; - - /** - * Default Constructor. - * - * Connects to an SSHv1 server - * - * @param String $host - * @param optional Integer $port - * @param optional Integer $timeout - * @param optional Integer $cipher - * @return Net_SSH1 - * @access public - */ - function Net_SSH1($host, $port = 22, $timeout = 10, $cipher = NET_SSH1_CIPHER_3DES) - { - $this->fsock = @fsockopen($host, $port, $errno, $errstr, $timeout); - if (!$this->fsock) { - user_error(rtrim("Cannot connect to $host. Error $errno. $errstr"), E_USER_NOTICE); - return; - } - - $this->server_identification = $init_line = fgets($this->fsock, 255); - if (!preg_match('#SSH-([0-9\.]+)-(.+)#', $init_line, $parts)) { - user_error('Can only connect to SSH servers', E_USER_NOTICE); - return; - } - if ($parts[1][0] != 1) { - user_error("Cannot connect to SSH $parts[1] servers", E_USER_NOTICE); - return; - } - - fputs($this->fsock, $this->identifier."\r\n"); - - $response = $this->_get_binary_packet(); - if ($response[NET_SSH1_RESPONSE_TYPE] != NET_SSH1_SMSG_PUBLIC_KEY) { - user_error('Expected SSH_SMSG_PUBLIC_KEY', E_USER_NOTICE); - return; - } - - $anti_spoofing_cookie = $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 8); - - $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 4); - - $temp = unpack('nlen', $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 2)); - $server_key_public_exponent = new Math_BigInteger($this->_string_shift($response[NET_SSH1_RESPONSE_DATA], ceil($temp['len'] / 8)), 256); - $this->server_key_public_exponent = $server_key_public_exponent; - - $temp = unpack('nlen', $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 2)); - $server_key_public_modulus = new Math_BigInteger($this->_string_shift($response[NET_SSH1_RESPONSE_DATA], ceil($temp['len'] / 8)), 256); - $this->server_key_public_modulus = $server_key_public_modulus; - - $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 4); - - $temp = unpack('nlen', $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 2)); - $host_key_public_exponent = new Math_BigInteger($this->_string_shift($response[NET_SSH1_RESPONSE_DATA], ceil($temp['len'] / 8)), 256); - $this->host_key_public_exponent = $host_key_public_exponent; - - $temp = unpack('nlen', $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 2)); - $host_key_public_modulus = new Math_BigInteger($this->_string_shift($response[NET_SSH1_RESPONSE_DATA], ceil($temp['len'] / 8)), 256); - $this->host_key_public_modulus = $host_key_public_modulus; - - $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 4); - - // get a list of the supported ciphers - extract(unpack('Nsupported_ciphers_mask', $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 4))); - foreach ($this->supported_ciphers as $mask=>$name) { - if (($supported_ciphers_mask & (1 << $mask)) == 0) { - unset($this->supported_ciphers[$mask]); - } - } - - // get a list of the supported authentications - extract(unpack('Nsupported_authentications_mask', $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 4))); - foreach ($this->supported_authentications as $mask=>$name) { - if (($supported_authentications_mask & (1 << $mask)) == 0) { - unset($this->supported_authentications[$mask]); - } - } - - $session_id = pack('H*', md5($host_key_public_modulus->toBytes() . $server_key_public_modulus->toBytes() . $anti_spoofing_cookie)); - - $session_key = ''; - for ($i = 0; $i < 32; $i++) { - $session_key.= chr(crypt_random(0, 255)); - } - $double_encrypted_session_key = $session_key ^ str_pad($session_id, 32, chr(0)); - - if ($server_key_public_modulus->compare($host_key_public_modulus) < 0) { - $double_encrypted_session_key = $this->_rsa_crypt( - $double_encrypted_session_key, - array( - $server_key_public_exponent, - $server_key_public_modulus - ) - ); - $double_encrypted_session_key = $this->_rsa_crypt( - $double_encrypted_session_key, - array( - $host_key_public_exponent, - $host_key_public_modulus - ) - ); - } else { - $double_encrypted_session_key = $this->_rsa_crypt( - $double_encrypted_session_key, - array( - $host_key_public_exponent, - $host_key_public_modulus - ) - ); - $double_encrypted_session_key = $this->_rsa_crypt( - $double_encrypted_session_key, - array( - $server_key_public_exponent, - $server_key_public_modulus - ) - ); - } - - $cipher = isset($this->supported_ciphers[$cipher]) ? $cipher : NET_SSH1_CIPHER_3DES; - $data = pack('C2a*na*N', NET_SSH1_CMSG_SESSION_KEY, $cipher, $anti_spoofing_cookie, 8 * strlen($double_encrypted_session_key), $double_encrypted_session_key, 0); - - if (!$this->_send_binary_packet($data)) { - user_error('Error sending SSH_CMSG_SESSION_KEY', E_USER_NOTICE); - return; - } - - switch ($cipher) { - //case NET_SSH1_CIPHER_NONE: - // $this->crypto = new Crypt_Null(); - // break; - case NET_SSH1_CIPHER_DES: - $this->crypto = new Crypt_DES(); - $this->crypto->disablePadding(); - $this->crypto->enableContinuousBuffer(); - $this->crypto->setKey(substr($session_key, 0, 8)); - break; - case NET_SSH1_CIPHER_3DES: - $this->crypto = new Crypt_TripleDES(CRYPT_DES_MODE_3CBC); - $this->crypto->disablePadding(); - $this->crypto->enableContinuousBuffer(); - $this->crypto->setKey(substr($session_key, 0, 24)); - break; - //case NET_SSH1_CIPHER_RC4: - // $this->crypto = new Crypt_RC4(); - // $this->crypto->enableContinuousBuffer(); - // $this->crypto->setKey(substr($session_key, 0, 16)); - // break; - } - - $response = $this->_get_binary_packet(); - - if ($response[NET_SSH1_RESPONSE_TYPE] != NET_SSH1_SMSG_SUCCESS) { - user_error('Expected SSH_SMSG_SUCCESS', E_USER_NOTICE); - return; - } - - $this->bitmap = NET_SSH1_MASK_CONSTRUCTOR; - } - - /** - * Login - * - * @param String $username - * @param optional String $password - * @return Boolean - * @access public - */ - function login($username, $password = '') - { - if (!($this->bitmap & NET_SSH1_MASK_CONSTRUCTOR)) { - return false; - } - - $data = pack('CNa*', NET_SSH1_CMSG_USER, strlen($username), $username); - - if (!$this->_send_binary_packet($data)) { - user_error('Error sending SSH_CMSG_USER', E_USER_NOTICE); - return false; - } - - $response = $this->_get_binary_packet(); - - if ($response[NET_SSH1_RESPONSE_TYPE] == NET_SSH1_SMSG_SUCCESS) { - $this->bitmap |= NET_SSH1_MASK_LOGIN; - return true; - } else if ($response[NET_SSH1_RESPONSE_TYPE] != NET_SSH1_SMSG_FAILURE) { - user_error('Expected SSH_SMSG_SUCCESS or SSH_SMSG_FAILURE', E_USER_NOTICE); - return false; - } - - $data = pack('CNa*', NET_SSH1_CMSG_AUTH_PASSWORD, strlen($password), $password); - - if (!$this->_send_binary_packet($data)) { - user_error('Error sending SSH_CMSG_AUTH_PASSWORD', E_USER_NOTICE); - return false; - } - - $response = $this->_get_binary_packet(); - - if ($response[NET_SSH1_RESPONSE_TYPE] == NET_SSH1_SMSG_SUCCESS) { - $this->bitmap |= NET_SSH1_MASK_LOGIN; - return true; - } else if ($response[NET_SSH1_RESPONSE_TYPE] == NET_SSH1_SMSG_FAILURE) { - return false; - } else { - user_error('Expected SSH_SMSG_SUCCESS or SSH_SMSG_FAILURE', E_USER_NOTICE); - return false; - } - } - - /** - * Executes a command on a non-interactive shell, returns the output, and quits. - * - * An SSH1 server will close the connection after a command has been executed on a non-interactive shell. SSH2 - * servers don't, however, this isn't an SSH2 client. The way this works, on the server, is by initiating a - * shell with the -s option, as discussed in the following links: - * - * {@link http://www.faqs.org/docs/bashman/bashref_65.html http://www.faqs.org/docs/bashman/bashref_65.html} - * {@link http://www.faqs.org/docs/bashman/bashref_62.html http://www.faqs.org/docs/bashman/bashref_62.html} - * - * To execute further commands, a new Net_SSH1 object will need to be created. - * - * Returns false on failure and the output, otherwise. - * - * @see Net_SSH1::interactiveRead() - * @see Net_SSH1::interactiveWrite() - * @param String $cmd - * @return mixed - * @access public - */ - function exec($cmd) - { - if (!($this->bitmap & NET_SSH1_MASK_LOGIN)) { - user_error('Operation disallowed prior to login()', E_USER_NOTICE); - return false; - } - - // connect using the sample parameters in protocol-1.5.txt. - // according to wikipedia.org's entry on text terminals, "the fundamental type of application running on a text - // terminal is a command line interpreter or shell". thus, opening a terminal session to run the shell. - $data = pack('CNa*N4C', NET_SSH1_CMSG_REQUEST_PTY, strlen('vt100'), 'vt100', 24, 80, 0, 0, NET_SSH1_TTY_OP_END); - - if (!$this->_send_binary_packet($data)) { - user_error('Error sending SSH_CMSG_REQUEST_PTY', E_USER_NOTICE); - return false; - } - - $response = $this->_get_binary_packet(); - - if ($response[NET_SSH1_RESPONSE_TYPE] != NET_SSH1_SMSG_SUCCESS) { - user_error('Expected SSH_SMSG_SUCCESS', E_USER_NOTICE); - return false; - } - - $data = pack('CNa*', NET_SSH1_CMSG_EXEC_CMD, strlen($cmd), $cmd); - - if (!$this->_send_binary_packet($data)) { - user_error('Error sending SSH_CMSG_EXEC_CMD', E_USER_NOTICE); - return false; - } - - $output = ''; - $response = $this->_get_binary_packet(); - - do { - $output.= substr($response[NET_SSH1_RESPONSE_DATA], 4); - $response = $this->_get_binary_packet(); - } while ($response[NET_SSH1_RESPONSE_TYPE] != NET_SSH1_SMSG_EXITSTATUS); - - $data = pack('C', NET_SSH1_CMSG_EXIT_CONFIRMATION); - - // i don't think it's really all that important if this packet gets sent or not. - $this->_send_binary_packet($data); - - fclose($this->fsock); - - // reset the execution bitmap - a new Net_SSH1 object needs to be created. - $this->bitmap = 0; - - return $output; - } - - /** - * Creates an interactive shell - * - * @see Net_SSH1::interactiveRead() - * @see Net_SSH1::interactiveWrite() - * @return Boolean - * @access private - */ - function _initShell() - { - $data = pack('CNa*N4C', NET_SSH1_CMSG_REQUEST_PTY, strlen('vt100'), 'vt100', 24, 80, 0, 0, NET_SSH1_TTY_OP_END); - - if (!$this->_send_binary_packet($data)) { - user_error('Error sending SSH_CMSG_REQUEST_PTY', E_USER_NOTICE); - return false; - } - - $response = $this->_get_binary_packet(); - - if ($response[NET_SSH1_RESPONSE_TYPE] != NET_SSH1_SMSG_SUCCESS) { - user_error('Expected SSH_SMSG_SUCCESS', E_USER_NOTICE); - return false; - } - - $data = pack('C', NET_SSH1_CMSG_EXEC_SHELL); - - if (!$this->_send_binary_packet($data)) { - user_error('Error sending SSH_CMSG_EXEC_SHELL', E_USER_NOTICE); - return false; - } - - $this->bitmap |= NET_SSH1_MASK_SHELL; - - //stream_set_blocking($this->fsock, 0); - - return true; - } - - /** - * Inputs a command into an interactive shell. - * - * @see Net_SSH1::interactiveRead() - * @param String $cmd - * @return Boolean - * @access public - */ - function interactiveWrite($cmd) - { - if (!($this->bitmap & NET_SSH1_MASK_LOGIN)) { - user_error('Operation disallowed prior to login()', E_USER_NOTICE); - return false; - } - - if (!($this->bitmap & NET_SSH1_MASK_SHELL) && !$this->_initShell()) { - user_error('Unable to initiate an interactive shell session', E_USER_NOTICE); - return false; - } - - $data = pack('CNa*', NET_SSH1_CMSG_STDIN_DATA, strlen($cmd), $cmd); - - if (!$this->_send_binary_packet($data)) { - user_error('Error sending SSH_CMSG_STDIN', E_USER_NOTICE); - return false; - } - - return true; - } - - /** - * Reads the output of an interactive shell. - * - * Requires PHP 4.3.0 or later due to the use of the stream_select() function. If you see stuff like - * "[00m", you're seeing ANSI escape codes. According to - * {@link http://support.microsoft.com/kb/101875 How to Enable ANSI.SYS in a Command Window}, "Windows NT - * does not support ANSI escape sequences in Win32 Console applications", so if you're a Windows user, - * there's not going to be much recourse. - * - * @see Net_SSH1::interactiveRead() - * @return String - * @access public - */ - function interactiveRead() - { - if (!($this->bitmap & NET_SSH1_MASK_LOGIN)) { - user_error('Operation disallowed prior to login()', E_USER_NOTICE); - return false; - } - - if (!($this->bitmap & NET_SSH1_MASK_SHELL) && !$this->_initShell()) { - user_error('Unable to initiate an interactive shell session', E_USER_NOTICE); - return false; - } - - $read = array($this->fsock); - $write = $except = null; - if (stream_select($read, $write, $except, 0)) { - $response = $this->_get_binary_packet(); - return substr($response[NET_SSH1_RESPONSE_DATA], 4); - } else { - return ''; - } - } - - /** - * Disconnect - * - * @access public - */ - function disconnect() - { - $this->_disconnect(); - } - - /** - * Destructor. - * - * Will be called, automatically, if you're supporting just PHP5. If you're supporting PHP4, you'll need to call - * disconnect(). - * - * @access public - */ - function __destruct() - { - $this->_disconnect(); - } - - /** - * Disconnect - * - * @param String $msg - * @access private - */ - function _disconnect($msg = 'Client Quit') - { - if ($this->bitmap) { - $data = pack('CNa*', NET_SSH1_MSG_DISCONNECT, strlen($msg), $msg); - $this->_send_binary_packet($data); - fclose($this->fsock); - $this->bitmap = 0; - } - } - - /** - * Gets Binary Packets - * - * See 'The Binary Packet Protocol' of protocol-1.5.txt for more info. - * - * Also, this function could be improved upon by adding detection for the following exploit: - * http://www.securiteam.com/securitynews/5LP042K3FY.html - * - * @see Net_SSH1::_send_binary_packet() - * @return Array - * @access private - */ - function _get_binary_packet() - { - if (feof($this->fsock)) { - //user_error('connection closed prematurely', E_USER_NOTICE); - return false; - } - - $temp = unpack('Nlength', fread($this->fsock, 4)); - - $padding_length = 8 - ($temp['length'] & 7); - $length = $temp['length'] + $padding_length; - - $raw = fread($this->fsock, $length); - - if ($this->crypto !== false) { - $raw = $this->crypto->decrypt($raw); - } - - $padding = substr($raw, 0, $padding_length); - $type = $raw[$padding_length]; - $data = substr($raw, $padding_length + 1, -4); - - $temp = unpack('Ncrc', substr($raw, -4)); - - //if ( $temp['crc'] != $this->_crc($padding . $type . $data) ) { - // user_error('Bad CRC in packet from server', E_USER_NOTICE); - // return false; - //} - - return array( - NET_SSH1_RESPONSE_TYPE => ord($type), - NET_SSH1_RESPONSE_DATA => $data - ); - } - - /** - * Sends Binary Packets - * - * Returns true on success, false on failure. - * - * @see Net_SSH1::_get_binary_packet() - * @param String $data - * @return Boolean - * @access private - */ - function _send_binary_packet($data) { - if (feof($this->fsock)) { - //user_error('connection closed prematurely', E_USER_NOTICE); - return false; - } - - $length = strlen($data) + 4; - - $padding_length = 8 - ($length & 7); - $padding = ''; - for ($i = 0; $i < $padding_length; $i++) { - $padding.= chr(crypt_random(0, 255)); - } - - $data = $padding . $data; - $data.= pack('N', $this->_crc($data)); - - if ($this->crypto !== false) { - $data = $this->crypto->encrypt($data); - } - - $packet = pack('Na*', $length, $data); - - return strlen($packet) == fputs($this->fsock, $packet); - } - - /** - * Cyclic Redundancy Check (CRC) - * - * PHP's crc32 function is implemented slightly differently than the one that SSH v1 uses, so - * we've reimplemented it. A more detailed discussion of the differences can be found after - * $crc_lookup_table's initialization. - * - * @see Net_SSH1::_get_binary_packet() - * @see Net_SSH1::_send_binary_packet() - * @param String $data - * @return Integer - * @access private - */ - function _crc($data) - { - static $crc_lookup_table = array( - 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, - 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, - 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, - 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, - 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, - 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, - 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, - 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, - 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, - 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, - 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, - 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, - 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, - 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, - 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, - 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, - 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, - 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, - 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, - 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, - 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, - 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, - 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, - 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, - 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, - 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, - 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, - 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, - 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, - 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, - 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, - 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, - 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, - 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, - 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, - 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, - 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, - 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, - 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, - 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, - 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, - 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, - 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, - 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, - 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, - 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, - 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, - 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, - 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, - 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, - 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, - 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, - 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, - 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, - 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, - 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, - 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, - 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, - 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, - 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, - 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, - 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, - 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, - 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D - ); - - // For this function to yield the same output as PHP's crc32 function, $crc would have to be - // set to 0xFFFFFFFF, initially - not 0x00000000 as it currently is. - $crc = 0x00000000; - $length = strlen($data); - - for ($i=0;$i<$length;$i++) { - // We AND $crc >> 8 with 0x00FFFFFF because we want the eight newly added bits to all - // be zero. PHP, unfortunately, doesn't always do this. 0x80000000 >> 8, as an example, - // yields 0xFF800000 - not 0x00800000. The following link elaborates: - // http://www.php.net/manual/en/language.operators.bitwise.php#57281 - $crc = (($crc >> 8) & 0x00FFFFFF) ^ $crc_lookup_table[($crc & 0xFF) ^ ord($data[$i])]; - } - - // In addition to having to set $crc to 0xFFFFFFFF, initially, the return value must be XOR'd with - // 0xFFFFFFFF for this function to return the same thing that PHP's crc32 function would. - return $crc; - } - - /** - * String Shift - * - * Inspired by array_shift - * - * @param String $string - * @param optional Integer $index - * @return String - * @access private - */ - function _string_shift(&$string, $index = 1) - { - $substr = substr($string, 0, $index); - $string = substr($string, $index); - return $substr; - } - - /** - * RSA Encrypt - * - * Returns mod(pow($m, $e), $n), where $n should be the product of two (large) primes $p and $q and where $e - * should be a number with the property that gcd($e, ($p - 1) * ($q - 1)) == 1. Could just make anything that - * calls this call modexp, instead, but I think this makes things clearer, maybe... - * - * @see Net_SSH1::Net_SSH1() - * @param Math_BigInteger $m - * @param Array $key - * @return Math_BigInteger - * @access private - */ - function _rsa_crypt($m, $key) - { - /* - if (!class_exists('Crypt_RSA')) { - require_once('Crypt/RSA.php'); - } - - $rsa = new Crypt_RSA(); - $rsa->loadKey($key, CRYPT_RSA_PUBLIC_FORMAT_RAW); - $rsa->setEncryptionMode(CRYPT_RSA_ENCRYPTION_PKCS1); - return $rsa->encrypt($m); - */ - - // To quote from protocol-1.5.txt: - // The most significant byte (which is only partial as the value must be - // less than the public modulus, which is never a power of two) is zero. - // - // The next byte contains the value 2 (which stands for public-key - // encrypted data in the PKCS standard [PKCS#1]). Then, there are non- - // zero random bytes to fill any unused space, a zero byte, and the data - // to be encrypted in the least significant bytes, the last byte of the - // data in the least significant byte. - - // Presumably the part of PKCS#1 they're refering to is "Section 7.2.1 Encryption Operation", - // under "7.2 RSAES-PKCS1-v1.5" and "7 Encryption schemes" of the following URL: - // ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1.pdf - $temp = chr(0) . chr(2); - $modulus = $key[1]->toBytes(); - $length = strlen($modulus) - strlen($m) - 3; - for ($i = 0; $i < $length; $i++) { - $temp.= chr(crypt_random(1, 255)); - } - $temp.= chr(0) . $m; - - $m = new Math_BigInteger($temp, 256); - $m = $m->modPow($key[0], $key[1]); - - return $m->toBytes(); - } - - /** - * Return the server key public exponent - * - * Returns, by default, the base-10 representation. If $raw_output is set to true, returns, instead, - * the raw bytes. This behavior is similar to PHP's md5() function. - * - * @param optional Boolean $raw_output - * @return String - * @access public - */ - function getServerKeyPublicExponent($raw_output = false) - { - return $raw_output ? $this->server_key_public_exponent->toBytes() : $this->server_key_public_exponent->toString(); - } - - /** - * Return the server key public modulus - * - * Returns, by default, the base-10 representation. If $raw_output is set to true, returns, instead, - * the raw bytes. This behavior is similar to PHP's md5() function. - * - * @param optional Boolean $raw_output - * @return String - * @access public - */ - function getServerKeyPublicModulus($raw_output = false) - { - return $raw_output ? $this->server_key_public_modulus->toBytes() : $this->server_key_public_modulus->toString(); - } - - /** - * Return the host key public exponent - * - * Returns, by default, the base-10 representation. If $raw_output is set to true, returns, instead, - * the raw bytes. This behavior is similar to PHP's md5() function. - * - * @param optional Boolean $raw_output - * @return String - * @access public - */ - function getHostKeyPublicExponent($raw_output = false) - { - return $raw_output ? $this->host_key_public_exponent->toBytes() : $this->host_key_public_exponent->toString(); - } - - /** - * Return the host key public modulus - * - * Returns, by default, the base-10 representation. If $raw_output is set to true, returns, instead, - * the raw bytes. This behavior is similar to PHP's md5() function. - * - * @param optional Boolean $raw_output - * @return String - * @access public - */ - function getHostKeyPublicModulus($raw_output = false) - { - return $raw_output ? $this->host_key_public_modulus->toBytes() : $this->host_key_public_modulus->toString(); - } - - /** - * Return a list of ciphers supported by SSH1 server. - * - * Just because a cipher is supported by an SSH1 server doesn't mean it's supported by this library. If $raw_output - * is set to true, returns, instead, an array of constants. ie. instead of array('Triple-DES in CBC mode'), you'll - * get array(NET_SSH1_CIPHER_3DES). - * - * @param optional Boolean $raw_output - * @return Array - * @access public - */ - function getSupportedCiphers($raw_output = false) - { - return $raw_output ? array_keys($this->supported_ciphers) : array_values($this->supported_ciphers); - } - - /** - * Return a list of authentications supported by SSH1 server. - * - * Just because a cipher is supported by an SSH1 server doesn't mean it's supported by this library. If $raw_output - * is set to true, returns, instead, an array of constants. ie. instead of array('password authentication'), you'll - * get array(NET_SSH1_AUTH_PASSWORD). - * - * @param optional Boolean $raw_output - * @return Array - * @access public - */ - function getSupportedAuthentications($raw_output = false) - { - return $raw_output ? array_keys($this->supported_authentications) : array_values($this->supported_authentications); - } - - /** - * Return the server identification. - * - * @return String - * @access public - */ - function getServerIdentification() - { - return rtrim($this->server_identification); - } -} diff --git a/lib/internal/phpseclib/Net/SSH2.php b/lib/internal/phpseclib/Net/SSH2.php deleted file mode 100644 index 9b474aa925f..00000000000 --- a/lib/internal/phpseclib/Net/SSH2.php +++ /dev/null @@ -1,2302 +0,0 @@ -<?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * Pure-PHP implementation of SSHv2. - * - * PHP versions 4 and 5 - * - * Here are some examples of how to use this library: - * <code> - * <?php - * include('Net/SSH2.php'); - * - * $ssh = new Net_SSH2('www.domain.tld'); - * if (!$ssh->login('username', 'password')) { - * exit('Login Failed'); - * } - * - * echo $ssh->exec('pwd'); - * echo $ssh->exec('ls -la'); - * ?> - * </code> - * - * <code> - * <?php - * include('Crypt/RSA.php'); - * include('Net/SSH2.php'); - * - * $key = new Crypt_RSA(); - * //$key->setPassword('whatever'); - * $key->loadKey(file_get_contents('privatekey')); - * - * $ssh = new Net_SSH2('www.domain.tld'); - * if (!$ssh->login('username', $key)) { - * exit('Login Failed'); - * } - * - * echo $ssh->exec('pwd'); - * echo $ssh->exec('ls -la'); - * ?> - * </code> - * - * LICENSE: This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - * @category Net - * @package Net_SSH2 - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMVII Jim Wigginton - * @license http://www.gnu.org/licenses/lgpl.txt - * @version $Id: SSH2.php,v 1.46 2010/04/27 21:29:36 terrafrost Exp $ - * @link http://phpseclib.sourceforge.net - */ - -/** - * Include Math_BigInteger - * - * Used to do Diffie-Hellman key exchange and DSA/RSA signature verification. - */ -require_once('phpseclib/Math/BigInteger.php'); - -/** - * Include Crypt_Random - */ -require_once('phpseclib/Crypt/Random.php'); - -/** - * Include Crypt_Hash - */ -require_once('phpseclib/Crypt/Hash.php'); - -/** - * Include Crypt_TripleDES - */ -require_once('phpseclib/Crypt/TripleDES.php'); - -/** - * Include Crypt_RC4 - */ -require_once('phpseclib/Crypt/RC4.php'); - -/** - * Include Crypt_AES - */ -require_once('phpseclib/Crypt/AES.php'); - -/**#@+ - * Execution Bitmap Masks - * - * @see Net_SSH2::bitmap - * @access private - */ -define('NET_SSH2_MASK_CONSTRUCTOR', 0x00000001); -define('NET_SSH2_MASK_LOGIN', 0x00000002); -/**#@-*/ - -/**#@+ - * Channel constants - * - * RFC4254 refers not to client and server channels but rather to sender and recipient channels. we don't refer - * to them in that way because RFC4254 toggles the meaning. the client sends a SSH_MSG_CHANNEL_OPEN message with - * a sender channel and the server sends a SSH_MSG_CHANNEL_OPEN_CONFIRMATION in response, with a sender and a - * recipient channel. at first glance, you might conclude that SSH_MSG_CHANNEL_OPEN_CONFIRMATION's sender channel - * would be the same thing as SSH_MSG_CHANNEL_OPEN's sender channel, but it's not, per this snipet: - * The 'recipient channel' is the channel number given in the original - * open request, and 'sender channel' is the channel number allocated by - * the other side. - * - * @see Net_SSH2::_send_channel_packet() - * @see Net_SSH2::_get_channel_packet() - * @access private - */ -define('NET_SSH2_CHANNEL_EXEC', 0); // PuTTy uses 0x100 -/**#@-*/ - -/**#@+ - * @access public - * @see Net_SSH2::getLog() - */ -/** - * Returns the message numbers - */ -define('NET_SSH2_LOG_SIMPLE', 1); -/** - * Returns the message content - */ -define('NET_SSH2_LOG_COMPLEX', 2); -/**#@-*/ - -/** - * Pure-PHP implementation of SSHv2. - * - * @author Jim Wigginton <terrafrost@php.net> - * @version 0.1.0 - * @access public - * @package Net_SSH2 - */ -class Net_SSH2 { - /** - * The SSH identifier - * - * @var String - * @access private - */ - var $identifier = 'SSH-2.0-phpseclib_0.2'; - - /** - * The Socket Object - * - * @var Object - * @access private - */ - var $fsock; - - /** - * Execution Bitmap - * - * The bits that are set reprsent functions that have been called already. This is used to determine - * if a requisite function has been successfully executed. If not, an error should be thrown. - * - * @var Integer - * @access private - */ - var $bitmap = 0; - - /** - * Error information - * - * @see Net_SSH2::getErrors() - * @see Net_SSH2::getLastError() - * @var String - * @access private - */ - var $errors = array(); - - /** - * Server Identifier - * - * @see Net_SSH2::getServerIdentification() - * @var String - * @access private - */ - var $server_identifier = ''; - - /** - * Key Exchange Algorithms - * - * @see Net_SSH2::getKexAlgorithims() - * @var Array - * @access private - */ - var $kex_algorithms; - - /** - * Server Host Key Algorithms - * - * @see Net_SSH2::getServerHostKeyAlgorithms() - * @var Array - * @access private - */ - var $server_host_key_algorithms; - - /** - * Encryption Algorithms: Client to Server - * - * @see Net_SSH2::getEncryptionAlgorithmsClient2Server() - * @var Array - * @access private - */ - var $encryption_algorithms_client_to_server; - - /** - * Encryption Algorithms: Server to Client - * - * @see Net_SSH2::getEncryptionAlgorithmsServer2Client() - * @var Array - * @access private - */ - var $encryption_algorithms_server_to_client; - - /** - * MAC Algorithms: Client to Server - * - * @see Net_SSH2::getMACAlgorithmsClient2Server() - * @var Array - * @access private - */ - var $mac_algorithms_client_to_server; - - /** - * MAC Algorithms: Server to Client - * - * @see Net_SSH2::getMACAlgorithmsServer2Client() - * @var Array - * @access private - */ - var $mac_algorithms_server_to_client; - - /** - * Compression Algorithms: Client to Server - * - * @see Net_SSH2::getCompressionAlgorithmsClient2Server() - * @var Array - * @access private - */ - var $compression_algorithms_client_to_server; - - /** - * Compression Algorithms: Server to Client - * - * @see Net_SSH2::getCompressionAlgorithmsServer2Client() - * @var Array - * @access private - */ - var $compression_algorithms_server_to_client; - - /** - * Languages: Server to Client - * - * @see Net_SSH2::getLanguagesServer2Client() - * @var Array - * @access private - */ - var $languages_server_to_client; - - /** - * Languages: Client to Server - * - * @see Net_SSH2::getLanguagesClient2Server() - * @var Array - * @access private - */ - var $languages_client_to_server; - - /** - * Block Size for Server to Client Encryption - * - * "Note that the length of the concatenation of 'packet_length', - * 'padding_length', 'payload', and 'random padding' MUST be a multiple - * of the cipher block size or 8, whichever is larger. This constraint - * MUST be enforced, even when using stream ciphers." - * - * -- http://tools.ietf.org/html/rfc4253#section-6 - * - * @see Net_SSH2::Net_SSH2() - * @see Net_SSH2::_send_binary_packet() - * @var Integer - * @access private - */ - var $encrypt_block_size = 8; - - /** - * Block Size for Client to Server Encryption - * - * @see Net_SSH2::Net_SSH2() - * @see Net_SSH2::_get_binary_packet() - * @var Integer - * @access private - */ - var $decrypt_block_size = 8; - - /** - * Server to Client Encryption Object - * - * @see Net_SSH2::_get_binary_packet() - * @var Object - * @access private - */ - var $decrypt = false; - - /** - * Client to Server Encryption Object - * - * @see Net_SSH2::_send_binary_packet() - * @var Object - * @access private - */ - var $encrypt = false; - - /** - * Client to Server HMAC Object - * - * @see Net_SSH2::_send_binary_packet() - * @var Object - * @access private - */ - var $hmac_create = false; - - /** - * Server to Client HMAC Object - * - * @see Net_SSH2::_get_binary_packet() - * @var Object - * @access private - */ - var $hmac_check = false; - - /** - * Size of server to client HMAC - * - * We need to know how big the HMAC will be for the server to client direction so that we know how many bytes to read. - * For the client to server side, the HMAC object will make the HMAC as long as it needs to be. All we need to do is - * append it. - * - * @see Net_SSH2::_get_binary_packet() - * @var Integer - * @access private - */ - var $hmac_size = false; - - /** - * Server Public Host Key - * - * @see Net_SSH2::getServerPublicHostKey() - * @var String - * @access private - */ - var $server_public_host_key; - - /** - * Session identifer - * - * "The exchange hash H from the first key exchange is additionally - * used as the session identifier, which is a unique identifier for - * this connection." - * - * -- http://tools.ietf.org/html/rfc4253#section-7.2 - * - * @see Net_SSH2::_key_exchange() - * @var String - * @access private - */ - var $session_id = false; - - /** - * Message Numbers - * - * @see Net_SSH2::Net_SSH2() - * @var Array - * @access private - */ - var $message_numbers = array(); - - /** - * Disconnection Message 'reason codes' defined in RFC4253 - * - * @see Net_SSH2::Net_SSH2() - * @var Array - * @access private - */ - var $disconnect_reasons = array(); - - /** - * SSH_MSG_CHANNEL_OPEN_FAILURE 'reason codes', defined in RFC4254 - * - * @see Net_SSH2::Net_SSH2() - * @var Array - * @access private - */ - var $channel_open_failure_reasons = array(); - - /** - * Terminal Modes - * - * @link http://tools.ietf.org/html/rfc4254#section-8 - * @see Net_SSH2::Net_SSH2() - * @var Array - * @access private - */ - var $terminal_modes = array(); - - /** - * SSH_MSG_CHANNEL_EXTENDED_DATA's data_type_codes - * - * @link http://tools.ietf.org/html/rfc4254#section-5.2 - * @see Net_SSH2::Net_SSH2() - * @var Array - * @access private - */ - var $channel_extended_data_type_codes = array(); - - /** - * Send Sequence Number - * - * See 'Section 6.4. Data Integrity' of rfc4253 for more info. - * - * @see Net_SSH2::_send_binary_packet() - * @var Integer - * @access private - */ - var $send_seq_no = 0; - - /** - * Get Sequence Number - * - * See 'Section 6.4. Data Integrity' of rfc4253 for more info. - * - * @see Net_SSH2::_get_binary_packet() - * @var Integer - * @access private - */ - var $get_seq_no = 0; - - /** - * Server Channels - * - * Maps client channels to server channels - * - * @see Net_SSH2::_get_channel_packet() - * @see Net_SSH2::exec() - * @var Array - * @access private - */ - var $server_channels = array(); - - /** - * Channel Buffers - * - * If a client requests a packet from one channel but receives two packets from another those packets should - * be placed in a buffer - * - * @see Net_SSH2::_get_channel_packet() - * @see Net_SSH2::exec() - * @var Array - * @access private - */ - var $channel_buffers = array(); - - /** - * Channel Status - * - * Contains the type of the last sent message - * - * @see Net_SSH2::_get_channel_packet() - * @var Array - * @access private - */ - var $channel_status = array(); - - /** - * Packet Size - * - * Maximum packet size indexed by channel - * - * @see Net_SSH2::_send_channel_packet() - * @var Array - * @access private - */ - var $packet_size_client_to_server = array(); - - /** - * Message Number Log - * - * @see Net_SSH2::getLog() - * @var Array - * @access private - */ - var $message_number_log = array(); - - /** - * Message Log - * - * @see Net_SSH2::getLog() - * @var Array - * @access private - */ - var $message_log = array(); - - /** - * The Window Size - * - * Bytes the other party can send before it must wait for the window to be adjusted (0x7FFFFFFF = 4GB) - * - * @var Integer - * @see Net_SSH2::_send_channel_packet() - * @see Net_SSH2::exec() - * @access private - */ - var $window_size = 0x7FFFFFFF; - - /** - * Window size - * - * Window size indexed by channel - * - * @see Net_SSH2::_send_channel_packet() - * @var Array - * @access private - */ - var $window_size_client_to_server = array(); - - /** - * Server signature - * - * Verified against $this->session_id - * - * @see Net_SSH2::getServerPublicHostKey() - * @var String - * @access private - */ - var $signature = ''; - - /** - * Server signature format - * - * ssh-rsa or ssh-dss. - * - * @see Net_SSH2::getServerPublicHostKey() - * @var String - * @access private - */ - var $signature_format = ''; - - /** - * Default Constructor. - * - * Connects to an SSHv2 server - * - * @param String $host - * @param optional Integer $port - * @param optional Integer $timeout - * @return Net_SSH2 - * @access public - */ - function Net_SSH2($host, $port = 22, $timeout = 10) - { - $this->message_numbers = array( - 1 => 'NET_SSH2_MSG_DISCONNECT', - 2 => 'NET_SSH2_MSG_IGNORE', - 3 => 'NET_SSH2_MSG_UNIMPLEMENTED', - 4 => 'NET_SSH2_MSG_DEBUG', - 5 => 'NET_SSH2_MSG_SERVICE_REQUEST', - 6 => 'NET_SSH2_MSG_SERVICE_ACCEPT', - 20 => 'NET_SSH2_MSG_KEXINIT', - 21 => 'NET_SSH2_MSG_NEWKEYS', - 30 => 'NET_SSH2_MSG_KEXDH_INIT', - 31 => 'NET_SSH2_MSG_KEXDH_REPLY', - 50 => 'NET_SSH2_MSG_USERAUTH_REQUEST', - 51 => 'NET_SSH2_MSG_USERAUTH_FAILURE', - 52 => 'NET_SSH2_MSG_USERAUTH_SUCCESS', - 53 => 'NET_SSH2_MSG_USERAUTH_BANNER', - - 80 => 'NET_SSH2_MSG_GLOBAL_REQUEST', - 81 => 'NET_SSH2_MSG_REQUEST_SUCCESS', - 82 => 'NET_SSH2_MSG_REQUEST_FAILURE', - 90 => 'NET_SSH2_MSG_CHANNEL_OPEN', - 91 => 'NET_SSH2_MSG_CHANNEL_OPEN_CONFIRMATION', - 92 => 'NET_SSH2_MSG_CHANNEL_OPEN_FAILURE', - 93 => 'NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST', - 94 => 'NET_SSH2_MSG_CHANNEL_DATA', - 95 => 'NET_SSH2_MSG_CHANNEL_EXTENDED_DATA', - 96 => 'NET_SSH2_MSG_CHANNEL_EOF', - 97 => 'NET_SSH2_MSG_CHANNEL_CLOSE', - 98 => 'NET_SSH2_MSG_CHANNEL_REQUEST', - 99 => 'NET_SSH2_MSG_CHANNEL_SUCCESS', - 100 => 'NET_SSH2_MSG_CHANNEL_FAILURE' - ); - $this->disconnect_reasons = array( - 1 => 'NET_SSH2_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT', - 2 => 'NET_SSH2_DISCONNECT_PROTOCOL_ERROR', - 3 => 'NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED', - 4 => 'NET_SSH2_DISCONNECT_RESERVED', - 5 => 'NET_SSH2_DISCONNECT_MAC_ERROR', - 6 => 'NET_SSH2_DISCONNECT_COMPRESSION_ERROR', - 7 => 'NET_SSH2_DISCONNECT_SERVICE_NOT_AVAILABLE', - 8 => 'NET_SSH2_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED', - 9 => 'NET_SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE', - 10 => 'NET_SSH2_DISCONNECT_CONNECTION_LOST', - 11 => 'NET_SSH2_DISCONNECT_BY_APPLICATION', - 12 => 'NET_SSH2_DISCONNECT_TOO_MANY_CONNECTIONS', - 13 => 'NET_SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER', - 14 => 'NET_SSH2_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE', - 15 => 'NET_SSH2_DISCONNECT_ILLEGAL_USER_NAME' - ); - $this->channel_open_failure_reasons = array( - 1 => 'NET_SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED' - ); - $this->terminal_modes = array( - 0 => 'NET_SSH2_TTY_OP_END' - ); - $this->channel_extended_data_type_codes = array( - 1 => 'NET_SSH2_EXTENDED_DATA_STDERR' - ); - - $this->_define_array( - $this->message_numbers, - $this->disconnect_reasons, - $this->channel_open_failure_reasons, - $this->terminal_modes, - $this->channel_extended_data_type_codes, - array(60 => 'NET_SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ'), - array(60 => 'NET_SSH2_MSG_USERAUTH_PK_OK') - ); - - $this->fsock = @fsockopen($host, $port, $errno, $errstr, $timeout); - if (!$this->fsock) { - user_error(rtrim("Cannot connect to $host. Error $errno. $errstr"), E_USER_NOTICE); - return; - } - - /* According to the SSH2 specs, - - "The server MAY send other lines of data before sending the version - string. Each line SHOULD be terminated by a Carriage Return and Line - Feed. Such lines MUST NOT begin with "SSH-", and SHOULD be encoded - in ISO-10646 UTF-8 [RFC3629] (language is not specified). Clients - MUST be able to process such lines." */ - $temp = ''; - $extra = ''; - while (!feof($this->fsock) && !preg_match('#^SSH-(\d\.\d+)#', $temp, $matches)) { - if (substr($temp, -2) == "\r\n") { - $extra.= $temp; - $temp = ''; - } - $temp.= fgets($this->fsock, 255); - } - - $ext = array(); - if (extension_loaded('mcrypt')) { - $ext[] = 'mcrypt'; - } - if (extension_loaded('gmp')) { - $ext[] = 'gmp'; - } else if (extension_loaded('bcmath')) { - $ext[] = 'bcmath'; - } - - if (!empty($ext)) { - $this->identifier.= ' (' . implode(', ', $ext) . ')'; - } - - if (defined('NET_SSH2_LOGGING')) { - $this->message_number_log[] = '<-'; - $this->message_number_log[] = '->'; - - if (NET_SSH2_LOGGING == NET_SSH2_LOG_COMPLEX) { - $this->message_log[] = $temp; - $this->message_log[] = $this->identifier . "\r\n"; - } - } - - $this->server_identifier = trim($temp, "\r\n"); - if (!empty($extra)) { - $this->errors[] = utf8_decode($extra); - } - - if ($matches[1] != '1.99' && $matches[1] != '2.0') { - user_error("Cannot connect to SSH $matches[1] servers", E_USER_NOTICE); - return; - } - - fputs($this->fsock, $this->identifier . "\r\n"); - - $response = $this->_get_binary_packet(); - if ($response === false) { - user_error('Connection closed by server', E_USER_NOTICE); - return; - } - - if (ord($response[0]) != NET_SSH2_MSG_KEXINIT) { - user_error('Expected SSH_MSG_KEXINIT', E_USER_NOTICE); - return; - } - - if (!$this->_key_exchange($response)) { - return; - } - - $this->bitmap = NET_SSH2_MASK_CONSTRUCTOR; - } - - /** - * Key Exchange - * - * @param String $kexinit_payload_server - * @access private - */ - function _key_exchange($kexinit_payload_server) - { - static $kex_algorithms = array( - 'diffie-hellman-group1-sha1', // REQUIRED - 'diffie-hellman-group14-sha1' // REQUIRED - ); - - static $server_host_key_algorithms = array( - 'ssh-rsa', // RECOMMENDED sign Raw RSA Key - 'ssh-dss' // REQUIRED sign Raw DSS Key - ); - - static $encryption_algorithms = array( - // from <http://tools.ietf.org/html/rfc4345#section-4>: - 'arcfour256', - 'arcfour128', - - 'arcfour', // OPTIONAL the ARCFOUR stream cipher with a 128-bit key - - 'aes128-cbc', // RECOMMENDED AES with a 128-bit key - 'aes192-cbc', // OPTIONAL AES with a 192-bit key - 'aes256-cbc', // OPTIONAL AES in CBC mode, with a 256-bit key - - // from <http://tools.ietf.org/html/rfc4344#section-4>: - 'aes128-ctr', // RECOMMENDED AES (Rijndael) in SDCTR mode, with 128-bit key - 'aes192-ctr', // RECOMMENDED AES with 192-bit key - 'aes256-ctr', // RECOMMENDED AES with 256-bit key - '3des-ctr', // RECOMMENDED Three-key 3DES in SDCTR mode - - '3des-cbc', // REQUIRED three-key 3DES in CBC mode - 'none' // OPTIONAL no encryption; NOT RECOMMENDED - ); - - static $mac_algorithms = array( - 'hmac-sha1-96', // RECOMMENDED first 96 bits of HMAC-SHA1 (digest length = 12, key length = 20) - 'hmac-sha1', // REQUIRED HMAC-SHA1 (digest length = key length = 20) - 'hmac-md5-96', // OPTIONAL first 96 bits of HMAC-MD5 (digest length = 12, key length = 16) - 'hmac-md5', // OPTIONAL HMAC-MD5 (digest length = key length = 16) - 'none' // OPTIONAL no MAC; NOT RECOMMENDED - ); - - static $compression_algorithms = array( - 'none' // REQUIRED no compression - //'zlib' // OPTIONAL ZLIB (LZ77) compression - ); - - static $str_kex_algorithms, $str_server_host_key_algorithms, - $encryption_algorithms_server_to_client, $mac_algorithms_server_to_client, $compression_algorithms_server_to_client, - $encryption_algorithms_client_to_server, $mac_algorithms_client_to_server, $compression_algorithms_client_to_server; - - if (empty($str_kex_algorithms)) { - $str_kex_algorithms = implode(',', $kex_algorithms); - $str_server_host_key_algorithms = implode(',', $server_host_key_algorithms); - $encryption_algorithms_server_to_client = $encryption_algorithms_client_to_server = implode(',', $encryption_algorithms); - $mac_algorithms_server_to_client = $mac_algorithms_client_to_server = implode(',', $mac_algorithms); - $compression_algorithms_server_to_client = $compression_algorithms_client_to_server = implode(',', $compression_algorithms); - } - - $client_cookie = ''; - for ($i = 0; $i < 16; $i++) { - $client_cookie.= chr(crypt_random(0, 255)); - } - - $response = $kexinit_payload_server; - $this->_string_shift($response, 1); // skip past the message number (it should be SSH_MSG_KEXINIT) - $server_cookie = $this->_string_shift($response, 16); - - $temp = unpack('Nlength', $this->_string_shift($response, 4)); - $this->kex_algorithms = explode(',', $this->_string_shift($response, $temp['length'])); - - $temp = unpack('Nlength', $this->_string_shift($response, 4)); - $this->server_host_key_algorithms = explode(',', $this->_string_shift($response, $temp['length'])); - - $temp = unpack('Nlength', $this->_string_shift($response, 4)); - $this->encryption_algorithms_client_to_server = explode(',', $this->_string_shift($response, $temp['length'])); - - $temp = unpack('Nlength', $this->_string_shift($response, 4)); - $this->encryption_algorithms_server_to_client = explode(',', $this->_string_shift($response, $temp['length'])); - - $temp = unpack('Nlength', $this->_string_shift($response, 4)); - $this->mac_algorithms_client_to_server = explode(',', $this->_string_shift($response, $temp['length'])); - - $temp = unpack('Nlength', $this->_string_shift($response, 4)); - $this->mac_algorithms_server_to_client = explode(',', $this->_string_shift($response, $temp['length'])); - - $temp = unpack('Nlength', $this->_string_shift($response, 4)); - $this->compression_algorithms_client_to_server = explode(',', $this->_string_shift($response, $temp['length'])); - - $temp = unpack('Nlength', $this->_string_shift($response, 4)); - $this->compression_algorithms_server_to_client = explode(',', $this->_string_shift($response, $temp['length'])); - - $temp = unpack('Nlength', $this->_string_shift($response, 4)); - $this->languages_client_to_server = explode(',', $this->_string_shift($response, $temp['length'])); - - $temp = unpack('Nlength', $this->_string_shift($response, 4)); - $this->languages_server_to_client = explode(',', $this->_string_shift($response, $temp['length'])); - - extract(unpack('Cfirst_kex_packet_follows', $this->_string_shift($response, 1))); - $first_kex_packet_follows = $first_kex_packet_follows != 0; - - // the sending of SSH2_MSG_KEXINIT could go in one of two places. this is the second place. - $kexinit_payload_client = pack('Ca*Na*Na*Na*Na*Na*Na*Na*Na*Na*Na*CN', - NET_SSH2_MSG_KEXINIT, $client_cookie, strlen($str_kex_algorithms), $str_kex_algorithms, - strlen($str_server_host_key_algorithms), $str_server_host_key_algorithms, strlen($encryption_algorithms_client_to_server), - $encryption_algorithms_client_to_server, strlen($encryption_algorithms_server_to_client), $encryption_algorithms_server_to_client, - strlen($mac_algorithms_client_to_server), $mac_algorithms_client_to_server, strlen($mac_algorithms_server_to_client), - $mac_algorithms_server_to_client, strlen($compression_algorithms_client_to_server), $compression_algorithms_client_to_server, - strlen($compression_algorithms_server_to_client), $compression_algorithms_server_to_client, 0, '', 0, '', - 0, 0 - ); - - if (!$this->_send_binary_packet($kexinit_payload_client)) { - return false; - } - // here ends the second place. - - // we need to decide upon the symmetric encryption algorithms before we do the diffie-hellman key exchange - for ($i = 0; $i < count($encryption_algorithms) && !in_array($encryption_algorithms[$i], $this->encryption_algorithms_server_to_client); $i++); - if ($i == count($encryption_algorithms)) { - user_error('No compatible server to client encryption algorithms found', E_USER_NOTICE); - return $this->_disconnect(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); - } - - // we don't initialize any crypto-objects, yet - we do that, later. for now, we need the lengths to make the - // diffie-hellman key exchange as fast as possible - $decrypt = $encryption_algorithms[$i]; - switch ($decrypt) { - case '3des-cbc': - case '3des-ctr': - $decryptKeyLength = 24; // eg. 192 / 8 - break; - case 'aes256-cbc': - case 'aes256-ctr': - $decryptKeyLength = 32; // eg. 256 / 8 - break; - case 'aes192-cbc': - case 'aes192-ctr': - $decryptKeyLength = 24; // eg. 192 / 8 - break; - case 'aes128-cbc': - case 'aes128-ctr': - $decryptKeyLength = 16; // eg. 128 / 8 - break; - case 'arcfour': - case 'arcfour128': - $decryptKeyLength = 16; // eg. 128 / 8 - break; - case 'arcfour256': - $decryptKeyLength = 32; // eg. 128 / 8 - break; - case 'none'; - $decryptKeyLength = 0; - } - - for ($i = 0; $i < count($encryption_algorithms) && !in_array($encryption_algorithms[$i], $this->encryption_algorithms_client_to_server); $i++); - if ($i == count($encryption_algorithms)) { - user_error('No compatible client to server encryption algorithms found', E_USER_NOTICE); - return $this->_disconnect(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); - } - - $encrypt = $encryption_algorithms[$i]; - switch ($encrypt) { - case '3des-cbc': - case '3des-ctr': - $encryptKeyLength = 24; - break; - case 'aes256-cbc': - case 'aes256-ctr': - $encryptKeyLength = 32; - break; - case 'aes192-cbc': - case 'aes192-ctr': - $encryptKeyLength = 24; - break; - case 'aes128-cbc': - case 'aes128-ctr': - $encryptKeyLength = 16; - break; - case 'arcfour': - case 'arcfour128': - $encryptKeyLength = 16; - break; - case 'arcfour256': - $encryptKeyLength = 32; - break; - case 'none'; - $encryptKeyLength = 0; - } - - $keyLength = $decryptKeyLength > $encryptKeyLength ? $decryptKeyLength : $encryptKeyLength; - - // through diffie-hellman key exchange a symmetric key is obtained - for ($i = 0; $i < count($kex_algorithms) && !in_array($kex_algorithms[$i], $this->kex_algorithms); $i++); - if ($i == count($kex_algorithms)) { - user_error('No compatible key exchange algorithms found', E_USER_NOTICE); - return $this->_disconnect(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); - } - - switch ($kex_algorithms[$i]) { - // see http://tools.ietf.org/html/rfc2409#section-6.2 and - // http://tools.ietf.org/html/rfc2412, appendex E - case 'diffie-hellman-group1-sha1': - $p = pack('H256', 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' . - '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . - '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . - 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF'); - $keyLength = $keyLength < 160 ? $keyLength : 160; - $hash = 'sha1'; - break; - // see http://tools.ietf.org/html/rfc3526#section-3 - case 'diffie-hellman-group14-sha1': - $p = pack('H512', 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' . - '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . - '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . - 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF05' . - '98DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB' . - '9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B' . - 'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF695581718' . - '3995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF'); - $keyLength = $keyLength < 160 ? $keyLength : 160; - $hash = 'sha1'; - } - - $p = new Math_BigInteger($p, 256); - //$q = $p->bitwise_rightShift(1); - - /* To increase the speed of the key exchange, both client and server may - reduce the size of their private exponents. It should be at least - twice as long as the key material that is generated from the shared - secret. For more details, see the paper by van Oorschot and Wiener - [VAN-OORSCHOT]. - - -- http://tools.ietf.org/html/rfc4419#section-6.2 */ - $q = new Math_BigInteger(1); - $q = $q->bitwise_leftShift(2 * $keyLength); - $q = $q->subtract(new Math_BigInteger(1)); - - $g = new Math_BigInteger(2); - $x = new Math_BigInteger(); - $x->setRandomGenerator('crypt_random'); - $x = $x->random(new Math_BigInteger(1), $q); - $e = $g->modPow($x, $p); - - $eBytes = $e->toBytes(true); - $data = pack('CNa*', NET_SSH2_MSG_KEXDH_INIT, strlen($eBytes), $eBytes); - - if (!$this->_send_binary_packet($data)) { - user_error('Connection closed by server', E_USER_NOTICE); - return false; - } - - $response = $this->_get_binary_packet(); - if ($response === false) { - user_error('Connection closed by server', E_USER_NOTICE); - return false; - } - extract(unpack('Ctype', $this->_string_shift($response, 1))); - - if ($type != NET_SSH2_MSG_KEXDH_REPLY) { - user_error('Expected SSH_MSG_KEXDH_REPLY', E_USER_NOTICE); - return false; - } - - $temp = unpack('Nlength', $this->_string_shift($response, 4)); - $this->server_public_host_key = $server_public_host_key = $this->_string_shift($response, $temp['length']); - - $temp = unpack('Nlength', $this->_string_shift($server_public_host_key, 4)); - $public_key_format = $this->_string_shift($server_public_host_key, $temp['length']); - - $temp = unpack('Nlength', $this->_string_shift($response, 4)); - $fBytes = $this->_string_shift($response, $temp['length']); - $f = new Math_BigInteger($fBytes, -256); - - $temp = unpack('Nlength', $this->_string_shift($response, 4)); - $this->signature = $this->_string_shift($response, $temp['length']); - - $temp = unpack('Nlength', $this->_string_shift($this->signature, 4)); - $this->signature_format = $this->_string_shift($this->signature, $temp['length']); - - $key = $f->modPow($x, $p); - $keyBytes = $key->toBytes(true); - - if ($this->session_id === false) { - $source = pack('Na*Na*Na*Na*Na*Na*Na*Na*', - strlen($this->identifier), $this->identifier, strlen($this->server_identifier), $this->server_identifier, - strlen($kexinit_payload_client), $kexinit_payload_client, strlen($kexinit_payload_server), - $kexinit_payload_server, strlen($this->server_public_host_key), $this->server_public_host_key, strlen($eBytes), - $eBytes, strlen($fBytes), $fBytes, strlen($keyBytes), $keyBytes - ); - - $source = pack('H*', $hash($source)); - - $this->session_id = $source; - } - - for ($i = 0; $i < count($server_host_key_algorithms) && !in_array($server_host_key_algorithms[$i], $this->server_host_key_algorithms); $i++); - if ($i == count($server_host_key_algorithms)) { - user_error('No compatible server host key algorithms found', E_USER_NOTICE); - return $this->_disconnect(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); - } - - if ($public_key_format != $server_host_key_algorithms[$i] || $this->signature_format != $server_host_key_algorithms[$i]) { - user_error('Sever Host Key Algorithm Mismatch', E_USER_NOTICE); - return $this->_disconnect(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); - } - - $packet = pack('C', - NET_SSH2_MSG_NEWKEYS - ); - - if (!$this->_send_binary_packet($packet)) { - return false; - } - - $response = $this->_get_binary_packet(); - - if ($response === false) { - user_error('Connection closed by server', E_USER_NOTICE); - return false; - } - - extract(unpack('Ctype', $this->_string_shift($response, 1))); - - if ($type != NET_SSH2_MSG_NEWKEYS) { - user_error('Expected SSH_MSG_NEWKEYS', E_USER_NOTICE); - return false; - } - - switch ($encrypt) { - case '3des-cbc': - $this->encrypt = new Crypt_TripleDES(); - // $this->encrypt_block_size = 64 / 8 == the default - break; - case '3des-ctr': - $this->encrypt = new Crypt_TripleDES(CRYPT_DES_MODE_CTR); - // $this->encrypt_block_size = 64 / 8 == the default - break; - case 'aes256-cbc': - case 'aes192-cbc': - case 'aes128-cbc': - $this->encrypt = new Crypt_AES(); - $this->encrypt_block_size = 16; // eg. 128 / 8 - break; - case 'aes256-ctr': - case 'aes192-ctr': - case 'aes128-ctr': - $this->encrypt = new Crypt_AES(CRYPT_AES_MODE_CTR); - $this->encrypt_block_size = 16; // eg. 128 / 8 - break; - case 'arcfour': - case 'arcfour128': - case 'arcfour256': - $this->encrypt = new Crypt_RC4(); - break; - case 'none'; - //$this->encrypt = new Crypt_Null(); - } - - switch ($decrypt) { - case '3des-cbc': - $this->decrypt = new Crypt_TripleDES(); - break; - case '3des-ctr': - $this->decrypt = new Crypt_TripleDES(CRYPT_DES_MODE_CTR); - break; - case 'aes256-cbc': - case 'aes192-cbc': - case 'aes128-cbc': - $this->decrypt = new Crypt_AES(); - $this->decrypt_block_size = 16; - break; - case 'aes256-ctr': - case 'aes192-ctr': - case 'aes128-ctr': - $this->decrypt = new Crypt_AES(CRYPT_AES_MODE_CTR); - $this->decrypt_block_size = 16; - break; - case 'arcfour': - case 'arcfour128': - case 'arcfour256': - $this->decrypt = new Crypt_RC4(); - break; - case 'none'; - //$this->decrypt = new Crypt_Null(); - } - - $keyBytes = pack('Na*', strlen($keyBytes), $keyBytes); - - if ($this->encrypt) { - $this->encrypt->enableContinuousBuffer(); - $this->encrypt->disablePadding(); - - $iv = pack('H*', $hash($keyBytes . $this->session_id . 'A' . $this->session_id)); - while ($this->encrypt_block_size > strlen($iv)) { - $iv.= pack('H*', $hash($keyBytes . $this->session_id . $iv)); - } - $this->encrypt->setIV(substr($iv, 0, $this->encrypt_block_size)); - - $key = pack('H*', $hash($keyBytes . $this->session_id . 'C' . $this->session_id)); - while ($encryptKeyLength > strlen($key)) { - $key.= pack('H*', $hash($keyBytes . $this->session_id . $key)); - } - $this->encrypt->setKey(substr($key, 0, $encryptKeyLength)); - } - - if ($this->decrypt) { - $this->decrypt->enableContinuousBuffer(); - $this->decrypt->disablePadding(); - - $iv = pack('H*', $hash($keyBytes . $this->session_id . 'B' . $this->session_id)); - while ($this->decrypt_block_size > strlen($iv)) { - $iv.= pack('H*', $hash($keyBytes . $this->session_id . $iv)); - } - $this->decrypt->setIV(substr($iv, 0, $this->decrypt_block_size)); - - $key = pack('H*', $hash($keyBytes . $this->session_id . 'D' . $this->session_id)); - while ($decryptKeyLength > strlen($key)) { - $key.= pack('H*', $hash($keyBytes . $this->session_id . $key)); - } - $this->decrypt->setKey(substr($key, 0, $decryptKeyLength)); - } - - /* The "arcfour128" algorithm is the RC4 cipher, as described in - [SCHNEIER], using a 128-bit key. The first 1536 bytes of keystream - generated by the cipher MUST be discarded, and the first byte of the - first encrypted packet MUST be encrypted using the 1537th byte of - keystream. - - -- http://tools.ietf.org/html/rfc4345#section-4 */ - if ($encrypt == 'arcfour128' || $encrypt == 'arcfour256') { - $this->encrypt->encrypt(str_repeat("\0", 1536)); - } - if ($decrypt == 'arcfour128' || $decrypt == 'arcfour256') { - $this->decrypt->decrypt(str_repeat("\0", 1536)); - } - - for ($i = 0; $i < count($mac_algorithms) && !in_array($mac_algorithms[$i], $this->mac_algorithms_client_to_server); $i++); - if ($i == count($mac_algorithms)) { - user_error('No compatible client to server message authentication algorithms found', E_USER_NOTICE); - return $this->_disconnect(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); - } - - $createKeyLength = 0; // ie. $mac_algorithms[$i] == 'none' - switch ($mac_algorithms[$i]) { - case 'hmac-sha1': - $this->hmac_create = new Crypt_Hash('sha1'); - $createKeyLength = 20; - break; - case 'hmac-sha1-96': - $this->hmac_create = new Crypt_Hash('sha1-96'); - $createKeyLength = 20; - break; - case 'hmac-md5': - $this->hmac_create = new Crypt_Hash('md5'); - $createKeyLength = 16; - break; - case 'hmac-md5-96': - $this->hmac_create = new Crypt_Hash('md5-96'); - $createKeyLength = 16; - } - - for ($i = 0; $i < count($mac_algorithms) && !in_array($mac_algorithms[$i], $this->mac_algorithms_server_to_client); $i++); - if ($i == count($mac_algorithms)) { - user_error('No compatible server to client message authentication algorithms found', E_USER_NOTICE); - return $this->_disconnect(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); - } - - $checkKeyLength = 0; - $this->hmac_size = 0; - switch ($mac_algorithms[$i]) { - case 'hmac-sha1': - $this->hmac_check = new Crypt_Hash('sha1'); - $checkKeyLength = 20; - $this->hmac_size = 20; - break; - case 'hmac-sha1-96': - $this->hmac_check = new Crypt_Hash('sha1-96'); - $checkKeyLength = 20; - $this->hmac_size = 12; - break; - case 'hmac-md5': - $this->hmac_check = new Crypt_Hash('md5'); - $checkKeyLength = 16; - $this->hmac_size = 16; - break; - case 'hmac-md5-96': - $this->hmac_check = new Crypt_Hash('md5-96'); - $checkKeyLength = 16; - $this->hmac_size = 12; - } - - $key = pack('H*', $hash($keyBytes . $this->session_id . 'E' . $this->session_id)); - while ($createKeyLength > strlen($key)) { - $key.= pack('H*', $hash($keyBytes . $this->session_id . $key)); - } - $this->hmac_create->setKey(substr($key, 0, $createKeyLength)); - - $key = pack('H*', $hash($keyBytes . $this->session_id . 'F' . $this->session_id)); - while ($checkKeyLength > strlen($key)) { - $key.= pack('H*', $hash($keyBytes . $this->session_id . $key)); - } - $this->hmac_check->setKey(substr($key, 0, $checkKeyLength)); - - for ($i = 0; $i < count($compression_algorithms) && !in_array($compression_algorithms[$i], $this->compression_algorithms_server_to_client); $i++); - if ($i == count($compression_algorithms)) { - user_error('No compatible server to client compression algorithms found', E_USER_NOTICE); - return $this->_disconnect(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); - } - $this->decompress = $compression_algorithms[$i] == 'zlib'; - - for ($i = 0; $i < count($compression_algorithms) && !in_array($compression_algorithms[$i], $this->compression_algorithms_client_to_server); $i++); - if ($i == count($compression_algorithms)) { - user_error('No compatible client to server compression algorithms found', E_USER_NOTICE); - return $this->_disconnect(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); - } - $this->compress = $compression_algorithms[$i] == 'zlib'; - - return true; - } - - /** - * Login - * - * @param String $username - * @param optional String $password - * @return Boolean - * @access public - * @internal It might be worthwhile, at some point, to protect against {@link http://tools.ietf.org/html/rfc4251#section-9.3.9 traffic analysis} - * by sending dummy SSH_MSG_IGNORE messages. - */ - function login($username, $password = '') - { - if (!($this->bitmap & NET_SSH2_MASK_CONSTRUCTOR)) { - return false; - } - - $packet = pack('CNa*', - NET_SSH2_MSG_SERVICE_REQUEST, strlen('ssh-userauth'), 'ssh-userauth' - ); - - if (!$this->_send_binary_packet($packet)) { - return false; - } - - $response = $this->_get_binary_packet(); - if ($response === false) { - user_error('Connection closed by server', E_USER_NOTICE); - return false; - } - - extract(unpack('Ctype', $this->_string_shift($response, 1))); - - if ($type != NET_SSH2_MSG_SERVICE_ACCEPT) { - user_error('Expected SSH_MSG_SERVICE_ACCEPT', E_USER_NOTICE); - return false; - } - - // although PHP5's get_class() preserves the case, PHP4's does not - if (is_object($password) && strtolower(get_class($password)) == 'crypt_rsa') { - return $this->_privatekey_login($username, $password); - } - - $utf8_password = utf8_encode($password); - $packet = pack('CNa*Na*Na*CNa*', - NET_SSH2_MSG_USERAUTH_REQUEST, strlen($username), $username, strlen('ssh-connection'), 'ssh-connection', - strlen('password'), 'password', 0, strlen($utf8_password), $utf8_password - ); - - if (!$this->_send_binary_packet($packet)) { - return false; - } - - // remove the username and password from the last logged packet - if (defined('NET_SSH2_LOGGING') && NET_SSH2_LOGGING == NET_SSH2_LOG_COMPLEX) { - $packet = pack('CNa*Na*Na*CNa*', - NET_SSH2_MSG_USERAUTH_REQUEST, strlen('username'), 'username', strlen('ssh-connection'), 'ssh-connection', - strlen('password'), 'password', 0, strlen('password'), 'password' - ); - $this->message_log[count($this->message_log) - 1] = $packet; - } - - $response = $this->_get_binary_packet(); - if ($response === false) { - user_error('Connection closed by server', E_USER_NOTICE); - return false; - } - - extract(unpack('Ctype', $this->_string_shift($response, 1))); - - switch ($type) { - case NET_SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ: // in theory, the password can be changed - if (defined('NET_SSH2_LOGGING')) { - $this->message_number_log[count($this->message_number_log) - 1] = 'NET_SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ'; - } - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $this->errors[] = 'SSH_MSG_USERAUTH_PASSWD_CHANGEREQ: ' . utf8_decode($this->_string_shift($response, $length)); - return $this->_disconnect(NET_SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER); - case NET_SSH2_MSG_USERAUTH_FAILURE: - // either the login is bad or the server employees multi-factor authentication - return false; - case NET_SSH2_MSG_USERAUTH_SUCCESS: - $this->bitmap |= NET_SSH2_MASK_LOGIN; - return true; - } - - return false; - } - - /** - * Login with an RSA private key - * - * @param String $username - * @param Crypt_RSA $password - * @return Boolean - * @access private - * @internal It might be worthwhile, at some point, to protect against {@link http://tools.ietf.org/html/rfc4251#section-9.3.9 traffic analysis} - * by sending dummy SSH_MSG_IGNORE messages. - */ - function _privatekey_login($username, $privatekey) - { - // see http://tools.ietf.org/html/rfc4253#page-15 - $publickey = $privatekey->getPublicKey(CRYPT_RSA_PUBLIC_FORMAT_RAW); - if ($publickey === false) { - return false; - } - - $publickey = array( - 'e' => $publickey['e']->toBytes(true), - 'n' => $publickey['n']->toBytes(true) - ); - $publickey = pack('Na*Na*Na*', - strlen('ssh-rsa'), 'ssh-rsa', strlen($publickey['e']), $publickey['e'], strlen($publickey['n']), $publickey['n'] - ); - - $part1 = pack('CNa*Na*Na*', - NET_SSH2_MSG_USERAUTH_REQUEST, strlen($username), $username, strlen('ssh-connection'), 'ssh-connection', - strlen('publickey'), 'publickey' - ); - $part2 = pack('Na*Na*', strlen('ssh-rsa'), 'ssh-rsa', strlen($publickey), $publickey); - - $packet = $part1 . chr(0) . $part2; - - if (!$this->_send_binary_packet($packet)) { - return false; - } - - $response = $this->_get_binary_packet(); - if ($response === false) { - user_error('Connection closed by server', E_USER_NOTICE); - return false; - } - - extract(unpack('Ctype', $this->_string_shift($response, 1))); - - switch ($type) { - case NET_SSH2_MSG_USERAUTH_FAILURE: - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $this->errors[] = 'SSH_MSG_USERAUTH_FAILURE: ' . $this->_string_shift($response, $length); - return $this->_disconnect(NET_SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER); - case NET_SSH2_MSG_USERAUTH_PK_OK: - // we'll just take it on faith that the public key blob and the public key algorithm name are as - // they should be - if (defined('NET_SSH2_LOGGING')) { - $this->message_number_log[count($this->message_number_log) - 1] = 'NET_SSH2_MSG_USERAUTH_PK_OK'; - } - } - - $packet = $part1 . chr(1) . $part2; - $privatekey->setSignatureMode(CRYPT_RSA_SIGNATURE_PKCS1); - $signature = $privatekey->sign(pack('Na*a*', strlen($this->session_id), $this->session_id, $packet)); - $signature = pack('Na*Na*', strlen('ssh-rsa'), 'ssh-rsa', strlen($signature), $signature); - $packet.= pack('Na*', strlen($signature), $signature); - - if (!$this->_send_binary_packet($packet)) { - return false; - } - - $response = $this->_get_binary_packet(); - if ($response === false) { - user_error('Connection closed by server', E_USER_NOTICE); - return false; - } - - extract(unpack('Ctype', $this->_string_shift($response, 1))); - - switch ($type) { - case NET_SSH2_MSG_USERAUTH_FAILURE: - // either the login is bad or the server employees multi-factor authentication - return false; - case NET_SSH2_MSG_USERAUTH_SUCCESS: - $this->bitmap |= NET_SSH2_MASK_LOGIN; - return true; - } - - return false; - } - - /** - * Execute Command - * - * @param String $command - * @return String - * @access public - */ - function exec($command) - { - if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) { - return false; - } - - // RFC4254 defines the (client) window size as "bytes the other party can send before it must wait for the window to - // be adjusted". 0x7FFFFFFF is, at 4GB, the max size. technically, it should probably be decremented, but, - // honestly, if you're transfering more than 4GB, you probably shouldn't be using phpseclib, anyway. - // see http://tools.ietf.org/html/rfc4254#section-5.2 for more info - $this->window_size_client_to_server[NET_SSH2_CHANNEL_EXEC] = 0x7FFFFFFF; - // 0x8000 is the maximum max packet size, per http://tools.ietf.org/html/rfc4253#section-6.1, although since PuTTy - // uses 0x4000, that's what will be used here, as well. - $packet_size = 0x4000; - - $packet = pack('CNa*N3', - NET_SSH2_MSG_CHANNEL_OPEN, strlen('session'), 'session', NET_SSH2_CHANNEL_EXEC, $this->window_size_client_to_server[NET_SSH2_CHANNEL_EXEC], $packet_size); - - if (!$this->_send_binary_packet($packet)) { - return false; - } - - $this->channel_status[NET_SSH2_CHANNEL_EXEC] = NET_SSH2_MSG_CHANNEL_OPEN; - - $response = $this->_get_channel_packet(NET_SSH2_CHANNEL_EXEC); - if ($response === false) { - return false; - } - - // sending a pty-req SSH_MSG_CHANNEL_REQUEST message is unnecessary and, in fact, in most cases, slows things - // down. the one place where it might be desirable is if you're doing something like Net_SSH2::exec('ping localhost &'). - // with a pty-req SSH_MSG_cHANNEL_REQUEST, exec() will return immediately and the ping process will then - // then immediately terminate. without such a request exec() will loop indefinitely. the ping process won't end but - // neither will your script. - - // although, in theory, the size of SSH_MSG_CHANNEL_REQUEST could exceed the maximum packet size established by - // SSH_MSG_CHANNEL_OPEN_CONFIRMATION, RFC4254#section-5.1 states that the "maximum packet size" refers to the - // "maximum size of an individual data packet". ie. SSH_MSG_CHANNEL_DATA. RFC4254#section-5.2 corroborates. - $packet = pack('CNNa*CNa*', - NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[NET_SSH2_CHANNEL_EXEC], strlen('exec'), 'exec', 1, strlen($command), $command); - if (!$this->_send_binary_packet($packet)) { - return false; - } - - $this->channel_status[NET_SSH2_CHANNEL_EXEC] = NET_SSH2_MSG_CHANNEL_REQUEST; - - $response = $this->_get_channel_packet(NET_SSH2_CHANNEL_EXEC); - if ($response === false) { - return false; - } - - $this->channel_status[NET_SSH2_CHANNEL_EXEC] = NET_SSH2_MSG_CHANNEL_DATA; - - $output = ''; - while (true) { - $temp = $this->_get_channel_packet(NET_SSH2_CHANNEL_EXEC); - switch (true) { - case $temp === true: - return $output; - case $temp === false: - return false; - default: - $output.= $temp; - } - } - } - - /** - * Disconnect - * - * @access public - */ - function disconnect() - { - $this->_disconnect(NET_SSH2_DISCONNECT_BY_APPLICATION); - } - - /** - * Destructor. - * - * Will be called, automatically, if you're supporting just PHP5. If you're supporting PHP4, you'll need to call - * disconnect(). - * - * @access public - */ - function __destruct() - { - $this->disconnect(); - } - - /** - * Gets Binary Packets - * - * See '6. Binary Packet Protocol' of rfc4253 for more info. - * - * @see Net_SSH2::_send_binary_packet() - * @return String - * @access private - */ - function _get_binary_packet() - { - if (feof($this->fsock)) { - user_error('Connection closed prematurely', E_USER_NOTICE); - return false; - } - - $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838 - $raw = fread($this->fsock, $this->decrypt_block_size); - $stop = strtok(microtime(), ' ') + strtok(''); - - if ($this->decrypt !== false) { - $raw = $this->decrypt->decrypt($raw); - } - - extract(unpack('Npacket_length/Cpadding_length', $this->_string_shift($raw, 5))); - - $remaining_length = $packet_length + 4 - $this->decrypt_block_size; - $buffer = ''; - while ($remaining_length > 0) { - $temp = fread($this->fsock, $remaining_length); - $buffer.= $temp; - $remaining_length-= strlen($temp); - } - if (!empty($buffer)) { - $raw.= $this->decrypt !== false ? $this->decrypt->decrypt($buffer) : $buffer; - $buffer = $temp = ''; - } - - $payload = $this->_string_shift($raw, $packet_length - $padding_length - 1); - $padding = $this->_string_shift($raw, $padding_length); // should leave $raw empty - - if ($this->hmac_check !== false) { - $hmac = fread($this->fsock, $this->hmac_size); - if ($hmac != $this->hmac_check->hash(pack('NNCa*', $this->get_seq_no, $packet_length, $padding_length, $payload . $padding))) { - user_error('Invalid HMAC', E_USER_NOTICE); - return false; - } - } - - //if ($this->decompress) { - // $payload = gzinflate(substr($payload, 2)); - //} - - $this->get_seq_no++; - - if (defined('NET_SSH2_LOGGING')) { - $temp = isset($this->message_numbers[ord($payload[0])]) ? $this->message_numbers[ord($payload[0])] : 'UNKNOWN'; - $this->message_number_log[] = '<- ' . $temp . - ' (' . round($stop - $start, 4) . 's)'; - if (NET_SSH2_LOGGING == NET_SSH2_LOG_COMPLEX) { - $this->message_log[] = substr($payload, 1); - } - } - - return $this->_filter($payload); - } - - /** - * Filter Binary Packets - * - * Because some binary packets need to be ignored... - * - * @see Net_SSH2::_get_binary_packet() - * @return String - * @access private - */ - function _filter($payload) - { - switch (ord($payload[0])) { - case NET_SSH2_MSG_DISCONNECT: - $this->_string_shift($payload, 1); - extract(unpack('Nreason_code/Nlength', $this->_string_shift($payload, 8))); - $this->errors[] = 'SSH_MSG_DISCONNECT: ' . $this->disconnect_reasons[$reason_code] . "\r\n" . utf8_decode($this->_string_shift($payload, $length)); - $this->bitmask = 0; - return false; - case NET_SSH2_MSG_IGNORE: - $payload = $this->_get_binary_packet(); - break; - case NET_SSH2_MSG_DEBUG: - $this->_string_shift($payload, 2); - extract(unpack('Nlength', $this->_string_shift($payload, 4))); - $this->errors[] = 'SSH_MSG_DEBUG: ' . utf8_decode($this->_string_shift($payload, $length)); - $payload = $this->_get_binary_packet(); - break; - case NET_SSH2_MSG_UNIMPLEMENTED: - return false; - case NET_SSH2_MSG_KEXINIT: - if ($this->session_id !== false) { - if (!$this->_key_exchange($payload)) { - $this->bitmask = 0; - return false; - } - $payload = $this->_get_binary_packet(); - } - } - - // see http://tools.ietf.org/html/rfc4252#section-5.4; only called when the encryption has been activated and when we haven't already logged in - if (($this->bitmap & NET_SSH2_MASK_CONSTRUCTOR) && !($this->bitmap & NET_SSH2_MASK_LOGIN) && ord($payload[0]) == NET_SSH2_MSG_USERAUTH_BANNER) { - $this->_string_shift($payload, 1); - extract(unpack('Nlength', $this->_string_shift($payload, 4))); - $this->errors[] = 'SSH_MSG_USERAUTH_BANNER: ' . utf8_decode($this->_string_shift($payload, $length)); - $payload = $this->_get_binary_packet(); - } - - // only called when we've already logged in - if (($this->bitmap & NET_SSH2_MASK_CONSTRUCTOR) && ($this->bitmap & NET_SSH2_MASK_LOGIN)) { - switch (ord($payload[0])) { - case NET_SSH2_MSG_GLOBAL_REQUEST: // see http://tools.ietf.org/html/rfc4254#section-4 - $this->_string_shift($payload, 1); - extract(unpack('Nlength', $this->_string_shift($payload))); - $this->errors[] = 'SSH_MSG_GLOBAL_REQUEST: ' . utf8_decode($this->_string_shift($payload, $length)); - - if (!$this->_send_binary_packet(pack('C', NET_SSH2_MSG_REQUEST_FAILURE))) { - return $this->_disconnect(NET_SSH2_DISCONNECT_BY_APPLICATION); - } - - $payload = $this->_get_binary_packet(); - break; - case NET_SSH2_MSG_CHANNEL_OPEN: // see http://tools.ietf.org/html/rfc4254#section-5.1 - $this->_string_shift($payload, 1); - extract(unpack('N', $this->_string_shift($payload, 4))); - $this->errors[] = 'SSH_MSG_CHANNEL_OPEN: ' . utf8_decode($this->_string_shift($payload, $length)); - - $this->_string_shift($payload, 4); // skip over client channel - extract(unpack('Nserver_channel', $this->_string_shift($payload, 4))); - - $packet = pack('CN3a*Na*', - NET_SSH2_MSG_REQUEST_FAILURE, $server_channel, NET_SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED, 0, '', 0, ''); - - if (!$this->_send_binary_packet($packet)) { - return $this->_disconnect(NET_SSH2_DISCONNECT_BY_APPLICATION); - } - - $payload = $this->_get_binary_packet(); - break; - case NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST: - $payload = $this->_get_binary_packet(); - } - } - - return $payload; - } - - /** - * Gets channel data - * - * Returns the data as a string if it's available and false if not. - * - * @param $client_channel - * @return Mixed - * @access private - */ - function _get_channel_packet($client_channel) - { - if (!empty($this->channel_buffers[$client_channel])) { - return array_shift($this->channel_buffers[$client_channel]); - } - - while (true) { - $response = $this->_get_binary_packet(); - if ($response === false) { - user_error('Connection closed by server', E_USER_NOTICE); - return false; - } - - extract(unpack('Ctype/Nchannel', $this->_string_shift($response, 5))); - - switch ($this->channel_status[$channel]) { - case NET_SSH2_MSG_CHANNEL_OPEN: - switch ($type) { - case NET_SSH2_MSG_CHANNEL_OPEN_CONFIRMATION: - extract(unpack('Nserver_channel', $this->_string_shift($response, 4))); - $this->server_channels[$client_channel] = $server_channel; - $this->_string_shift($response, 4); // skip over (server) window size - $temp = unpack('Npacket_size_client_to_server', $this->_string_shift($response, 4)); - $this->packet_size_client_to_server[$client_channel] = $temp['packet_size_client_to_server']; - return true; - //case NET_SSH2_MSG_CHANNEL_OPEN_FAILURE: - default: - user_error('Unable to open channel', E_USER_NOTICE); - return $this->_disconnect(NET_SSH2_DISCONNECT_BY_APPLICATION); - } - break; - case NET_SSH2_MSG_CHANNEL_REQUEST: - switch ($type) { - case NET_SSH2_MSG_CHANNEL_SUCCESS: - return true; - //case NET_SSH2_MSG_CHANNEL_FAILURE: - default: - user_error('Unable to request pseudo-terminal', E_USER_NOTICE); - return $this->_disconnect(NET_SSH2_DISCONNECT_BY_APPLICATION); - } - - } - - switch ($type) { - case NET_SSH2_MSG_CHANNEL_DATA: - if ($client_channel == NET_SSH2_CHANNEL_EXEC) { - // SCP requires null packets, such as this, be sent. further, in the case of the ssh.com SSH server - // this actually seems to make things twice as fast. more to the point, the message right after - // SSH_MSG_CHANNEL_DATA (usually SSH_MSG_IGNORE) won't block for as long as it would have otherwise. - // in OpenSSH it slows things down but only by a couple thousandths of a second. - $this->_send_channel_packet($client_channel, chr(0)); - } - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $data = $this->_string_shift($response, $length); - if ($client_channel == $channel) { - return $data; - } - if (!isset($this->channel_buffers[$client_channel])) { - $this->channel_buffers[$client_channel] = array(); - } - $this->channel_buffers[$client_channel][] = $data; - break; - case NET_SSH2_MSG_CHANNEL_EXTENDED_DATA: - if ($client_channel == NET_SSH2_CHANNEL_EXEC) { - $this->_send_channel_packet($client_channel, chr(0)); - } - // currently, there's only one possible value for $data_type_code: NET_SSH2_EXTENDED_DATA_STDERR - extract(unpack('Ndata_type_code/Nlength', $this->_string_shift($response, 8))); - $data = $this->_string_shift($response, $length); - if ($client_channel == $channel) { - return $data; - } - if (!isset($this->channel_buffers[$client_channel])) { - $this->channel_buffers[$client_channel] = array(); - } - $this->channel_buffers[$client_channel][] = $data; - break; - case NET_SSH2_MSG_CHANNEL_REQUEST: - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $value = $this->_string_shift($response, $length); - switch ($value) { - case 'exit-signal': - $this->_string_shift($response, 1); - extract(unpack('Nlength', $this->_string_shift($response, 4))); - $this->errors[] = 'SSH_MSG_CHANNEL_REQUEST (exit-signal): ' . $this->_string_shift($response, $length); - $this->_string_shift($response, 1); - extract(unpack('Nlength', $this->_string_shift($response, 4))); - if ($length) { - $this->errors[count($this->errors)].= "\r\n" . $this->_string_shift($response, $length); - } - //case 'exit-status': - default: - // "Some systems may not implement signals, in which case they SHOULD ignore this message." - // -- http://tools.ietf.org/html/rfc4254#section-6.9 - break; - } - break; - case NET_SSH2_MSG_CHANNEL_CLOSE: - $this->_send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$channel])); - return true; - case NET_SSH2_MSG_CHANNEL_EOF: - break; - default: - user_error('Error reading channel data', E_USER_NOTICE); - return $this->_disconnect(NET_SSH2_DISCONNECT_BY_APPLICATION); - } - } - } - - /** - * Sends Binary Packets - * - * See '6. Binary Packet Protocol' of rfc4253 for more info. - * - * @param String $data - * @see Net_SSH2::_get_binary_packet() - * @return Boolean - * @access private - */ - function _send_binary_packet($data) - { - if (feof($this->fsock)) { - user_error('Connection closed prematurely', E_USER_NOTICE); - return false; - } - - //if ($this->compress) { - // // the -4 removes the checksum: - // // http://php.net/function.gzcompress#57710 - // $data = substr(gzcompress($data), 0, -4); - //} - - // 4 (packet length) + 1 (padding length) + 4 (minimal padding amount) == 9 - $packet_length = strlen($data) + 9; - // round up to the nearest $this->encrypt_block_size - $packet_length+= (($this->encrypt_block_size - 1) * $packet_length) % $this->encrypt_block_size; - // subtracting strlen($data) is obvious - subtracting 5 is necessary because of packet_length and padding_length - $padding_length = $packet_length - strlen($data) - 5; - - $padding = ''; - for ($i = 0; $i < $padding_length; $i++) { - $padding.= chr(crypt_random(0, 255)); - } - - // we subtract 4 from packet_length because the packet_length field isn't supposed to include itself - $packet = pack('NCa*', $packet_length - 4, $padding_length, $data . $padding); - - $hmac = $this->hmac_create !== false ? $this->hmac_create->hash(pack('Na*', $this->send_seq_no, $packet)) : ''; - $this->send_seq_no++; - - if ($this->encrypt !== false) { - $packet = $this->encrypt->encrypt($packet); - } - - $packet.= $hmac; - - $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838 - $result = strlen($packet) == fputs($this->fsock, $packet); - $stop = strtok(microtime(), ' ') + strtok(''); - - if (defined('NET_SSH2_LOGGING')) { - $temp = isset($this->message_numbers[ord($data[0])]) ? $this->message_numbers[ord($data[0])] : 'UNKNOWN'; - $this->message_number_log[] = '-> ' . $temp . - ' (' . round($stop - $start, 4) . 's)'; - if (NET_SSH2_LOGGING == NET_SSH2_LOG_COMPLEX) { - $this->message_log[] = substr($data, 1); - } - } - - return $result; - } - - /** - * Sends channel data - * - * Spans multiple SSH_MSG_CHANNEL_DATAs if appropriate - * - * @param Integer $client_channel - * @param String $data - * @return Boolean - * @access private - */ - function _send_channel_packet($client_channel, $data) - { - while (strlen($data) > $this->packet_size_client_to_server[$client_channel]) { - // resize the window, if appropriate - $this->window_size_client_to_server[$client_channel]-= $this->packet_size_client_to_server[$client_channel]; - if ($this->window_size_client_to_server[$client_channel] < 0) { - $packet = pack('CNN', NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST, $this->server_channels[$client_channel], $this->window_size); - if (!$this->_send_binary_packet($packet)) { - return false; - } - $this->window_size_client_to_server[$client_channel]+= $this->window_size; - } - - $packet = pack('CN2a*', - NET_SSH2_MSG_CHANNEL_DATA, - $this->server_channels[$client_channel], - $this->packet_size_client_to_server[$client_channel], - $this->_string_shift($data, $this->packet_size_client_to_server[$client_channel]) - ); - - if (!$this->_send_binary_packet($packet)) { - return false; - } - } - - // resize the window, if appropriate - $this->window_size_client_to_server[$client_channel]-= strlen($data); - if ($this->window_size_client_to_server[$client_channel] < 0) { - $packet = pack('CNN', NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST, $this->server_channels[$client_channel], $this->window_size); - if (!$this->_send_binary_packet($packet)) { - return false; - } - $this->window_size_client_to_server[$client_channel]+= $this->window_size; - } - - return $this->_send_binary_packet(pack('CN2a*', - NET_SSH2_MSG_CHANNEL_DATA, - $this->server_channels[$client_channel], - strlen($data), - $data)); - } - - /** - * Disconnect - * - * @param Integer $reason - * @return Boolean - * @access private - */ - function _disconnect($reason) - { - if ($this->bitmap) { - $data = pack('CNNa*Na*', NET_SSH2_MSG_DISCONNECT, $reason, 0, '', 0, ''); - $this->_send_binary_packet($data); - $this->bitmap = 0; - fclose($this->fsock); - return false; - } - } - - /** - * String Shift - * - * Inspired by array_shift - * - * @param String $string - * @param optional Integer $index - * @return String - * @access private - */ - function _string_shift(&$string, $index = 1) - { - $substr = substr($string, 0, $index); - $string = substr($string, $index); - return $substr; - } - - /** - * Define Array - * - * Takes any number of arrays whose indices are integers and whose values are strings and defines a bunch of - * named constants from it, using the value as the name of the constant and the index as the value of the constant. - * If any of the constants that would be defined already exists, none of the constants will be defined. - * - * @param Array $array - * @access private - */ - function _define_array() - { - $args = func_get_args(); - foreach ($args as $arg) { - foreach ($arg as $key=>$value) { - if (!defined($value)) { - define($value, $key); - } else { - break 2; - } - } - } - } - - /** - * Returns a log of the packets that have been sent and received. - * - * Returns a string if NET_SSH2_LOGGING == NET_SSH2_LOG_COMPLEX, an array if NET_SSH2_LOGGING == NET_SSH2_LOG_SIMPLE and false if !defined('NET_SSH2_LOGGING') - * - * @access public - * @return String or Array - */ - function getLog() - { - if (!defined('NET_SSH2_LOGGING')) { - return false; - } - - switch (NET_SSH2_LOGGING) { - case NET_SSH2_LOG_SIMPLE: - return $this->message_number_log; - break; - case NET_SSH2_LOG_COMPLEX: - return $this->_format_log($this->message_log, $this->message_number_log); - break; - default: - return false; - } - } - - /** - * Formats a log for printing - * - * @param Array $message_log - * @param Array $message_number_log - * @access private - * @return String - */ - function _format_log($message_log, $message_number_log) - { - static $boundary = ':', $long_width = 65, $short_width = 16; - - $output = ''; - for ($i = 0; $i < count($message_log); $i++) { - $output.= $message_number_log[$i] . "\r\n"; - $current_log = $message_log[$i]; - $j = 0; - do { - if (!empty($current_log)) { - $output.= str_pad(dechex($j), 7, '0', STR_PAD_LEFT) . '0 '; - } - $fragment = $this->_string_shift($current_log, $short_width); - $hex = substr( - preg_replace( - '#(.)#es', - '"' . $boundary . '" . str_pad(dechex(ord(substr("\\1", -1))), 2, "0", STR_PAD_LEFT)', - $fragment), - strlen($boundary) - ); - // replace non ASCII printable characters with dots - // http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters - // also replace < with a . since < messes up the output on web browsers - $raw = preg_replace('#[^\x20-\x7E]|<#', '.', $fragment); - $output.= str_pad($hex, $long_width - $short_width, ' ') . $raw . "\r\n"; - $j++; - } while (!empty($current_log)); - $output.= "\r\n"; - } - - return $output; - } - - /** - * Returns all errors - * - * @return String - * @access public - */ - function getErrors() - { - return $this->errors; - } - - /** - * Returns the last error - * - * @return String - * @access public - */ - function getLastError() - { - return $this->errors[count($this->errors) - 1]; - } - - /** - * Return the server identification. - * - * @return String - * @access public - */ - function getServerIdentification() - { - return $this->server_identifier; - } - - /** - * Return a list of the key exchange algorithms the server supports. - * - * @return Array - * @access public - */ - function getKexAlgorithms() - { - return $this->kex_algorithms; - } - - /** - * Return a list of the host key (public key) algorithms the server supports. - * - * @return Array - * @access public - */ - function getServerHostKeyAlgorithms() - { - return $this->server_host_key_algorithms; - } - - /** - * Return a list of the (symmetric key) encryption algorithms the server supports, when receiving stuff from the client. - * - * @return Array - * @access public - */ - function getEncryptionAlgorithmsClient2Server() - { - return $this->encryption_algorithms_client_to_server; - } - - /** - * Return a list of the (symmetric key) encryption algorithms the server supports, when sending stuff to the client. - * - * @return Array - * @access public - */ - function getEncryptionAlgorithmsServer2Client() - { - return $this->encryption_algorithms_server_to_client; - } - - /** - * Return a list of the MAC algorithms the server supports, when receiving stuff from the client. - * - * @return Array - * @access public - */ - function getMACAlgorithmsClient2Server() - { - return $this->mac_algorithms_client_to_server; - } - - /** - * Return a list of the MAC algorithms the server supports, when sending stuff to the client. - * - * @return Array - * @access public - */ - function getMACAlgorithmsServer2Client() - { - return $this->mac_algorithms_server_to_client; - } - - /** - * Return a list of the compression algorithms the server supports, when receiving stuff from the client. - * - * @return Array - * @access public - */ - function getCompressionAlgorithmsClient2Server() - { - return $this->compression_algorithms_client_to_server; - } - - /** - * Return a list of the compression algorithms the server supports, when sending stuff to the client. - * - * @return Array - * @access public - */ - function getCompressionAlgorithmsServer2Client() - { - return $this->compression_algorithms_server_to_client; - } - - /** - * Return a list of the languages the server supports, when sending stuff to the client. - * - * @return Array - * @access public - */ - function getLanguagesServer2Client() - { - return $this->languages_server_to_client; - } - - /** - * Return a list of the languages the server supports, when receiving stuff from the client. - * - * @return Array - * @access public - */ - function getLanguagesClient2Server() - { - return $this->languages_client_to_server; - } - - /** - * Returns the server public host key. - * - * Caching this the first time you connect to a server and checking the result on subsequent connections - * is recommended. Returns false if the server signature is not signed correctly with the public host key. - * - * @return Mixed - * @access public - */ - function getServerPublicHostKey() - { - $signature = $this->signature; - $server_public_host_key = $this->server_public_host_key; - - extract(unpack('Nlength', $this->_string_shift($server_public_host_key, 4))); - $this->_string_shift($server_public_host_key, $length); - - switch ($this->signature_format) { - case 'ssh-dss': - $temp = unpack('Nlength', $this->_string_shift($server_public_host_key, 4)); - $p = new Math_BigInteger($this->_string_shift($server_public_host_key, $temp['length']), -256); - - $temp = unpack('Nlength', $this->_string_shift($server_public_host_key, 4)); - $q = new Math_BigInteger($this->_string_shift($server_public_host_key, $temp['length']), -256); - - $temp = unpack('Nlength', $this->_string_shift($server_public_host_key, 4)); - $g = new Math_BigInteger($this->_string_shift($server_public_host_key, $temp['length']), -256); - - $temp = unpack('Nlength', $this->_string_shift($server_public_host_key, 4)); - $y = new Math_BigInteger($this->_string_shift($server_public_host_key, $temp['length']), -256); - - /* The value for 'dss_signature_blob' is encoded as a string containing - r, followed by s (which are 160-bit integers, without lengths or - padding, unsigned, and in network byte order). */ - $temp = unpack('Nlength', $this->_string_shift($signature, 4)); - if ($temp['length'] != 40) { - user_error('Invalid signature', E_USER_NOTICE); - return $this->_disconnect(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); - } - - $r = new Math_BigInteger($this->_string_shift($signature, 20), 256); - $s = new Math_BigInteger($this->_string_shift($signature, 20), 256); - - if ($r->compare($q) >= 0 || $s->compare($q) >= 0) { - user_error('Invalid signature', E_USER_NOTICE); - return $this->_disconnect(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); - } - - $w = $s->modInverse($q); - - $u1 = $w->multiply(new Math_BigInteger(sha1($this->session_id), 16)); - list(, $u1) = $u1->divide($q); - - $u2 = $w->multiply($r); - list(, $u2) = $u2->divide($q); - - $g = $g->modPow($u1, $p); - $y = $y->modPow($u2, $p); - - $v = $g->multiply($y); - list(, $v) = $v->divide($p); - list(, $v) = $v->divide($q); - - if (!$v->equals($r)) { - user_error('Bad server signature', E_USER_NOTICE); - return $this->_disconnect(NET_SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE); - } - - break; - case 'ssh-rsa': - $temp = unpack('Nlength', $this->_string_shift($server_public_host_key, 4)); - $e = new Math_BigInteger($this->_string_shift($server_public_host_key, $temp['length']), -256); - - $temp = unpack('Nlength', $this->_string_shift($server_public_host_key, 4)); - $n = new Math_BigInteger($this->_string_shift($server_public_host_key, $temp['length']), -256); - $nLength = $temp['length']; - - /* - $temp = unpack('Nlength', $this->_string_shift($signature, 4)); - $signature = $this->_string_shift($signature, $temp['length']); - - if (!class_exists('Crypt_RSA')) { - require_once('Crypt/RSA.php'); - } - - $rsa = new Crypt_RSA(); - $rsa->setSignatureMode(CRYPT_RSA_SIGNATURE_PKCS1); - $rsa->loadKey(array('e' => $e, 'n' => $n), CRYPT_RSA_PUBLIC_FORMAT_RAW); - if (!$rsa->verify($this->session_id, $signature)) { - user_error('Bad server signature', E_USER_NOTICE); - return $this->_disconnect(NET_SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE); - } - */ - - $temp = unpack('Nlength', $this->_string_shift($signature, 4)); - $s = new Math_BigInteger($this->_string_shift($signature, $temp['length']), 256); - - // validate an RSA signature per "8.2 RSASSA-PKCS1-v1_5", "5.2.2 RSAVP1", and "9.1 EMSA-PSS" in the - // following URL: - // ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1.pdf - - // also, see SSHRSA.c (rsa2_verifysig) in PuTTy's source. - - if ($s->compare(new Math_BigInteger()) < 0 || $s->compare($n->subtract(new Math_BigInteger(1))) > 0) { - user_error('Invalid signature', E_USER_NOTICE); - return $this->_disconnect(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); - } - - $s = $s->modPow($e, $n); - $s = $s->toBytes(); - - $h = pack('N4H*', 0x00302130, 0x0906052B, 0x0E03021A, 0x05000414, sha1($this->session_id)); - $h = chr(0x01) . str_repeat(chr(0xFF), $nLength - 3 - strlen($h)) . $h; - - if ($s != $h) { - user_error('Bad server signature', E_USER_NOTICE); - return $this->_disconnect(NET_SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE); - } - } - - return $this->server_public_host_key; - } -} diff --git a/lib/internal/phpseclib/PHP/Compat/Function/array_fill.php b/lib/internal/phpseclib/PHP/Compat/Function/array_fill.php deleted file mode 100644 index 79b5312aa2d..00000000000 --- a/lib/internal/phpseclib/PHP/Compat/Function/array_fill.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php -// $Id: array_fill.php,v 1.1 2007/07/02 04:19:55 terrafrost Exp $ - - -/** - * Replace array_fill() - * - * @category PHP - * @package PHP_Compat - * @license LGPL - http://www.gnu.org/licenses/lgpl.html - * @copyright 2004-2007 Aidan Lister <aidan@php.net>, Arpad Ray <arpad@php.net> - * @link http://php.net/function.array_fill - * @author Jim Wigginton <terrafrost@php.net> - * @version $Revision: 1.1 $ - * @since PHP 4.2.0 - */ -function php_compat_array_fill($start_index, $num, $value) -{ - if ($num <= 0) { - user_error('array_fill(): Number of elements must be positive', E_USER_WARNING); - - return false; - } - - $temp = array(); - - $end_index = $start_index + $num; - for ($i = (int) $start_index; $i < $end_index; $i++) { - $temp[$i] = $value; - } - - return $temp; -} - -// Define -if (!function_exists('array_fill')) { - function array_fill($start_index, $num, $value) - { - return php_compat_array_fill($start_index, $num, $value); - } -} diff --git a/lib/internal/phpseclib/PHP/Compat/Function/bcpowmod.php b/lib/internal/phpseclib/PHP/Compat/Function/bcpowmod.php deleted file mode 100644 index 4c162b87ef6..00000000000 --- a/lib/internal/phpseclib/PHP/Compat/Function/bcpowmod.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php -// $Id: bcpowmod.php,v 1.1 2007/07/02 04:19:55 terrafrost Exp $ - - -/** - * Replace bcpowmod() - * - * @category PHP - * @package PHP_Compat - * @license LGPL - http://www.gnu.org/licenses/lgpl.html - * @copyright 2004-2007 Aidan Lister <aidan@php.net>, Arpad Ray <arpad@php.net> - * @link http://php.net/function.bcpowmod - * @author Sara Golemon <pollita@php.net> - * @version $Revision: 1.1 $ - * @since PHP 5.0.0 - * @require PHP 4.0.0 (user_error) - */ -function php_compat_bcpowmod($x, $y, $modulus, $scale = 0) -{ - // Sanity check - if (!is_scalar($x)) { - user_error('bcpowmod() expects parameter 1 to be string, ' . - gettype($x) . ' given', E_USER_WARNING); - return false; - } - - if (!is_scalar($y)) { - user_error('bcpowmod() expects parameter 2 to be string, ' . - gettype($y) . ' given', E_USER_WARNING); - return false; - } - - if (!is_scalar($modulus)) { - user_error('bcpowmod() expects parameter 3 to be string, ' . - gettype($modulus) . ' given', E_USER_WARNING); - return false; - } - - if (!is_scalar($scale)) { - user_error('bcpowmod() expects parameter 4 to be integer, ' . - gettype($scale) . ' given', E_USER_WARNING); - return false; - } - - $t = '1'; - while (bccomp($y, '0')) { - if (bccomp(bcmod($y, '2'), '0')) { - $t = bcmod(bcmul($t, $x), $modulus); - $y = bcsub($y, '1'); - } - - $x = bcmod(bcmul($x, $x), $modulus); - $y = bcdiv($y, '2'); - } - - return $t; -} - - -// Define -if (!function_exists('bcpowmod')) { - function bcpowmod($x, $y, $modulus, $scale = 0) - { - return php_compat_bcpowmod($x, $y, $modulus, $scale); - } -} diff --git a/lib/internal/phpseclib/PHP/Compat/Function/str_split.php b/lib/internal/phpseclib/PHP/Compat/Function/str_split.php deleted file mode 100644 index 8f5179bc988..00000000000 --- a/lib/internal/phpseclib/PHP/Compat/Function/str_split.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php -/** - * Replace str_split() - * - * @category PHP - * @package PHP_Compat - * @license LGPL - http://www.gnu.org/licenses/lgpl.html - * @copyright 2004-2007 Aidan Lister <aidan@php.net>, Arpad Ray <arpad@php.net> - * @link http://php.net/function.str_split - * @author Aidan Lister <aidan@php.net> - * @version $Revision: 1.1 $ - * @since PHP 5 - * @require PHP 4.0.0 (user_error) - */ -function php_compat_str_split($string, $split_length = 1) -{ - if (!is_scalar($split_length)) { - user_error('str_split() expects parameter 2 to be long, ' . - gettype($split_length) . ' given', E_USER_WARNING); - return false; - } - - $split_length = (int) $split_length; - if ($split_length < 1) { - user_error('str_split() The length of each segment must be greater than zero', E_USER_WARNING); - return false; - } - - // Select split method - if ($split_length < 65536) { - // Faster, but only works for less than 2^16 - preg_match_all('/.{1,' . $split_length . '}/s', $string, $matches); - return $matches[0]; - } else { - // Required due to preg limitations - $arr = array(); - $idx = 0; - $pos = 0; - $len = strlen($string); - - while ($len > 0) { - $blk = ($len < $split_length) ? $len : $split_length; - $arr[$idx++] = substr($string, $pos, $blk); - $pos += $blk; - $len -= $blk; - } - - return $arr; - } -} - - -// Define -if (!function_exists('str_split')) { - function str_split($string, $split_length = 1) - { - return php_compat_str_split($string, $split_length); - } -} diff --git a/setup/config/di.config.php b/setup/config/di.config.php index 30e6af237e9..d64a232dc78 100644 --- a/setup/config/di.config.php +++ b/setup/config/di.config.php @@ -26,7 +26,7 @@ return [ 'preference' => [ 'Zend\EventManager\EventManagerInterface' => 'EventManager', 'Zend\ServiceManager\ServiceLocatorInterface' => 'ServiceManager', - 'Magento\Framework\DB\LoggerInterface' => 'Magento\Framework\DB\Logger\Null', + 'Magento\Framework\DB\LoggerInterface' => 'Magento\Framework\DB\Logger\Quiet', 'Magento\Framework\Locale\ConfigInterface' => 'Magento\Framework\Locale\Config', 'Magento\Framework\Module\ModuleRegistryInterface' => 'Magento\Framework\Module\Registrar', 'Magento\Framework\Filesystem\DriverInterface' => 'Magento\Framework\Filesystem\Driver\File', diff --git a/setup/src/Magento/Setup/Console/Command/AdminUserCreateCommand.php b/setup/src/Magento/Setup/Console/Command/AdminUserCreateCommand.php index f432cc52d1b..e48b81519fd 100644 --- a/setup/src/Magento/Setup/Console/Command/AdminUserCreateCommand.php +++ b/setup/src/Magento/Setup/Console/Command/AdminUserCreateCommand.php @@ -102,7 +102,7 @@ class AdminUserCreateCommand extends AbstractSetupCommand public function validate(InputInterface $input) { $errors = []; - $user = new \Magento\Framework\Object(); + $user = new \Magento\Framework\DataObject(); $user->setFirstname($input->getOption(AdminAccount::KEY_FIRST_NAME)) ->setLastname($input->getOption(AdminAccount::KEY_LAST_NAME)) ->setUsername($input->getOption(AdminAccount::KEY_USER)) @@ -112,7 +112,7 @@ class AdminUserCreateCommand extends AbstractSetupCommand ? '' : $input->getOption(AdminAccount::KEY_PASSWORD) ); - $validator = new \Magento\Framework\Validator\Object; + $validator = new \Magento\Framework\Validator\DataObject; $this->validationRules->addUserInfoRules($validator); $this->validationRules->addPasswordRules($validator); diff --git a/setup/src/Magento/Setup/Controller/DatabaseCheck.php b/setup/src/Magento/Setup/Controller/DatabaseCheck.php index 8d5a2380a86..78cb524f566 100644 --- a/setup/src/Magento/Setup/Controller/DatabaseCheck.php +++ b/setup/src/Magento/Setup/Controller/DatabaseCheck.php @@ -35,9 +35,8 @@ class DatabaseCheck extends AbstractActionController */ public function indexAction() { - $params = Json::decode($this->getRequest()->getContent(), Json::TYPE_ARRAY); - try { + $params = Json::decode($this->getRequest()->getContent(), Json::TYPE_ARRAY); $password = isset($params['password']) ? $params['password'] : ''; $this->dbValidator->checkDatabaseConnection($params['name'], $params['host'], $params['user'], $password); $tablePrefix = isset($params['tablePrefix']) ? $params['tablePrefix'] : ''; diff --git a/setup/src/Magento/Setup/Controller/Install.php b/setup/src/Magento/Setup/Controller/Install.php index 4e5232c3602..1677c45f8bb 100644 --- a/setup/src/Magento/Setup/Controller/Install.php +++ b/setup/src/Magento/Setup/Controller/Install.php @@ -73,6 +73,7 @@ class Install extends AbstractActionController * Index Action * * @return JsonModel + * @SuppressWarnings(PHPMD.NPathComplexity) */ public function startAction() { @@ -134,7 +135,12 @@ class Install extends AbstractActionController */ private function importDeploymentConfigForm() { - $source = Json::decode($this->getRequest()->getContent(), Json::TYPE_ARRAY); + $content = $this->getRequest()->getContent(); + $source = []; + if ($content) { + $source = Json::decode($content, Json::TYPE_ARRAY); + } + $result = []; $result[SetupConfigOptionsList::INPUT_KEY_DB_HOST] = isset($source['db']['host']) ? $source['db']['host'] : ''; $result[SetupConfigOptionsList::INPUT_KEY_DB_NAME] = isset($source['db']['name']) ? $source['db']['name'] : ''; @@ -163,9 +169,13 @@ class Install extends AbstractActionController */ private function importUserConfigForm() { - $source = Json::decode($this->getRequest()->getContent(), Json::TYPE_ARRAY); $result = []; - if (!empty($source['config']['address']['base_url'])) { + $source = []; + $content = $this->getRequest()->getContent(); + if ($content) { + $source = Json::decode($content, Json::TYPE_ARRAY); + } + if (isset($source['config']['address']['base_url']) && !empty($source['config']['address']['base_url'])) { $result[UserConfig::KEY_BASE_URL] = $source['config']['address']['base_url']; } $result[UserConfig::KEY_USE_SEF_URL] = isset($source['config']['rewrites']['allowed']) @@ -194,11 +204,16 @@ class Install extends AbstractActionController * Maps data from request to format of admin account model * * @return array + * @SuppressWarnings(PHPMD.NPathComplexity) */ private function importAdminUserForm() { - $source = Json::decode($this->getRequest()->getContent(), Json::TYPE_ARRAY); $result = []; + $source = []; + $content = $this->getRequest()->getContent(); + if ($content) { + $source = Json::decode($content, Json::TYPE_ARRAY); + } $result[AdminAccount::KEY_USER] = isset($source['admin']['username']) ? $source['admin']['username'] : ''; $result[AdminAccount::KEY_PASSWORD] = isset($source['admin']['password']) ? $source['admin']['password'] : ''; $result[AdminAccount::KEY_EMAIL] = isset($source['admin']['email']) ? $source['admin']['email'] : ''; diff --git a/setup/src/Magento/Setup/Controller/Modules.php b/setup/src/Magento/Setup/Controller/Modules.php index e3be12b3380..a2e9ca74582 100644 --- a/setup/src/Magento/Setup/Controller/Modules.php +++ b/setup/src/Magento/Setup/Controller/Modules.php @@ -67,9 +67,13 @@ class Modules extends AbstractActionController */ public function allModulesValidAction() { - $params = Json::decode($this->getRequest()->getContent(), Json::TYPE_ARRAY); - $enabledModules = isset($params['selectedModules']) ? $params['selectedModules'] : []; - return $this->checkGraph($enabledModules); + try { + $params = Json::decode($this->getRequest()->getContent(), Json::TYPE_ARRAY); + $enabledModules = isset($params['selectedModules']) ? $params['selectedModules'] : []; + return $this->checkGraph($enabledModules); + } catch (\Exception $e) { + return new JsonModel(['success' => false, 'error' => $e->getMessage()]); + } } /** diff --git a/setup/src/Magento/Setup/Module/ConnectionFactory.php b/setup/src/Magento/Setup/Module/ConnectionFactory.php index 7ccb06aa918..cf756d2f3bf 100644 --- a/setup/src/Magento/Setup/Module/ConnectionFactory.php +++ b/setup/src/Magento/Setup/Module/ConnectionFactory.php @@ -36,11 +36,11 @@ class ConnectionFactory implements \Magento\Framework\Model\Resource\Type\Db\Con } $adapterInstance = new \Magento\Framework\Model\Resource\Type\Db\Pdo\Mysql( - new \Magento\Framework\Stdlib\String(), + new \Magento\Framework\Stdlib\StringUtils(), new \Magento\Framework\Stdlib\DateTime(), $connectionConfig ); - return $adapterInstance->getConnection($this->serviceLocator->get('Magento\Framework\DB\Logger\Null')); + return $adapterInstance->getConnection($this->serviceLocator->get('Magento\Framework\DB\Logger\Quiet')); } } diff --git a/setup/src/Magento/Setup/Test/Unit/Controller/DatabaseCheckTest.php b/setup/src/Magento/Setup/Test/Unit/Controller/DatabaseCheckTest.php deleted file mode 100644 index afafcbc9143..00000000000 --- a/setup/src/Magento/Setup/Test/Unit/Controller/DatabaseCheckTest.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Setup\Test\Unit\Controller; - -use \Magento\Setup\Controller\DatabaseCheck; -use Magento\Setup\Validator\DbValidator; - -class DatabaseCheckTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var DbValidator|\PHPUnit_Framework_MockObject_MockObject - */ - private $dbValidator; - - /** - * Controller - * - * @var \Magento\Setup\Controller\DatabaseCheck - */ - private $controller; - - public function setUp() - { - $this->dbValidator = $this->getMock('Magento\Setup\Validator\DbValidator', [], [], '', false); - $this->controller = new DatabaseCheck($this->dbValidator); - } - - public function testIndexAction() - { - $this->dbValidator->expects($this->once())->method('checkDatabaseConnection'); - $jsonModel = $this->controller->indexAction(); - $this->assertInstanceOf('Zend\View\Model\ViewModel', $jsonModel); - $variables = $jsonModel->getVariables(); - $this->assertArrayHasKey('success', $variables); - $this->assertTrue($variables['success']); - } - - public function testIndexActionWithError() - { - $this->dbValidator->expects($this->once())->method('checkDatabaseConnection')->will( - $this->throwException(new \Exception) - ); - $jsonModel = $this->controller->indexAction(); - $this->assertInstanceOf('\Zend\View\Model\JsonModel', $jsonModel); - $variables = $jsonModel->getVariables(); - $this->assertArrayHasKey('success', $variables); - $this->assertArrayHasKey('error', $variables); - $this->assertFalse($variables['success']); - } - - public function testIndexActionCheckPrefix() - { - $this->dbValidator->expects($this->once())->method('checkDatabaseTablePrefix'); - $this->controller->indexAction(); - } -} diff --git a/setup/src/Magento/Setup/Test/Unit/Controller/InstallTest.php b/setup/src/Magento/Setup/Test/Unit/Controller/InstallTest.php index d7b9871d41e..d5ff4a9f961 100644 --- a/setup/src/Magento/Setup/Test/Unit/Controller/InstallTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Controller/InstallTest.php @@ -114,7 +114,8 @@ class InstallTest extends \PHPUnit_Framework_TestCase $this->assertArrayHasKey('success', $variables); $this->assertArrayHasKey('console', $variables); $this->assertFalse($variables['success']); - $this->assertStringStartsWith('exception \'LogicException\' with message \'' . $e, $variables['console'][0]); + $this->assertContains('LogicException', $variables['console'][0]); + $this->assertContains($e, $variables['console'][0]); } public function testProgressActionWithSampleDataError() diff --git a/setup/src/Magento/Setup/Test/Unit/Controller/ModulesTest.php b/setup/src/Magento/Setup/Test/Unit/Controller/ModulesTest.php index 96a30e19ac7..3581cf81ee0 100644 --- a/setup/src/Magento/Setup/Test/Unit/Controller/ModulesTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Controller/ModulesTest.php @@ -81,15 +81,6 @@ class ModulesTest extends \PHPUnit_Framework_TestCase $this->assertFalse($variables['success']); } - public function testAllModulesValidAction() - { - $jsonModel = $this->controller->allModulesValidAction(); - $this->assertInstanceOf('Zend\View\Model\JsonModel', $jsonModel); - $variables = $jsonModel->getVariables(); - $this->assertArrayHasKey('success', $variables); - $this->assertTrue($variables['success']); - } - /** * @return array */ diff --git a/setup/src/Magento/Setup/Test/Unit/Model/WebLoggerTest.php b/setup/src/Magento/Setup/Test/Unit/Model/WebLoggerTest.php index fc1b7e5802a..3e8cf508a23 100644 --- a/setup/src/Magento/Setup/Test/Unit/Model/WebLoggerTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Model/WebLoggerTest.php @@ -97,11 +97,15 @@ class WebLoggerTest extends \PHPUnit_Framework_TestCase $e2 = new \Exception('Dummy Exception2'); $this->webLogger->logError($e1); - $this->assertContains('[ERROR] exception \'Exception\' with message \'Dummy Exception1\'', self::$log); + $this->assertContains('[ERROR]', self::$log); + $this->assertContains('Exception', self::$log); + $this->assertContains($e1->getMessage(), self::$log); $this->webLogger->logError($e2); - $this->assertContains('[ERROR] exception \'Exception\' with message \'Dummy Exception1\'', self::$log); - $this->assertContains('[ERROR] exception \'Exception\' with message \'Dummy Exception2\'', self::$log); + $this->assertContains('[ERROR]', self::$log); + $this->assertContains('Exception', self::$log); + $this->assertContains($e1->getMessage(), self::$log); + $this->assertContains($e2->getMessage(), self::$log); } public function testLog() diff --git a/setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/Adapter/Php/TokenizerTest.php b/setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/Adapter/Php/TokenizerTest.php index 553f6b41431..d7d63793445 100644 --- a/setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/Adapter/Php/TokenizerTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/Adapter/Php/TokenizerTest.php @@ -50,7 +50,7 @@ class TokenizerTest extends \PHPUnit_Framework_TestCase $this->assertEquals(false, $this->tokenizer->isMatchingClass($class)); // ) $this->assertEquals(false, $this->tokenizer->isMatchingClass($class)); // ; $this->assertEquals(false, $this->tokenizer->isMatchingClass($class)); // new - $this->assertEquals(false, $this->tokenizer->isMatchingClass($class)); // \Magento\Framework\Object( + $this->assertEquals(false, $this->tokenizer->isMatchingClass($class)); // \Magento\Framework\DataObject( $this->assertEquals(false, $this->tokenizer->isMatchingClass($class)); // ) $this->assertEquals(false, $this->tokenizer->isMatchingClass($class)); // ; } diff --git a/setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/Adapter/Php/_files/objectsCode.php.txt b/setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/Adapter/Php/_files/objectsCode.php.txt index 72b351197a1..cf0c4a52738 100644 --- a/setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/Adapter/Php/_files/objectsCode.php.txt +++ b/setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/Adapter/Php/_files/objectsCode.php.txt @@ -2,4 +2,4 @@ new \Magento\Framework\Phrase('Testing'); new Phrase('More testing'); -new \Magento\Framework\Object(); +new \Magento\Framework\DataObject(); -- GitLab