Code Duplication    Length = 15-16 lines in 2 locations

cache.php 1 location

@@ 106-120 (lines=15) @@
103
 * @param \Aimeos\MShop\Context\Item\Iface $ctx Context object
104
 * @param string|null $sites List of site codes separated by a space
105
 */
106
function getSiteItems( \Aimeos\MShop\Context\Item\Iface $ctx, $sites )
107
{
108
	$manager = \Aimeos\MShop\Factory::createManager( $ctx, 'locale/site' );
109
	$search = $manager->createSearch();
110
111
	if( is_scalar( $sites ) && $sites != '' ) {
112
		$sites = explode( ' ', $sites );
113
	}
114
115
	if( !empty( $sites ) ) {
116
		$search->setConditions( $search->compare( '==', 'locale.site.code', $sites ) );
117
	}
118
119
	return $manager->searchItems( $search );
120
}
121
122
123
/**

job.php 1 location

@@ 124-139 (lines=16) @@
121
 * @param \Aimeos\MShop\Context\Item\Iface $ctx Context object
122
 * @param string|null $sites List of site codes separated by a space
123
 */
124
function getSiteItems( \Aimeos\MShop\Context\Item\Iface $ctx, $sites )
125
{
126
	$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx );
127
	$manager = $localeManager->getSubManager( 'site' );
128
	$search = $manager->createSearch();
129
130
	if( is_scalar( $sites ) && $sites != '' ) {
131
		$sites = explode( ' ', $sites );
132
	}
133
134
	if( !empty( $sites ) ) {
135
		$search->setConditions( $search->compare( '==', 'locale.site.code', $sites ) );
136
	}
137
138
	return $manager->searchItems( $search );
139
}
140
141
142
/**